Deploying ECS services
With your ECS cluster, ECS task definition, and various supporting resources in place, you can now define an ECS service that will deploy your container application as defined in the ECS task definition to your ECS cluster.Â
The following example demonstrates adding an ECS service resource to your CloudFormation template, which has a resource type of AWS::ECS::Service
:
... ... Resources: ApplicationService: Type: AWS::ECS::Service DependsOn: - ApplicationAutoscaling - ApplicationLogGroup - ApplicationLoadBalancerHttpListener Properties: TaskDefinition: !Ref ApplicationTaskDefinition Cluster: !Ref ApplicationCluster DesiredCount: !Ref ApplicationDesiredCount LoadBalancers: - ContainerName: todobackend ContainerPort: 8000 TargetGroupArn: !Ref ApplicationServiceTargetGroup Role: !Sub arn:aws:iam::${AWS::AccountId}:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS
DeploymentConfiguration...