Trying to create an ECS service using cloudformation via the following manifest that has the appropriate imports
UIService:
Type: AWS::ECS::Service
Properties:
Cluster: !ImportValue ECSClusterName
DesiredCount: 1
LaunchType: EC2
LoadBalancers:
- ContainerName: !ImportValue UIContainerName
ContainerPort: '80'
TargetGroupArn: !ImportValue UITGArn
ServiceName: ui-service
ServiceRegistries:
- RegistryArn: arn:aws:servicediscovery:eu-west-1:944094092130:service/srv-oIclu40KCKM3esez7
TaskDefinition: !ImportValue UITaskArn
This fails with the following message:
When specifying 'host' or 'bridge' for networkMode, values for 'containerName' and 'containerPort' must be specified from the task definition.
However when I add the wanted values (in the serviceregistry property where it makes me assume they are needed ?)
UIService:
Type: AWS::ECS::Service
Properties:
Cluster: !ImportValue ECSClusterName
DesiredCount: 1
LaunchType: EC2
LoadBalancers:
- ContainerName: !ImportValue UIContainerName
ContainerPort: '80'
TargetGroupArn: !ImportValue UITGArn
ServiceName: ui-service
ServiceRegistries:
- RegistryArn: arn:aws:servicediscovery:eu-west-1:944094092130:service/srv-oIclu40KCKM3esez7
ContainerName: !ImportValue UIContainerName
ContainerPort: '80'
TaskDefinition: !ImportValue UITaskArn
... I get the following failure:
Encountered unsupported property ContainerName