Browse the Repo

file-type-icon.circleci
file-type-icon_docs
file-type-iconexamples
file-type-icondeploy-ecs-task
file-type-icondocker-daemon-service
file-type-icondocker-fargate-service-with-alb
file-type-icondocker-fargate-service-with-efs-volume
file-type-icondocker-fargate-service-with-nlb
file-type-icondocker-fargate-service-without-lb
file-type-icondocker-fargate-spot-service-with-alb
file-type-icondocker-service-with-alb-and-nlb
file-type-icondocker-service-with-alb-autoscaling
file-type-icondocker-service-with-alb-canary
file-type-iconcontainers
file-type-iconuser-data
file-type-iconREADME.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvars.tf
file-type-icondocker-service-with-alb
file-type-icondocker-service-with-autoscaling
file-type-icondocker-service-with-canary-deployment
file-type-icondocker-service-with-elb
file-type-icondocker-service-with-private-discovery
file-type-icondocker-service-with-public-discovery
file-type-icondocker-service-without-elb
file-type-icondocker-vpc-service-with-alb
file-type-iconexample-docker-image
file-type-iconexample-ecs-instance-ami
file-type-iconexample-vpc
file-type-iconmodules
file-type-icontest
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.adoc
file-type-iconcore-concepts.md
file-type-iconsetup.cfg
file-type-iconterraform-cloud-enterprise-private-module-...

Browse the Repo

file-type-icon.circleci
file-type-icon_docs
file-type-iconexamples
file-type-icondeploy-ecs-task
file-type-icondocker-daemon-service
file-type-icondocker-fargate-service-with-alb
file-type-icondocker-fargate-service-with-efs-volume
file-type-icondocker-fargate-service-with-nlb
file-type-icondocker-fargate-service-without-lb
file-type-icondocker-fargate-spot-service-with-alb
file-type-icondocker-service-with-alb-and-nlb
file-type-icondocker-service-with-alb-autoscaling
file-type-icondocker-service-with-alb-canary
file-type-iconcontainers
file-type-iconuser-data
file-type-iconREADME.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvars.tf
file-type-icondocker-service-with-alb
file-type-icondocker-service-with-autoscaling
file-type-icondocker-service-with-canary-deployment
file-type-icondocker-service-with-elb
file-type-icondocker-service-with-private-discovery
file-type-icondocker-service-with-public-discovery
file-type-icondocker-service-without-elb
file-type-icondocker-vpc-service-with-alb
file-type-iconexample-docker-image
file-type-iconexample-ecs-instance-ami
file-type-iconexample-vpc
file-type-iconmodules
file-type-icontest
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.adoc
file-type-iconcore-concepts.md
file-type-iconsetup.cfg
file-type-iconterraform-cloud-enterprise-private-module-...
EC2 Container Service (ECS) Cluster

EC2 Container Service (ECS) Cluster

Deploy a cluster of servers for use with EC2 Container Service (ECS), Amazon's container orchestration system

Code Preview

Preview the Code

mobile file icon

README.md

down

Docker Service with ALB Canary example

This folder shows an example of how to use the ECS modules to:

  1. Deploy an ECS cluster
  2. Deploy an ALB that can be shared among many ECS Services
  3. Run a simple "Hello, World" web service Docker container as an ECS service
  4. Do a canary deployment of a single instance of a new version of the Docker container

This example runs various versions of the gruntwork/docker-test-webapp Docker image, which contains a simple Node.js app (you can find the source in the example-docker-image folder). In the real world, you'll obviously want to replace this Docker image with your own.

How do you run this example?

To run this example, you need to do the following:

  1. Build the AMI
  2. Apply the Terraform templates

Build the AMI

See the example-ecs-instance-ami docs.

Apply the Terraform templates

To apply the Terraform templates:

  1. Install Terraform
  2. Open vars.tf, set the environment variables specified at the top of the file, and fill in any other variables that don't have a default. This includes setting the cluster_instance_ami the ID of the AMI you just built.
  3. Run terraform get.
  4. Run terraform plan.
  5. If the plan looks good, run terraform apply.

Deploy a canary version

To deploy the canary version:

  1. Set the desired_number_of_canary_tasks_to_run input variable to 1.
  2. Run terraform plan.
  3. If the plan looks good, run terraform apply.

You should now have several instances of the Docker container saying "Hello World" and one instance that says "Hello Canary World".

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?