{"action":"closed","issue":{"url":"https://api.github.com/repos/aws-samples/copy-encrypted-ami/issues/5","repository_url":"https://api.github.com/repos/aws-samples/copy-encrypted-ami","labels_url":"https://api.github.com/repos/aws-samples/copy-encrypted-ami/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/aws-samples/copy-encrypted-ami/issues/5/comments","events_url":"https://api.github.com/repos/aws-samples/copy-encrypted-ami/issues/5/events","html_url":"https://github.com/aws-samples/copy-encrypted-ami/issues/5","id":378423458,"node_id":"MDU6SXNzdWUzNzg0MjM0NTg=","number":5,"title":"Error on trying to copy AMI with associated ephemeral devices","user":{"login":"man8","id":160968,"node_id":"MDQ6VXNlcjE2MDk2OA==","avatar_url":"https://avatars0.githubusercontent.com/u/160968?v=4","gravatar_id":"","url":"https://api.github.com/users/man8","html_url":"https://github.com/man8","followers_url":"https://api.github.com/users/man8/followers","following_url":"https://api.github.com/users/man8/following{/other_user}","gists_url":"https://api.github.com/users/man8/gists{/gist_id}","starred_url":"https://api.github.com/users/man8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/man8/subscriptions","organizations_url":"https://api.github.com/users/man8/orgs","repos_url":"https://api.github.com/users/man8/repos","events_url":"https://api.github.com/users/man8/events{/privacy}","received_events_url":"https://api.github.com/users/man8/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-11-07T18:55:23Z","updated_at":"2018-12-06T01:17:51Z","closed_at":"2018-12-06T01:17:51Z","author_association":"CONTRIBUTOR","body":"Hi, thank you for this handy tool.  On trying to copy an AMI, I ran into an error like this:\r\n\r\n    $ copy_encrypted_ami.sh -s src -d dst -a ami-04f386a8fa9b55blah \r\n    Source region: eu-west-1\r\n    Destination region: eu-west-1\r\n    Destination account ID: blah\r\n    Snapshots found: snap-012a6c6688943blah snap-06ae1c9807c77blah null null null null null null null null null null null null null null null null null null null null null null null null null null\r\n\r\n    An error occurred (InvalidParameterValue) when calling the DescribeSnapshots operation: Value (null) for parameter snapshotId is invalid. Expected: 'snap-...'.\r\n    Customer managed KMS key(s) used on source AMI:\r\n    usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]\r\n    To see help text, you can run:\r\n\r\n      aws help\r\n      aws <command> help\r\n      aws <command> <subcommand> help\r\n    aws: error: argument --key-id: expected one argument\r\n     copy_encrypted_ami.sh: error: Unable to retrieve the Key Manager information. Aborting. \r\n\r\nExploring the BlockDeviceMappings section of the AMI metadata, I see:\r\n\r\n    $ aws ec2 describe-images --profile src --region eu-west-1 --image-id ami-04f386a8fa9b55blah  --query 'Images[0]'|jq .BlockDeviceMappings\r\n     [\r\n       {\r\n         \"DeviceName\": \"/dev/sda1\",\r\n         \"Ebs\": {\r\n           \"Encrypted\": true,\r\n           \"DeleteOnTermination\": true,\r\n           \"VolumeType\": \"gp2\",\r\n           \"VolumeSize\": 100,\r\n           \"SnapshotId\": \"snap-012a6c6688943blah\"\r\n         }\r\n       },\r\n       {\r\n         \"DeviceName\": \"/dev/sdf\",\r\n         \"Ebs\": {\r\n           \"Encrypted\": true,\r\n           \"DeleteOnTermination\": true,\r\n           \"VolumeType\": \"gp2\",\r\n           \"VolumeSize\": 500,\r\n           \"SnapshotId\": \"snap-06ae1c9807c77blah\"\r\n         }\r\n       },\r\n       {\r\n         \"DeviceName\": \"xvdca\",\r\n         \"VirtualName\": \"ephemeral0\"\r\n       },\r\n       {\r\n         \"DeviceName\": \"xvdcb\",\r\n         \"VirtualName\": \"ephemeral1\"\r\n       },\r\n       {\r\n         \"DeviceName\": \"xvdcc\",\r\n         \"VirtualName\": \"ephemeral2\"\r\n       },\r\n       {\r\n         \"DeviceName\": \"xvdcd\",\r\n         \"VirtualName\": \"ephemeral3\"\r\n       },\r\n       {\r\n         \"DeviceName\": \"xvdce\",\r\n         \"VirtualName\": \"ephemeral4\"\r\n       },\r\n       {\r\n    [.....]\r\n\r\nIt seems that we would want to skip emphemeral devices when finding snapshots to copy. I'll submit a quick pull request with a proposed solution.\r\n"}}
{"actor":{"display_login":"rollucas"}}