尝试通过以下具有适当导入的清单使用 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