【问题标题】:How does one use the tags option when creating resources with the aws cli?使用 aws cli 创建资源时如何使用标签选项?
【发布时间】:2021-01-23 00:06:10
【问题描述】:

尝试使用 aws cli 创建标记项目。

aws ec2 create-security-group --group-name $group_name --description $my_description

我无法解析documentation

--tag-specifications (list)

我试过了

--tag-specifications KEY=Name,Value=$something

and --tags Key=Name,Value=$something
and --tags [Key=Name,Value=$something]
and --tags {[Key=Name,Value=$something]}

【问题讨论】:

    标签: amazon-web-services tags aws-cli


    【解决方案1】:

    我们需要传递两个属性

    • ResourceType:在本例中为security-group

    • 标签:键值对象数组

      aws ec2 create-security-group --group-name 'test' --description 'test desc' --tag-specifications 'ResourceType=security-group,Tags=[{Key=purpose,Value=production},{Key=cost-center,Value=cc123}]'
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-03
      • 2019-05-19
      • 2019-12-24
      相关资源
      最近更新 更多