AWS CloudFormation是否支持AWS::EC2::VPCEndpoint的Tags属性?
我来帮你搞定这个标签配置的问题!你遇到的Encountered unsupported property Tags错误,核心原因是网关类型的VPC终端节点(比如你配置的S3网关型VPCE)的标签不能嵌套在Properties字段里,CloudFormation对这类资源的标签位置有特殊要求。
问题根源
AWS CloudFormation里,不同资源的Tags属性位置可能不一样。对于Gateway类型的AWS::EC2::VPCEndpoint,标签需要直接定义在资源的顶层节点下,和Properties同级,而不是放在Properties内部——这和你现在写的结构刚好相反。
另外顺便提一句:PrivateDnsEnabled属性对于Gateway类型的VPCE是无效的,只有Interface类型的终端节点才支持私有DNS配置,所以你可以把这个属性删掉,避免后续出现不必要的配置警告。
修改后的完整模板
下面是调整好标签位置的CloudFormation模板:
{ "Resources": { "VPCEndpoint1": { "Type": "AWS::EC2::VPCEndpoint", "Properties": { "RouteTableIds": ["rtb-1"], "ServiceName": "com.amazonaws.eu-west-1.s3", "VpcEndpointType": "Gateway", "VpcId": "vpc-id1" }, "Tags": [ { "Key": "Name", "Value": "name1" } ] }, "VPCEndpoint2": { "Type": "AWS::EC2::VPCEndpoint", "Properties": { "RouteTableIds": ["rtb-2"], "ServiceName": "com.amazonaws.eu-west-1.s3", "VpcEndpointType": "Gateway", "VpcId": "vpc-id2" }, "Tags": [ { "Key": "Name", "Value": "name2" } ] } } }
这样修改后,标签就能正常生效,不会再出现不支持属性的报错了。
内容的提问来源于stack exchange,提问作者Abdul Qadir
相关产品推荐
相关产品推荐

