change AWS AMI Name

Viewed 8408

is it possible to use the aws cli to change an AMI name?

I can successfully add a "Name" tag (using aws ec2 create-tags) but not change the "AMI Name" that shows on the web UI. This is an imported AMI so the AMI Name is something like
import-ami-XXXXX.

I've tried:

aws ec2 modify-image-attribute --image-id AMI_ID --attribute Name --value VALUE

but I'm getting back a:

An error occurred (InvalidParameterCombination) when calling the ModifyImageAttribute operation: No attributes specified.

any suggestion?

2 Answers

It is not possible to change the name of an AMI image. Once the name is set, it cannot be changed.

You have 2 possible resolutions:

  1. Create the AMI image again, using a different name. However, in your case, the name may be automatically generated and this may not be an option.
  2. Copy the AMI within the same region, giving the copy a more desirable name.

I see two name like fields in the EC2 console for AMIs. One called "Name" and another one called "AMI Name". The latter is immutable, as the previous answer suggests.

BUT, I was able to set the "Name" field by using create-tags as shown below:

aws ec2 create-tags --resources AMI_ID --tags Key=Name,Value=bbb
Related