Can an AWS AMI name be set during import
I am trying to import an OVA into AWS using the aws CLI. To do this I run the following command:
aws ec2 import-image import-image --client-token 653151442415980 --disk-containers '[{"UserBucket":{"S3Key":"my.ova","S3Bucket":"my bucket"},"Description":"my import"}]' --platform 'Linux'
When I do this, I get an AMI name like "ami-import-sfwerwf". I really need this to be more descriptive in the name, so this doesn't work well for me.
Ideally, I could specify the name on import, but changing it after the import is complete would work too. I would really like to avoid having to create an instance and then save it as an AMI afterwards.
Solution 1:
The only way that I can find to do this is to do an image-copy
after the import. The image-copy
command takes name and description parameters, which will then be given to the copy.
aws ec2 copy-image --source-image-id ami-123de3 --source-region us-east-1 --region us-east-1 --name <new-name> --description <description>
After that completes successfully, then you can remove the original with:
aws ec2 deregister-image --image-id ami-123de3