What is the correct syntax for mapping a snapshot onto an AMI using awscli? More explicitly, how do I map the old syntax 'ec2-register -s snap-9abc1234 --kernel 99abcdef' onto the new syntax 'aws ec2 --register-image' ?

有帮助吗?

解决方案

It's the following:

aws ec2 register-image --kernel-id <your-kernel> --root-device-name /dev/sda1 --block-device-mappings [list in JSON shown below]

      [
        {
          "VirtualName": "string",
          "DeviceName": "string",
          "Ebs": {
            "SnapshotId": "string",
            "VolumeSize": integer,
            "DeleteOnTermination": true|false,
            "VolumeType": "standard"|"io1",
            "Iops": integer
          },
          "NoDevice": "string"
        }
        ...
      ]

You can run aws ec2 register-image help for help on the command.

Make sure you are using the awscli python package on not the aws package as that one is different (not the official one)

Here's a link to the github repo:

https://github.com/aws/aws-cli

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top