AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Description: Parent stack that deploys the ECS cluster and capacity provider then launches a service inside of the cluster Parameters: VpcId: Type: AWS::EC2::VPC::Id Description: VPC ID where the ECS cluster is launched SubnetIds: Type: List Description: List of subnet IDs where the EC2 instances will be launched Resources: # This stack contains cluster wide resources that will be shared # by all services that get launched in the stack BaseStack: Type: AWS::Serverless::Application Properties: Location: cluster-capacity-provider.yml Parameters: VpcId: !Ref VpcId SubnetIds: !Join [',', !Ref SubnetIds] # This service will be launched into the cluster by passing # details from the base stack into the service stack Service: Type: AWS::Serverless::Application Properties: Location: service-capacity-provider.yml Parameters: VpcId: !Ref VpcId SubnetIds: !Join [',', !Ref SubnetIds] ClusterName: !GetAtt BaseStack.Outputs.ClusterName ECSTaskExecutionRole: !GetAtt BaseStack.Outputs.ECSTaskExecutionRole CapacityProvider: !GetAtt BaseStack.Outputs.CapacityProvider