首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AWS API -为什么在--tag-specifications中需要ResourceType;API操作不是暗示了ResourceType吗?

AWS API -为什么在--tag-specifications中需要ResourceType;API操作不是暗示了ResourceType吗?
EN

Stack Overflow用户
提问于 2021-03-11 19:52:40
回答 1查看 106关注 0票数 0

我读过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提到:

代码语言:javascript
复制
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 .
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-03-11 20:04:54

因为并不是所有的资源都支持标签,它们需要一种方法来区分哪些资源可以被标签。

因为有单独的资源组标记API

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

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

TagSpecification

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66582028

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档