我尝试使用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}]'
有人可以帮助我超越这一点吗?
答案 0 :(得分:2)
--tag-specifications
是March 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\"}}]"