You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AWS CloudFormation是否支持AWS::EC2::VPCEndpoint的Tags属性?

解决CloudFormation中VPC终端节点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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 09:15:14