AWS API - 为什么在 --tag-specification 中需要 ResourceType;API 操作是否意味着资源类型?



我看到了AWS API文档。每当我想向资源添加名称时,我都可以通过使用--tag-specifications来自由添加,但是,当我修改/创建的资源似乎很清楚时,为什么我必须提供ResourceType

例如。aws ec2 create-route-table --tag-specifications "ResourceType=route-table,Tags=[{Key=Name,Value=My route table}]" --vpc-id ${VPC_ID}

在任何情况下,我会在这里提供任何其他ResourceType吗?

文件:https://docs.aws.amazon.com/cli/latest/reference/ec2/create-route-table.html提到:

ResourceType -> (string) - The type of resource to tag. Currently, the resource types that support tagging on creation are: capacity-reservation | carrier-gateway | client-vpn-endpoint | customer-gateway | dedicated-host | dhcp-options | egress-only-internet-gateway | elastic-ip | elastic-gpu | export-image-task | export-instance-task | fleet | fpga-image | host-reservation | image | import-image-task | import-snapshot-task | instance | internet-gateway | ipv4pool-ec2 | ipv6pool-ec2 | key-pair | launch-template | local-gateway-route-table-vpc-association | placement-group | prefix-list | natgateway | network-acl | network-interface | reserved-instances |route-table | security-group | snapshot | spot-fleet-request | spot-instances-request | snapshot | subnet | traffic-mirror-filter | traffic-mirror-session | traffic-mirror-target | transit-gateway | transit-gateway-attachment | transit-gateway-multicast-domain | transit-gateway-route-table | volume |vpc | vpc-peering-connection | vpc-endpoint (for interface and gateway endpoints) | vpc-endpoint-service (for AWS PrivateLink) | vpc-flow-log | vpn-connection | vpn-gateway .

因为不是所有的资源都支持标记,它们需要一种方法来区分可以标记的内容。

由于有一个单独的资源组标记API

TagResources,所以我猜标记创建API调用最终正在进行,ResourceType在API调用中传递给相应的资源组标记API,并且它有一个限制,可以标记哪些资源。

这是唯一可能的理由,而且你的观点是完全合理的,API操作应该是对正在创建的资源类型的提示,如果需要,应该将该信息进一步传递/代理到chanin。

标签规格

最新更新