Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to create an AMI of an instance using aws cli command?

How can i create an AMI of the instance using the cli command ? . I ahve referred the official documentation – https://docs.aws.amazon.com/cli/latest/reference/ec2/create-image.html . I also have need to create a snapshot of the attached volume

This is the command i am trying ,

aws ec2 create-image --instance-id "instance-id" --name "my-image-nov-9"

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

But I need additional parameters to include the tag for the created image

>Solution :

Use this CLI command to create the AMI of an instance

aws ec2 create-image --instance-id instance-id --name my-image-nov-9 --no-reboot --tag-specifications "ResourceType=image,Tags=[{Key=project,Value=test-project,Key=team,Value=development}]"   

–no-reboot | –reboot (boolean)

Indicates whether or not the instance should be automatically rebooted
before creating the image. Specify one of the following values:

Default: false

true – The instance is not rebooted before creating the image.

–tag-specifications (list)

The tags to apply to the AMI and snapshots on creation. You can tag
the AMI, the snapshots, or both.

To tag the AMI, the value for ResourceType must be image . To tag the
snapshots that are created of the root volume and of other Amazon EBS
volumes that are attached to the instance, the value for ResourceType
must be snapshot . The same tag is applied to all of the snapshots
that are created.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading