How to create EBS snapshot of an EC2 instance in AWS

Creating Amazon EBS snapshots is an essential process for backing up data stored on Amazon Elastic Block Store (EBS) volumes attached to your EC2 instances. These snapshots provide point-in-time backups, enabling you to restore data efficiently while minimizing storage costs. In previous article, we learned how to create your first EC2 instance in AWS platform. In this guide, we’ll explore how to create snapshots of an EC2 instance, the prerequisites required, and step-by-step instructions for implementation.



What is Amazon EBS?

Amazon Elastic Block Store (EBS) is a scalable, high-performance block storage service designed for use with Amazon EC2 instances. EBS volumes act like local hard drives, allowing you to store files, install applications, and manage data. These volumes can be attached to EC2 instances during or after their creation, and multiple volumes can be attached to a single instance.

Key Features of Amazon EBS:

  • Volume Types: Amazon EBS offers multiple volume types tailored for various workloads:
    • General Purpose SSD (gp2, gp3)
    • Provisioned IOPS SSD (io1, io2)
    • Throughput Optimized HDD (st1)
    • Cold HDD (sc1)
    • Magnetic (standard)
  • Multi-Attach: Certain volume types support attachment to multiple EC2 instances within the same Availability Zone.
  • Snapshots: EBS snapshots are incremental backups, saving only changed blocks to reduce storage costs and creation time.

For more details, refer to the Amazon EBS volume types documentation.


Why Use Amazon EBS Snapshots?

Amazon EBS snapshots allow you to back up your data by creating point-in-time copies of your EBS volumes. These snapshots are stored in Amazon S3, providing durability and scalability. Key benefits include:

  • Incremental Backups: Only changed blocks since the last snapshot are saved.
  • Cost Efficiency: Avoid duplication of unchanged data, reducing storage costs.
  • Disaster Recovery: Restore data quickly in case of failures or accidental deletions.

Prerequisites

Before creating an EBS snapshot, ensure you have the following:

  1. An Amazon EBS-backed EC2 instance: The volume must be attached to an EC2 instance.
  2. Access to AWS Management Console: You’ll need access to the EC2 dashboard to perform the snapshot creation.

Step-by-Step Guide: How to Create Amazon EBS Snapshots

Follow the instructions below to create an EBS snapshot:

create snapshot
  • For Resource type, choose Volume or Instance.
  • For Volume ID, select the volume you want to create the snapshot from. The Encryption field indicates the selected volume’s encryption status. If the volume is encrypted, the snapshot is automatically encrypted by using the same KMS key. If the volume is unencrypted, the snapshot isn’t encrypted either.
  • (Optional) For Description, enter a brief description for the snapshot.
  • (Optional) To assign custom tags to the snapshot, in the Tags section, choose Add tag, and then enter the key-value pair. You can add up to 50 tags.
  • Choose Create snapshot.
create snapshot from Volume or instance

Once you click snapshot, it will take a few minutes to create the snapshot, you can view the snapshot.

Snapshot status

For more information, see Create Amazon EBS snapshots in the Amazon EBS documentation.


Example Code: Creating an EBS Snapshot Using AWS CLI

For users who prefer automation, the AWS CLI provides a straightforward way to create snapshots:

aws ec2 create-snapshot \
    --volume-id vol-0abcd1234efgh5678 \
    --description "Database backup - May 2025" \
    --tag-specifications ResourceType=snapshot,Tags=[{Key=Environment,Value=Production}]

This command specifies the volume ID, description, and tags for the snapshot.

Leave a Comment