Amazon ECS Deployment with CloudFormation: Difference between revisions
Jump to navigation
Jump to search
Line 19: | Line 19: | ||
<font color=teal>Type: AWS::ECS::TaskDefinition</font> | <font color=teal>Type: AWS::ECS::TaskDefinition</font> | ||
Properties: | Properties: | ||
[[Amazon_ECS_Concepts#Family|Family]]: | [[Amazon_ECS_Concepts#Family|Family]]: !Ref ProjectID | ||
[[Amazon_ECS_Concepts#Compatibilities|RequiresCompatibilities]]: ['FARGATE'] | [[Amazon_ECS_Concepts#Compatibilities|RequiresCompatibilities]]: ['FARGATE'] | ||
[[Amazon_ECS_Concepts#Task_Role|TaskRoleArn]]: !GetAtt TaskRole.Arn | [[Amazon_ECS_Concepts#Task_Role|TaskRoleArn]]: !GetAtt TaskRole.Arn | ||
Line 27: | Line 27: | ||
[[Amazon_ECS_Concepts#Task_CPU|Cpu]]: '2048' | [[Amazon_ECS_Concepts#Task_CPU|Cpu]]: '2048' | ||
[[Amazon_ECS_Concepts#Container_Definition|ContainerDefinitions]]: | [[Amazon_ECS_Concepts#Container_Definition|ContainerDefinitions]]: | ||
- [[Amazon_ECS_Concepts#Container_Name|Name]]: ' | - [[Amazon_ECS_Concepts#Container_Name|Name]]: !Sub '${ProjectID}-container' | ||
[[Amazon_ECS_Concepts#Container_Image|Image]]: !Sub ${Image}:${Tag} | [[Amazon_ECS_Concepts#Container_Image|Image]]: !Sub ${Image}:${Tag} | ||
[[Amazon_ECS_Concepts#Essential_Flag|Essential]]: 'true' | [[Amazon_ECS_Concepts#Essential_Flag|Essential]]: 'true' | ||
Line 50: | Line 50: | ||
<font color=darkgray>TODO</font> | <font color=darkgray>TODO</font> | ||
=Organizatorium= | =Organizatorium= |
Revision as of 19:42, 30 March 2019
External
Internal
Procedure
Declare the task definition:
AWS::ECS::TaskDefinition
Resources: TaskDefinition: Type: AWS::ECS::TaskDefinition Properties: Family: !Ref ProjectID RequiresCompatibilities: ['FARGATE'] TaskRoleArn: !GetAtt TaskRole.Arn ExecutionRoleArn: !GetAtt TaskExecutionRole.Arn NetworkMode: 'awsvpc' Memory: '4096' Cpu: '2048' ContainerDefinitions: - Name: !Sub '${ProjectID}-container' Image: !Sub ${Image}:${Tag} Essential: 'true' Memory: '4096' Cpu: '2048' PortMappings: - HostPort: 10002 ContainerPort: 10002 Environment: - Name: SPRING_PROFILES_ACTIVE Value: 'something' LogConfiguration: LogDriver: "awslogs" Options: awslogs-group: 'some-group' awslogs-region: !Sub ${AWS::Region} awslogs-stream-prefix: 'some-prefix'
Dependencies
Declare the dependencies: tasks, etc.
TODO
Organizatorium
AWS::ECS::Service
Resources: ServiceDefinition: Type: AWS::ECS::Service DependsOn: LoadBalancerListener Properties: ServiceName: themyscira LaunchType: FARGATE Cluster: 'some-cluster' TaskDefinition: !Ref TaskDefinition DesiredCount: 1 HealthCheckGracePeriodSeconds: 60 NetworkConfiguration: AwsvpcConfiguration: AssignPublicIp: DISABLED SecurityGroups: - !Ref ServiceSecurityGroup Subnets: - 'blue-subnet' - 'green-subnet' ServiceRegistries: - RegistryArn: !GetAtt ServiceDiscovery.Arn LoadBalancers: - ContainerName: 'some-name' ContainerPort: 10002 TargetGroupArn: !Ref TargetGroup