gpt4 book ai didi

amazon-web-services - 模板资源属性无效 "Tags"

转载 作者:行者123 更新时间:2023-12-02 03:01:01 27 4
gpt4 key购买 nike

对于以下cloudformation模板:

{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Some Stack",
"Parameters":{
"VpcId":{
"Type": "AWS::EC2::VPC::Id",
"Description": "The target VPC Id"
},
"SubnetId":{
"Type": "AWS::EC2::Subnet::Id",
"Description": "The target subnet Id"
},
"KeyName": {
"Type": "String",
"Description": "The key pair that is allowed SSH access"
}
},
"Resources":{
"EcsCluster":{
"Type": "AWS::ECS::Cluster",
"Tags": [
{
"Key": "Name",
"Value": { "Fn::Join": ["", [ { "Ref": "AWS::StackName" }, "-ecs-cluster" ] ] }
},
{
"Key": "workenv",
"Value": "dev"
},
{
"Key": "abc",
"Value": "some_value"
},
{
"Key": "function",
"Value": "someapp"
},
{
"Key": "owner",
"Value": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a7c2cac6cecbe7c6c5c489c4c8ca" rel="noreferrer noopener nofollow">[email protected]</a>"
}
]
}
},
"Outputs":{
"ElbDomainName":{
"Description": "Public DNS name of Elastic Load Balancer",
"Value": {
"Fn::GetAtt": [
"ElasticLoadBalancer",
"DNSName"
]
}
}
}
}

下面是错误:

   Invalid template resource property 'Tags'

我按照以下文档添加标签:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html


为什么 CloudFormation 服务不接受在每个资源上定义的标签?与缩进有关吗?

最佳答案

这是因为 EcsCluster 资源的 Tags 未正确定义。 Tags 属性应在 Properties 部分中定义,就像为其他资源定义 Tags 的方式一样。

"EcsCluster": {
"Type": "AWS::ECS::Cluster",
"Properties": {
"Tags": []
}
}

希望这有帮助。

关于amazon-web-services - 模板资源属性无效 "Tags",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59975335/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com