Amazon web services AWS ECS-无法在cloudformation模板中指定服务名称
我正在尝试使用cloudformation模板创建AWS-ECS服务Amazon web services AWS ECS-无法在cloudformation模板中指定服务名称,amazon-web-services,amazon-ecs,amazon-cloudformation,Amazon Web Services,Amazon Ecs,Amazon Cloudformation,我正在尝试使用cloudformation模板创建AWS-ECS服务 "service": { "ServiceName": "XXX", "Type": "AWS::ECS::Service", "DependsOn": [ "AutoScalingGroup" ], "Properties": { "Cluster": { "Ref": "ECSCluster" }, "DesiredCount": "1", "T
"service": {
"ServiceName": "XXX",
"Type": "AWS::ECS::Service",
"DependsOn": [
"AutoScalingGroup"
],
"Properties": {
"Cluster": {
"Ref": "ECSCluster"
},
"DesiredCount": "1",
"TaskDefinition": {
"Ref": "taskdefinition"
}
}
},
但是我犯了一个错误
失败:无效的模板资源属性“ServiceName”
我在使用Name/serviceName时遇到了同样的问题。我可以看到serviceName是一个基于文档的参数。但我不明白为什么它会失败。如果我不指定名称,它就会工作。但我需要指定名称,以便在更新服务的不同系统中使用相同的名称
您能帮忙吗?这有点让人困惑,但服务名称是由您创建的资源的名称设置的。没有ServiceName或Name属性。下面将创建一个名为MyService的ECS服务
"MyService": {
"Type": "AWS::ECS::Service",
"DependsOn": [
"AutoScalingGroup"
],
"Properties": {
"Cluster": {
"Ref": "ECSCluster"
},
"DesiredCount": "1",
"TaskDefinition": {
"Ref": "taskdefinition"
}
}
}
显然,如果您在CloudFormation模板中引用您的服务,您还需要更新引用