【发布时间】:2019-02-15 15:04:10
【问题描述】:
尝试通过以下具有适当导入的清单使用 cloudformation 创建 ECS 服务
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
此操作失败并显示以下消息:
为 networkMode 指定 'host' 或 'bridge' 时,必须从任务定义中指定 'containerName' 和 'containerPort' 的值。
但是,当我添加想要的值时(在我认为需要它们的 serviceregistry 属性中?)
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
...我得到以下失败:
遇到不支持的属性 ContainerName
【问题讨论】:
标签: amazon-web-services amazon-cloudformation amazon-ecs aws-ecs