Skip to content

Latest commit

 

History

History

ecs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

AWS Elastic Container Service Cluster (Fargate)

terraform elb cw-alarm autoscaling ecs-fargate r53

Use this Terraform template to create a AWS ECS cluster (Fargate). Along with ECS, it also creates some other resources the ECS cluster needs, like - elastic load balancer, auto-scaling policies, cloudwatch alarms, route 53 entries etc.

Architecture

A simplified view of the architecture is as follows - arch

Prerequisites

While this module creates most of the resources ECS needs, there are a few resources it expects to exist. Following must exist in the account -

  • VPC with 2 public and 2 private subnets tagged Tier:Public, Tier:Private (can be created using cloudformation template vpc-stack)
  • ACM certificate for the Load balancer 443 listener
  • ECR Repository (can be created using ecr module)
  • An IMAGE:TAG combination in the ECR repository

How to use

Checkout the repository, modify the values as indicated in the files, and execute the base template first to create a S3 backend

cd base
terraform init
terraform plan
terraform apply

Next, create the ECR repo

cd ecr
terraform init
terraform plan
terraform apply

Finally, create the ECS stack

cd ecs
terraform init
terraform plan
terraform apply

Alternative

You could also create the same set of resources using Cloudformation, if you prefer. Take a look at this

Contact

Drop me a note or open an issue if something doesn't work out.

Cheers! 👍