FargateServiceALBAutoscaling

Description

Creates an auto-scaling ECS service with internet-facing Application Load Balancer.

Resources

AWS::ElasticLoadBalancingV2::LoadBalancer

Internet-facing Application Load Balancer (ALB)

AWS::EC2::SecurityGroup x 2

Security groups for ALB and ECS service

AWS::ElasticLoadBalancingV2::TargetGroup

Target group for an ALB

AWS::S3::Bucket

S3 bucket to store ALB logs

AWS::S3::BucketPolicy

Bucket policy for ALB log bucket

AWS::ElasticLoadBalancingV2::Listener

Listener for ALB

AWS::ElasticLoadBalancingV2::ListenerRule

ALB listener rule

AWS::ECS::Service

ECS service that runs and maintains the requested number of tasks and associated load balancers.

AWS::ApplicationAutoScaling::ScalableTarget

Specifies ECS service as a scaling target for Application Auto Scaling

AWS::ApplicationAutoScaling::ScalingPolicy x 2

Scaling policies that Application Auto Scaling uses to adjust the capacity of an ECS service.

This pattern defines 2 scaling policies: Average Application Load Balancer request count per target for the Auto Scaling group Average CPU utilization of the Auto Scaling group

AWS::CloudFormation::CustomResource

Custom resource associated with the custom provisioning logic that CloudFormation will run during stack operations (Create, Update, and Delete).

AWS::Lambda::Function

Python lambda function that empty ALB log bucket when receiving stack deletion request

AWS::IAM::Role

Lambda function execution role

Special resources

CertificateArn Type: AWS::Coreograph::Parameter

Stack parameter to specify the default SSL server certificate for a secure ALB listener.

LoadBalancerURL Type: AWS::Coreograph::Output

Stack output for the URL for the application load balancer.

Input

VPC

Logical ID of AWS::EC2::VPC resource.

ECSCluster

Logical ID of AWS::ECS::Cluster resource to run the service.

ECSTaskDefinition

Logical ID of AWS::ECS::TaskDefinition resource to run in the service (FargateTaskDefinition output of FargateServiceTask pattern).

  • publicSubnet1

Logical ID of AWS::EC2::Subnet resource to be used as public subnet #1 for the ALB.

  • publicSubnet2

Logical ID of AWS::EC2::Subnet resource to be used as public subnet #2 for the ALB.

  • privateSubnet1

Logical ID of AWS::EC2::Subnet resource to be used as private subnet #1 associated with the ECS service.

  • privateSubnet2

Logical ID of AWS::EC2::Subnet resource to be used as private subnet #2 associated with the ECS service.

  • containerName

The name of the ECS Fargate container. Must be the same as containerName input of FargateServiceTask pattern). Must be a valid Cloudformation syntax that resolves to a string.

Output

None