Amazon ECS Deployment with CloudFormation: Difference between revisions
Jump to navigation
Jump to search
Line 4: | Line 4: | ||
* [[Amazon ECS Concepts]] | * [[Amazon ECS Concepts]] | ||
* [[AWS_CloudFormation_Resource_Types|CloudFormation Resource Types]] | * [[AWS_CloudFormation_Resource_Types|CloudFormation Resource Types]] | ||
=Organizatorium= | |||
==AWS::ECS::TaskDefinition== | |||
Resources: | |||
TaskDefinition: | |||
Type: AWS::ECS::TaskDefinition | |||
Properties: | |||
Family: 'some-family' | |||
RequiresCompatibilities: ["FARGATE"] | |||
NetworkMode: "awsvpc" | |||
Cpu: '2048' | |||
Memory: '4096' | |||
TaskRoleArn: !GetAtt TaskRole.Arn | |||
ExecutionRoleArn: !GetAtt TaskExecutionRole.Arn | |||
ContainerDefinitions: | |||
- Name: 'some-name' | |||
Cpu: '2048' | |||
Memory: '4096' | |||
Essential: 'true' | |||
Environment: | |||
- Name: SPRING_PROFILES_ACTIVE | |||
Value: 'something' | |||
Image: !Sub ${Image}:${Tag} | |||
PortMappings: | |||
- HostPort: 10002 | |||
ContainerPort: 10002 | |||
LogConfiguration: | |||
LogDriver: "awslogs" | |||
Options: | |||
awslogs-group: 'some-group' | |||
awslogs-region: !Sub ${AWS::Region} | |||
awslogs-stream-prefix: 'some-prefix' | |||
==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 |
Revision as of 17:32, 30 March 2019
Internal
Organizatorium
AWS::ECS::TaskDefinition
Resources: TaskDefinition: Type: AWS::ECS::TaskDefinition Properties: Family: 'some-family' RequiresCompatibilities: ["FARGATE"] NetworkMode: "awsvpc" Cpu: '2048' Memory: '4096' TaskRoleArn: !GetAtt TaskRole.Arn ExecutionRoleArn: !GetAtt TaskExecutionRole.Arn ContainerDefinitions: - Name: 'some-name' Cpu: '2048' Memory: '4096' Essential: 'true' Environment: - Name: SPRING_PROFILES_ACTIVE Value: 'something' Image: !Sub ${Image}:${Tag} PortMappings: - HostPort: 10002 ContainerPort: 10002 LogConfiguration: LogDriver: "awslogs" Options: awslogs-group: 'some-group' awslogs-region: !Sub ${AWS::Region} awslogs-stream-prefix: 'some-prefix'
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