Lets say you started a new linux instance, installed some additional programs on it, specific for your use case, spending a lot of time trying to figure things out. Now, if you are not going to be using this instance for a few months, what do you do…
Even if you stop the machine, you dont want to keep the root volume sitting there adding to your billing. Instead, one of the easiest things to do is to create your own machine image out of this instance that you have customized. Storing this custom image would only cost you a fraction compared to keeping the EBS volume.
Next time when you want to run your program, you could simply create a new instance from your custom image.
1. Create a custom Amazon Machine Image (AMI)
Click the “Instances” option from the EC2 console left hand menu.
Click and choose the instance that you would like to create an image out of.
Click the “Actions” menu and then chose “Image” - “Create Image” option.
In the Create Image window, type a name for your custom image (Image Name), a description and then click “Create Image” button. “Close” any following confirmation window.
2. Listing your AMIs
To view the list of your custom AMIs, Click the “AMIs” option in the EC2 console left hand menu bar, under the Images section. In the resulting AMI window, you will see the image that we just created (mylinuximage). You will also see that this image is marked as “Private” and is now “available” for you to use.
3. Creating a new instance using custom AMI
To create a new instance using any of your custom AMIs, simple select the specific AMI from your list of AMIs and click the “Launch” button, as shown in the above screenshot. Once the launch instance wizard starts, follow the same procedure, starting from #2.2.4 as described in the Creating a basic linux instance tutorial.
4. Creating a snapshot
A snapshot is just a backup/archive of your volume, at any given time point. If you are not planning on working on your additional data volume for several months, you could just create a snapshot out of it and delete the original volume.
Snapshots cost about half of the volume price. Lets say you want to use your data volume after two months, you could simply create a new volume of the previously created snapshot in the appropriate zone and use it with your instances.
To create snapshot, choose the volume that you want to archive and then, click “Actions”, Create Snapshot.
In the resulting “Create Snapshot” window, type a Description for your snapshot and click “Create Snapshot” button.
5. Listing your snapshots
To view the list of your snapshots, Click the “Snapshots” option in the EC2 console left hand menu bar, under the “ELASTIC BLOCK STORE” section. In the resulting snapshots window, you will see all of your snapshots and associated information.
6. Creating a new volume from a snapshot
To create a new volume from a specific snapshot, select the snapshot of your choice, as shown in the above screenshot and click “Actions”, “Create Volume” menu options as shown in the above screenshot.
In the resulting “Create Volume” window, choose the appropriate “Availability Zone” and click the “Create Volume” button, to create a new volume using an existing snapshot.