walkthroughs/fargate/fargate-colorteller.yaml (49 lines of code) (raw):
---
Parameters:
EnvironmentName:
Type: String
Description: Environment name that joins all the stacks
AppMeshMeshName:
Type: String
Description: Name of mesh
ECSServicesDomain:
Type: String
Description: DNS namespace used by services e.g. default.svc.cluster.local
ColorTellerGreenTaskDefinition:
Type: String
Description: Task definition for ColorTeller Green Service
Resources:
### colorteller-green.default.svc.cluster.local
ColorTellerGreenServiceDiscoveryRecord:
Type: 'AWS::ServiceDiscovery::Service'
Properties:
Name: "colorteller-green"
DnsConfig:
NamespaceId:
'Fn::ImportValue': !Sub "${EnvironmentName}:ECSServiceDiscoveryNamespace"
DnsRecords:
- Type: A
TTL: 300
HealthCheckCustomConfig:
FailureThreshold: 1
ColorTellerGreenService:
Type: 'AWS::ECS::Service'
Properties:
Cluster:
'Fn::ImportValue': !Sub "${EnvironmentName}:ECSCluster"
DeploymentConfiguration:
MaximumPercent: 200
MinimumHealthyPercent: 100
DesiredCount: 1
LaunchType: FARGATE
ServiceRegistries:
- RegistryArn:
'Fn::GetAtt': ColorTellerGreenServiceDiscoveryRecord.Arn
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: DISABLED
SecurityGroups:
- 'Fn::ImportValue': !Sub "${EnvironmentName}:ECSServiceSecurityGroup"
Subnets:
- 'Fn::ImportValue': !Sub "${EnvironmentName}:PrivateSubnet1"
- 'Fn::ImportValue': !Sub "${EnvironmentName}:PrivateSubnet2"
TaskDefinition: { Ref: ColorTellerGreenTaskDefinition }