Skip to content

Latest commit

 

History

History
102 lines (73 loc) · 5.22 KB

v2_0_0.md

File metadata and controls

102 lines (73 loc) · 5.22 KB

Deploy Todo Application with DocDB(MongoDB) on AWS EKS

Todo-EKS

About

This is an example showing how to deploy a Todo application integrated with DocDB(MongoDB) on to multiple AZs using EKS.

  1. Here application and dataBase are deployed in different private subnets which are not directly accessible to outside world.
  2. For deploying application on to EKS we need Docker Images for both Todo-App & Edge-Services.
  3. To access todo application in outside world we need deploy External-DNS, Ingress Controller(Using nginx-ingress-controller) and Route53

Prerequisite

  • Install AWS CLI

    https://cloudaffaire.com/how-to-install-aws-cli/

  • Install Terraform

    https://learn.hashicorp.com/tutorials/terraform/install-cli

  • Setup AWS credentials

    https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html

Deploy

  • Deploy AWS stack
  $ export AWS_REGION=<region>
  
  # create remote state using dynamoDB & s3
  $ terraform -chdir=remote-state/<account>/<region> plan -out <account>-<region>-remote-state.plan
  $ terraform -chdir=remote-state/<account>/<region> apply <account>-<region>-remote-state.plan
  
  # Create VPC
  $ terraform -chdir=<account>/<region>/<envionment>/vpc plan -out <account>-<region>-<envionment>-vpc.plan
  $ terraform -chdir=<account>/<region>/<envionment>/vpc apply <account>-<region>-<envionment>-vpc.plan  
  
  # Create ECR for todo app
  $ terraform -chdir=<account>/<region>/<envionment>/apps/todo/v2/ecr plan -out <account>-<region>-<envionment>-ecr-todo.plan
  $ terraform -chdir=<account>/<region>/<envionment>/apps/todo/v2/ecr apply <account>-<region>-<envionment>-ecr-todo.plan
  
  # Create DocDB(MongoDB) cluster for todo app
  $ terraform -chdir=<account>/<region>/<envionment>/apps/todo/v2/mongo plan -out <account>-<region>-<envionment>-db-todo-mongo.plan
  $ terraform -chdir=<account>/<region>/<envionment>/apps/todo/v2/mongo apply <account>-<region>-<envionment>-db-todo-mongo.plan
  
  # Create Redis(Cluster configuration) cluster for todo app
  $ terraform -chdir=<account>/<region>/<envionment>/apps/todo/v2/redis plan -out <account>-<region>-<envionment>-db-todo-redis.plan
  $ terraform -chdir=<account>/<region>/<envionment>/apps/todo/v2/redis apply <account>-<region>-<envionment>-db-todo-redis.plan
  
  # Create EKS cluster
  $ terraform -chdir=<account>/<region>/<envionment>/eks/cluster plan -out <account>-<region>-<envionment>-eks.plan
  $ terraform -chdir=<account>/<region>/<envionment>/eks/cluster apply <account>-<region>-<envionment>-eks.plan
  $ aws eks update-kubeconfig --region <region> --name <envionment> # update ~/.kube/config
  
  # Create KMS keys for todo app
  $ terraform -chdir=<account>/<region>/<envionment>/apps/todo/v2/kms plan -out <account>-<region>-<envionment>-kms-todo.plan
  $ terraform -chdir=<account>/<region>/<envionment>/apps/todo/v2/kms apply <account>-<region>-<envionment>-kms-todo.plan
  
  # Create Route53 zone
  $ terraform -chdir=<account>/global/route53 plan -out <account>-global-route53.plan
  $ terraform -chdir=<account>/global/route53 apply <account>-global-route53.plan
  
  # Deploy apps external-dns & ingress-controller
  $ terraform -chdir=<account>/<region>/<envionment>/eks/services/external-dns plan -out <account>-<region>-<envionment>-apps-external-dns.plan
  $ terraform -chdir=<account>/<region>/<envionment>/eks/services/external-dns apply <account>-<region>-<envionment>-apps-external-dns.plan
  
  $ terraform -chdir=<account>/<region>/<envionment>/eks/services/ingress-nginx plan -out <account>-<region>-<envionment>-apps-ingress-nginx.plan
  $ terraform -chdir=<account>/<region>/<envionment>/eks/services/ingress-nginx apply <account>-<region>-<envionment>-apps-ingress-nginx.plan  

Access

http://edge-service.todo.tmp.dev.farm # get access_token

http://todo-app.todo.tmp.dev.farm/webjars/swagger-ui/index.html # use access_token to access the API(s)

Used AWS Resources