AWS ECS:ECS服务Cloudformation模板中的严重错误 [英] AWS ECS: Severe bug in ECS Service Cloudformation template
问题描述
尝试通过以下具有适当导入的清单使用cloudformation创建ECS服务
UIService:
类型:AWS :: ECS :: Service
属性:
群集:!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指定主机或桥时, containerName和 containerPort的值'必须从任务def中指定Inition。
但是,当我添加所需值时(在serviceregistry属性中,使我认为它们是必需的?)
UIService:
类型:AWS :: ECS :: Service
属性:
群集:!ImportValue ECSClusterName
DesiredCount:1
LaunchType:EC2
LoadBalancers:
-ContainerName:!ImportValue UIContainerName
ContainerPort:'80'
TargetGroupArn:!ImportValue UITGArn
ServiceName:用户界面服务
ServiceRegistries:
-RegistryArn:arn:aws:servicediscovery:eu-west-1:944094092130:service / srv-oIclu40KCKM3esez7
ContainerName:!ImportValue UIContainerName
ContainerPort:'80'
TaskDefinition:!ImportValue UITaskArn
...以下失败:
遇到不受支持的属性ContainerName
解决方案这是AWS的一个错误,其中cloudformation不支持 containerName 和 containerPort 属性。这是 ServiceRegistry 的官方 docs em>,这是文档用于形成云。如果我没看错,则在发布服务发现时,它仅支持 awsvpc 网络模式,后来又添加了 bridge / host 。
目前,您可以创建基本的ECS云信息,然后使用CLI / API / SDK进行相应的更新,或者有时需要等待,以便AWS团队可以添加对它的支持。
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
解决方案This is a bug from AWS, in which the cloudformation is not supporting containerName and containerPort attribute currently. Here is the official docs for ServiceRegistry, and here is the docs for cloudformation. If I am not wrong, when service discovery was released, it only supported awsvpc networking mode and bridge/host was added later. It explains why we are having such discrepancy.
For the time being, you can create the basic ECS cloudformation, and update accordingly using CLI/API/SDK, or you can wait for sometimes so that AWS team will add support for the same.
这篇关于AWS ECS:ECS服务Cloudformation模板中的严重错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!