Skip to content

silazare/aws-ecs-workshop

Repository files navigation

AWS ECS Workshop completed infrastructure

Based on the AWS ECS workshop
Rewrite CloudFormation core stack and provision scripts into Terraform

  1. Used file-layout isolation (per services and per environment)
  2. Used S3 remote backends isolation (per services and per system)
  3. Used simple ALB module from example repo
  4. Used static files S3 and DynamoDB data fast deployment with terraform (not production-ready solution)

Prerequisites:

  • terraform >= 0.13
  • amazon-ecr-credential-helper (for push images into ECR)
  • tfsec >= v0.36.11 (for pre-commit usage)
  • tflint >= 0.23.0 (for pre-commit usage)
  • checkov >= 1.0.675 (for pre-commit usage)

Pre-commit installation:

git secrets --install
pre-commit install -f
pre-commit run -a

Deploy Monolith application with Like Microservice (Strangler pattern)

  1. Create buckets and DynamoDB table for Terraform remote backends (global/s3)
cd global/s3
make plan
make apply
  1. Configure backend.config and terraform.tfvars with details in each Staging dir

  2. Create Staging ECR (staging/ecr)

cd staging/ecr
make plan
make apply
  1. Build Docker images and push it to ECR via script:
cd app
./build_images.sh <aws account id>
  1. Create DynamoDB table with data (staging/dynamodb)
cd staging/dynamodb
make plan
make apply
  1. Create Staging VPC (staging/vpc)
cd staging/vpc
make plan
make apply
  1. Create Staging ECS cluster (staging/ecs) and check API ALB endpoint
cd staging/ecs
make plan
make apply
  1. Upload FrontEnd (staging/s3web) and check S3 website URL
cd staging/s3web
make plan
make apply
  1. Load testing example to check ECS Like service AutoScaling
ab -p data.json -c 20 -n 10000 <ALB FQDN>/mysfits/33e1fbd4-2fd8-45fb-a42f-f92551694506/like
  1. Destroy Infrastructure in strict reverse order, otherwise tfstate dependenices will be broken

About

AWS ECS Workshop infrastructure with Terraform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published