Search code examples
aws-java-sdk

How to specify AMI Name when creating image using ImportImage


Is it possible to specify AMI Name when creating image using ImportImage API? It is generated automatically like "import-ami-abcd1234". But I would like to give more reasonable name.

ImportImageRequest does not have "Name" parameter: http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/ec2/model/ImportImageRequest.html

While CreateImageRequest that creates AMI from an instance does have it.

CreateImageRequest createImageRequest = new CreateImageRequest();
createImageRequest.withInstanceId("i-xxxxxxxxxxxxxxxxx")
    .withName("myAMIName")
    .withDescription("this is my ami");

Or is it possible to modify the AMI Name after the ImportImage ?

Thanks in advance.


Solution

  • The AMI Name could not be changed. You can:

    1. You can do additional step to copy the image after it was imported. Using AWS Java SDK to set the name when you copy the image.
    2. Then delete the imported image