Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services AWS ECS-无法在cloudformation模板中指定服务名称_Amazon Web Services_Amazon Ecs_Amazon Cloudformation - Fatal编程技术网

Amazon web services AWS ECS-无法在cloudformation模板中指定服务名称

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

我正在尝试使用cloudformation模板创建AWS-ECS服务

  "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模板中引用您的服务,您还需要更新引用