I have the following lines in my stack template:
Service:
Type: AWS::ECS::Service
DependsOn: ListenerRule
Properties:
LaunchType: EC2
ServiceRegistries:
- RegistryArn: {"Fn::GetAtt": [ServiceDiscovery, Arn]}...
ServiceDiscovery:
Type: "AWS::ServiceDiscovery::Service"
Properties:
Description: Service discovery registry
DnsConfig:
DnsRecords: [{"Type": "SRV", "TTL": 100}]
NamespaceId:
Fn::ImportValue: PrivateDNS
Name: ping-service
Task definition network mode = "host".
When I push the template I see the following error:
When specifying 'host' or 'bridge' for networkMode, values for 'containerName' and 'containerPort' must be specified from the task definition
However if registry properties 'containerName' and 'containerPort' are set then it throws another error:
Encountered unsupported property containerName
How can service discovery registry be created with CloudFormation?