Travel POC
This project makes use of Booking API and TravelPayouts API. Front end is developed using React and backend with Spring Boot. Resources are provisioned in AWS using Terraform.
I have created microservices for API Gateway, Flight Service, Hotel Service, IATA Service.Authentication is done via Cognito. JWT is passed to API Gateway POD and once the token is validated, the respective service is called. API Gateways provides cross cutting concerns such as logging and security. API Gateway service makes use of Spring Cloud Kubernetes,Spring Cloud Gateway . ALB can be integrated with Cognito but there are some limitations so went with API gateway pattern.
Terraform project TerraformEKSRDS creates the following resources
- VPC with 2 public subnets and 2 private subnets
- EKS Cluster
- IAM OIDC Identity Provider
- IAM roles for service account to access DynamoDB (set up access at POD level for AWS services)
- MySQL DB
- DynamoDB
- Service Accounts along with IAM role association for both DynamoDB and External DNS (Check out the links: https://marcincuber.medium.com/amazon-eks-with-oidc-provider-iam-roles-for-kubernetes-services-accounts-59015d15cb0c , https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/aws.md#iam-permissions)
Terraform project TerraformS3DNS creates the following resources
-
S3 bucket for static website hosting
-
IAM policy for S3
-
Cloud Front Distribution
-
SSL Certificate for the domain
Pre-Requisites:
- AWS Account
- Cognito User Pool (User Pool Id has to be added to jwt.aws.userPoolId in Api Gateway ConfigMap)
- Domain hosted at Route 53
STEPS
-
Register with https://rapidapi.com/tipsters/api/booking-com/ to get key for Booking API
-
Register with https://www.travelpayouts.com/developers/api to get key for Travel Payouts API
-
Substitute the keys in ConfigMaps in the respective service yaml file in the folder KubernetesManifests
-
Navigate to TerraformEKSRDS and execute the following command
terraform init terraform plan terraform apply --auto-approve
-
Once the resources are created, get the MySQL endpoint and substitute in ConfigMap and external name service in 01-IataService.yaml . Connect to MySQl and execute DBScript.sql to create and populate table for IATA codes
-
Navigate to TerraformS3DNS and execute the following command
terraform init terraform plan terraform apply --auto-approve
-
Navigate to TravelServiceFrontend and execute the following command
npm run build
-
Final Step is applying Kubernetes manifests. There are some placeholders which have to be replaced. Mentioned in Manifests Readme file
kubectl apply -f KubernetesManifests/.
-
Optionaly install kube-prometheus-stack helm chart
Kube Prometheus Stack:
helm repo add monitoring https://prometheus-community.github.io/helm-charts
helm repo update
helm pull monitoring/kube-prometheus-stack --untar=true
Create customvalues.yaml with the following values
grafana:
adminPassword: admin
service:
type: NodePort