Question

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' ?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top