Skip to content

Instantly share code, notes, and snippets.

@cp-sumi-k
Last active April 12, 2022 12:44
Show Gist options
  • Save cp-sumi-k/c1a83c89ebb1e5990b16e575ce3f812e to your computer and use it in GitHub Desktop.
Save cp-sumi-k/c1a83c89ebb1e5990b16e575ce3f812e to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: 2010-09-09
Description: An ECS, ECR, ALB and cloudfront stack
Resources:
ECSService:
Type: AWS::ECS::Service
DependsOn:
- HTTPListener
- HTTPSListener
Properties:
LaunchType: FARGATE #launch type is farget
Cluster:
Ref: "ECSCluster" #ecs cluster reference
DesiredCount: 1
TaskDefinition:
Ref: "TaskDefinition" #task definition reference
DeploymentConfiguration:
MaximumPercent: 100
MinimumHealthyPercent: 0
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: ENABLED
SecurityGroups:
- !GetAtt ApplicationLBToECSSecurityGroup.GroupId #security group id
Subnets: [<SUBNET-ID-1>, <SUBNET-ID-2>] #can add multiple subnet ids
LoadBalancers:
- TargetGroupArn:
Ref: TargetGroup #target group reference
ContainerPort: 3000
ContainerName: < ECR-CONTAINER-NAME>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment