简体   繁体   English

EC2运行实例错误:list的param元素的无效值(“ Encrypted”):类型为list的BlockDeviceMappings

[英]EC2 run-instances error: Invalid value ('Encrypted') for param element of list:BlockDeviceMappings of type list

According to the AWS CLI documentation, I can specify that a volume should be encrypted and provide the KMS Key Id accordingly. 根据AWS CLI文档,我可以指定应加密卷,并相应地提供KMS密钥ID。 I can't make it work though... what am I doing wrong here? 但是我无法使其工作...我在这里做错了什么?

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" 

Pretty-printed JSON for block-device-mappings below for ease of reference: 为了方便参考,以下用于块设备映射的漂亮印刷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"
    }
  }
]

When I run the above command, I get the error you see in the subject line. 当我运行上面的命令时,出现在主题行中看到的错误。 If I swap the order of the Encrypted and KmsKeyId values around, it complains about KmsKeyId instead. 如果我交换Encrypted和KmsKeyId值的顺序,它将抱怨KmsKeyId。

FWIW, I installed AWS CLI via apt on Ubuntu 14.04. FWIW,我通过apt在Ubuntu 14.04上安装了AWS CLI。

john@dev3:/home/john$ aws --version
aws-cli/1.2.9 Python/3.4.3 Linux/3.13.0-161-generic

It looks like the most recent release of awscli is 1.16.x so I would update the awscli and re-test. 看来awscli的最新版本是1.16.x,所以我将更新awscli并重新测试。 It's possible that this was fixed (or was unsupported in version 1.2.x, which you are running). 这可能是固定的(或者您正在运行的1.2.x版本不支持此功能)。

More generally, I don't think you can safely use apt-get to install the latest awscli on Ubuntu. 更一般而言,我认为您不能安全地使用apt-get在Ubuntu上安装最新的awscli。 I would uninstall it and follow awscli instructions for Linux to use pip or the bundled installer. 我将卸载它,并按照awscli的说明在Linux上使用pip或捆绑的安装程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM