Amazon web services EC2运行实例错误:list:BlockDeviceMappings of type list的param元素的值无效(';加密';)

Amazon web services EC2运行实例错误:list:BlockDeviceMappings of type list的param元素的值无效(';加密';),amazon-web-services,amazon-ec2,aws-cli,Amazon Web Services,Amazon Ec2,Aws Cli,根据AWS CLI文档,我可以指定卷应该加密,并相应地提供KMS密钥Id。但是我不能让它工作。。。我做错了什么 aws ec2 run-instances --block-device-mappings '[ {"DeviceName": "/dev/sda1", "Ebs": { "DeleteOnTermination": true, "VolumeSize": 10, "VolumeType": "gp2" }}, {"DeviceName": "/dev/sdb1", "Ebs": {

根据AWS CLI文档,我可以指定卷应该加密,并相应地提供KMS密钥Id。但是我不能让它工作。。。我做错了什么

aws ec2 run-instances --block-device-mappings '[ {"DeviceName": "/dev/sda1", "Ebs": { "DeleteOnTermination": true, "VolumeSize": 10, "VolumeType": "gp2" }}, {"DeviceName": "/dev/sdb1", "Ebs": { "DeleteOnTermination": false, "VolumeSize": 20, "VolumeType": "gp2", "Encrypted": true, "KmsKeyId": "f80d1a0e-9295-4ca7-8f27-2ce79fec9838" }} ]' --image-id $BASE_AMI --count 1 --instance-type $INSTANCE_TYPE --security-group-ids $SEC_GROUPS --subnet-id $SUBNET --key-name "$KEY_PAIR" 
下面是块设备映射的漂亮打印JSON,以便于参考:

[
  {
    "DeviceName": "/dev/sda1",
    "Ebs": {
      "DeleteOnTermination": true,
      "VolumeSize": 10,
      "VolumeType": "gp2"
    }
  },
  {
    "DeviceName": "/dev/sdb1",
    "Ebs": {
      "DeleteOnTermination": false,
      "VolumeSize": 20,
      "VolumeType": "gp2",
      "Encrypted": true,
      "KmsKeyId": "f80d1a0e-9295-4ca7-8f27-2ce79fec9838"
    }
  }
]
当我运行上面的命令时,我得到了您在主题行中看到的错误。如果我交换加密值和KmsKeyId值的顺序,它会抱怨KmsKeyId

FWIW,我在Ubuntu 14.04上通过apt安装了AWS CLI

john@dev3:/home/john$ aws --version
aws-cli/1.2.9 Python/3.4.3 Linux/3.13.0-161-generic
看起来是1.16.x,所以我会更新awscli并重新测试。这可能是已修复的(或者您正在运行的版本1.2.x不支持)


更一般地说,我认为你不能安全地使用apt get在Ubuntu上安装最新的awscli。我会卸载它,然后使用pip或捆绑安装程序。

awscli的当前版本是1.16.52。我认为您不能安全地使用apt get安装awscli。我会卸载它并按照awscli说明使用pip或捆绑安装程序。谢谢,我会这么做的。在我以前的搜索中,在文档中的任何位置都找不到当前版本信息。我认为您在文档中找不到该信息。也许最好依靠感谢@jarmod。按建议切换到最新版本解决了问题。将您的回复作为答案发布,以便我可以接受!