Git Product home page Git Product logo

terraform-aws-eks-app's Introduction

terraform-aws-eks-app

aws Components

  • az: ["eu-west-1a", "eu-west-1a", "eu-west-1a", ]
  • vpc
  • eks
  • rds
  • ecr
  • secrets

Architecture design

Architecture design

  • polr as URL Shortening App
  • Use aws rds aurora serverless as storage
  • eks in private subnet as container's platform
  • karpenter as eks node autoscaler
  • prometheus for monitoring
  • NLB in public subnet to expose application
  • AWS Secrets for app admin and db admin secrets source
  • AWS ECR as storage for container image artifacts
  • Route53 and ALB-TLS configuration are not implemented in demo due these configuration requires domain registration

how to deploy

Prereqisites

  1. aws access config:

copy AWS admin keys into infrastructure/.env

AWS_ACCESS_KEY_ID=******
AWS_DEFAULT_REGION=eu-west-1
AWS_SECRET_ACCESS_KEY=******
  1. update s3 bucket names

AWS_ACCOUNT_NAME=changeme

./infrastructure/init_scripts/terraform-s3-create-bucket-eu-west-1.sh

changeme-terraform-aws-eks-app-state-eu-west-1 -> <your_account_name>-terraform-aws-eks-app-state-eu-west-1 in next files:

./infrastructure/terraform/app/configs/backend/dev-eu-west-1.sh
./infrastructure/terraform/infra/configs/backend/default-eu-west-1.sh
./infrastructure/terraform/vpc/configs/backend/default-eu-west-1.sh

  1. buid docker shell
cd shell
make shell

in shell export AWS credentials

export $(cat /repo/infrastructure/.env | xargs)
  1. create terraform backend s3 bucket and dynamodb for terrafrom lock

in shell:

cd /repo/infrastructure/init_scripts/

./terraform-s3-create-bucket-eu-west-1.sh

./terraform-dynamodb-create-table-eu-west-1.sh
  1. deploy aws vpc resources(time ~5m)

in shell:

cd /repo/infrastructure/terraform/vpc/
make fmt
make validate
REGION=eu-west-1 make apply-plan
  1. deploy aws infra(eks, aurora rds) resources(time ~30m)
  • init rds and eks in shell:
cd /repo/infrastructure/terraform/infra/
make fmt
make validate
make apply-plan
  • init eks system's pod's udpdate vars in /repo/infrastructure/terraform/infra/configs/default-eu-west-1.tfvars
cluster_is_deployed -> true

in shell

make fmt
make validate
make apply-plan
  • init eks infra pod's and config's udpdate vars in /repo/infrastructure/terraform/infra/configs/default-eu-west-1.tfvars
karpenter_config_count -> 1
ingress_nginx_lb_count -> 1
monitoring_enabled -> 1

in shell

make fmt
make validate
make apply-plan

check eks cluster and pod's statuses

aws eks update-kubeconfig --region eu-west-1 --name infra-default-cl-ew1
k get nodes
k get pods -A
kubectl get cm -n kube-system aws-auth -o yaml
  1. build docker for app resources(time ~10m)
cd /repo/app_polr
make push

if you hget docker access issue - run as workaround next: sudo chmod 666 /var/run/docker.sock

  1. deploy app

in shell:

cd /repo/infrastructure/terraform/app/
make fmt
make validate
make apply-plan

chech app status

  • go to polr_url to chech ghost status
  • go to admin to check admin configs (find username and password in aws-secrets)
  1. test performance
cd /repo/infrastructure/testing_scripts/
./latency_test.sh < **polr_url** >

how to clean up installation

  1. destroy aws resources:

in shell:

cd /repo/infrastructure/terraform/app/
make destroy

cd /repo/infrastructure/terraform/infra/
make destroy

cd /repo/infrastructure/terraform/vpc/
make destroy
  1. delete terrafrom dynamod db tables and s3 bucket via aws console

terraform-aws-eks-app's People

Contributors

mbelousov7 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.