Description: > This template deploys a VPC, with a pair of public and private subnets spread across two Availabilty Zones. It deploys an Internet Gateway, with a default route on the public subnets. It deploys a pair of NAT Gateways (one in each AZ), and default routes for them in the private subnets. It then deploys a highly available ECS cluster using an AutoScaling Group, with ECS hosts distributed across multiple Availability Zones. Finally, it deploys a pair of example ECS services from containers published in Amazon EC2 Container Registry (Amazon ECR). Last Modified: 22nd September 2016 Author: Paul Maddox Resources: VPC: Type: AWS::CloudFormation::Stack Properties: TemplateURL: https://s3.amazonaws.com/ecs-refarch-cloudformation/infrastructure/vpc.yaml Parameters: EnvironmentName: !Ref AWS::StackName VpcCIDR: 10.180.0.0/16 PublicSubnet1CIDR: 10.180.8.0/21 PublicSubnet2CIDR: 10.180.16.0/21 PrivateSubnet1CIDR: 10.180.24.0/21 PrivateSubnet2CIDR: 10.180.32.0/21 SecurityGroups: Type: AWS::CloudFormation::Stack Properties: TemplateURL: https://s3.amazonaws.com/ecs-refarch-cloudformation/infrastructure/security-groups.yaml Parameters: EnvironmentName: !Ref AWS::StackName VPC: !GetAtt VPC.Outputs.VPC ALB: Type: AWS::CloudFormation::Stack Properties: TemplateURL: https://s3.amazonaws.com/ecs-refarch-cloudformation/infrastructure/load-balancers.yaml Parameters: EnvironmentName: !Ref AWS::StackName VPC: !GetAtt VPC.Outputs.VPC Subnets: !GetAtt VPC.Outputs.PublicSubnets SecurityGroup: !GetAtt SecurityGroups.Outputs.LoadBalancerSecurityGroup ECS: Type: AWS::CloudFormation::Stack Properties: TemplateURL: https://s3.amazonaws.com/ecs-refarch-cloudformation/infrastructure/ecs-cluster.yaml Parameters: EnvironmentName: !Ref AWS::StackName InstanceType: t2.large ClusterSize: 4 VPC: !GetAtt VPC.Outputs.VPC SecurityGroup: !GetAtt SecurityGroups.Outputs.ECSHostSecurityGroup Subnets: !GetAtt VPC.Outputs.PrivateSubnets ProductService: Type: AWS::CloudFormation::Stack Properties: TemplateURL: https://s3.amazonaws.com/ecs-refarch-cloudformation/services/product-service/service.yaml Parameters: VPC: !GetAtt VPC.Outputs.VPC Cluster: !GetAtt ECS.Outputs.Cluster DesiredCount: 2 Listener: !GetAtt ALB.Outputs.Listener Path: /products WebsiteService: Type: AWS::CloudFormation::Stack Properties: TemplateURL: https://s3.amazonaws.com/ecs-refarch-cloudformation/services/website-service/service.yaml Parameters: VPC: !GetAtt VPC.Outputs.VPC Cluster: !GetAtt ECS.Outputs.Cluster DesiredCount: 2 ProductServiceUrl: !Join [ "/", [ !GetAtt ALB.Outputs.LoadBalancerUrl, "products" ]] Listener: !GetAtt ALB.Outputs.Listener Path: / Outputs: ProductServiceUrl: Description: The URL endpoint for the product service Value: !Join [ "/", [ !GetAtt ALB.Outputs.LoadBalancerUrl, "products" ]] WebsiteServiceUrl: Description: The URL endpoint for the website service Value: !Join ["", [ !GetAtt ALB.Outputs.LoadBalancerUrl, "/" ]]