AWS ECS CloudFormation无法使用服务发现注册表创建服务

时间:2018-07-25 17:53:49

标签: amazon-web-services amazon-cloudformation amazon-ecs

我的堆栈模板中有以下几行: 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

任务定义网络模式=“主机”。

当我推模板时,看到以下错误: When specifying 'host' or 'bridge' for networkMode, values for 'containerName' and 'containerPort' must be specified from the task definition

但是,如果设置了注册表属性“ containerName”和“ containerPort”,则会引发另一个错误: Encountered unsupported property containerName

如何使用CloudFormation创建服务发现注册表?

1 个答案:

答案 0 :(得分:2)

尚无法从CloudFormation指定这些属性。如the developer guide for ECS所示,您必须从 serviceRegistries 参数指定 containerName 。但是,当我们查看CloudFormation ServiceRegistry documentation时,找不到这些选项:

{
  "Port" : Integer,
  "RegistryArn" : String
}
相关问题