【问题标题】:aws cli run instances with name tag and EBS volumesaws cli 运行带有名称标签和 EBS 卷的实例
【发布时间】:2017-12-10 14:39:53
【问题描述】:

我正在尝试使用 cli 在命令行上将新的 EC2 实例启动到 AWS。我需要做的是应用名称标签并添加 EBS 卷。 EBS 卷也应该有名称标签。这是我目前所拥有的。

我收到一个使用错误:

λ aws ec2 run-instances --image-id ami-xxxxx --count 1 --instance-type r3.xlarge --key-name timd --security-group-ids sg-xxxxx --subnet-id subnet-xxxxx --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=ENC_TEST}]' 'ResourceType=volume,Tags=[{Key=Engagement,Value=8000xxxx}]' --block-device-mappings 'DeviceName=/dev/sdf,VirtualName=data,Ebs={Encrypted=yes,DeleteOnTermination=yes,VolumeSize=250,VolumeType=string}' --profile=govcloud-nonprod
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: --tag-specifications, 'ResourceType=volume,Tags=[{Key=Engagement,Value=800000xxxx}]', 'ResourceType=instance,Tags=[{Key=Name,Value=ENC_TEST}]'

有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: amazon-web-services aws-cli


    【解决方案1】:

    --tag-specificationsMarch 2017后端引入的功能

    确保更新您的 aws CLI 版本以反映此更改。

    同样--block-device-mapping不正确,定义为

            {
              "DeviceName": "string",
              "VirtualName": "string",
              "Ebs": {
                "Encrypted": true|false,
                "DeleteOnTermination": true|false,
                "Iops": integer,
                "SnapshotId": "string",
                "VolumeSize": integer,
                "VolumeType": "standard"|"io1"|"gp2"|"sc1"|"st1"
              },
              "NoDevice": "string"
            }
            ...
    

    所以你应该有

    --block-device-mappings "[{\"DeviceName\":\"/dev/sdf\",\"VirtualName\":\"data\",\"Ebs\":{\"Encrypted\"=true,\"DeleteOnTermination\"=true,\"VolumeSize\"=250,/"VolumeType\"=\"standard\"}}]"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-03
      • 1970-01-01
      • 2017-05-12
      • 1970-01-01
      相关资源
      最近更新 更多