Learn how to create AMI from Snapshot with AWS CLI. Our AWS Support team is here to help you with your questions and concerns.
AWS CLI Create AMI from Snapshot | Guide
If you are looking for a guide to create an Amazon Machine Image from a snapshot with the AWS CLI, you have come to the right place.
- To begin with, we need an EBS (Elastic Block Store) snapshot. If we do not have one, we can create one via AWS CLI or the AWS Management Console.
- Now, it is time to identify the ID of the EBS snapshot we want to use to create the AMI. We can get this by listing our snapshots as seen here:
aws ec2 describe-snapshots --snapshot-ids OUR_SNAPSHOT_ID
- Then, we have to create an AMI from the snapshot with the aws ec2 register-image command as seen below:
aws ec2 register-image \
--name "AMI Name" \
--description “AMI Description" \
--block-device-mappings "[{\"DeviceName\":\"/dev/sda1\",\"Ebs\":{\"SnapshotId\":\"OUR_SNAPSHOT_ID\"}}]"
Here, we have to replace “AMI Name” and “AMI Description” with our AMI name and description.
Furthermore, we have to make sure the –block-device-mappings parameter includes the correct device name and references the snapshot ID. - At this point, the register-image command will return the ID of the newly created AMI. We have to note down this ID.
- Then, use the describe-images command to monitor the status of the AMI creation:
aws ec2 describe-images --image-ids OUR_AMI_ID
We have to wait for the status to change to “available,” to make sure the AMI creation process is complete.
After the new AMI is available, we can use it to launch EC2 instances with the same configuration as the original snapshot. This can be done via the AWS Management Console, CLI, or SDKs.
Here is a summary of the AWS CLI commands involved:
- aws ec2 describe-snapshots: List and retrieve information about snapshots.
- aws ec2 register-image: Create an AMI from a snapshot.
- aws ec2 describe-images: Check the status of the AMI creation.
Our experts would like to point out that we need the correct IAM permissions to perform these actions.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
In brief, our Support Experts demonstrated how to create AMI from Snapshot with AWS CLI.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments