Build the Environments

In the Cloud9 workspace, run the following commands:

  • Clone the demo repository:
cd ~/environment
git clone https://github.com/brentley/fargate-demo.git
  • Ensure service linked roles exist for Load Balancers and ECS:
aws iam get-role --role-name "AWSServiceRoleForElasticLoadBalancing" || aws iam create-service-linked-role --aws-service-name "elasticloadbalancing.amazonaws.com"

aws iam get-role --role-name "AWSServiceRoleForECS" || aws iam create-service-linked-role --aws-service-name "ecs.amazonaws.com"
  • Build a VPC, ECS Cluster, and ALB:
cd ~/environment/fargate-demo

aws cloudformation deploy --stack-name fargate-demo --template-file cluster-fargate-private-vpc.yml --capabilities CAPABILITY_IAM

aws cloudformation deploy --stack-name fargate-demo-alb --template-file alb-external.yml

Let’s do a dry run and see what CloudFormation is generated!

Copy/Paste the following commands into your Cloud9 workspace:

cd ~/environment/ecsdemo-platform
mu -d env up acceptance
ls -la /tmp/mu-dryrun

The files are broken up into stacks, and include a template for the CloudFormation and a config for the parameters that will be templated.

To see how the VPC will be constructed, for example, take a look at the template-mu-vpc-acceptance.yml file:

less /tmp/mu-dryrun/template-${MU_NAMESPACE}-vpc-acceptance.yml

This will dry-run Mu and generate CloudFormation so you can examine what will be built before actually building it.

Let’s bring up the Acceptance and Production environments!

Copy/Paste the following commands into your Cloud9 workspace:

cd ~/environment/ecsdemo-platform
mu env up -A

Watch what is being built in CloudFormation

This will take 10 minutes