October 15, 2024

How to Delete AWS Snapshot?

To delete an AWS EBS snapshot, you can do this through the AWS Management Console, AWS CLI, or AWS SDK. Below is a step-by-step guide for deleting a snapshot using the AWS Management Console as well as the AWS CLI.

Deleting an AWS Snapshot Using the AWS Management Console

Step 1: Sign in to the AWS Management Console

  • Open the AWS Management Console at AWS Console.
  • Sign in using your credentials.

Step 2: Navigate to the EC2 Dashboard

  • In the search bar, type “EC2” and select “EC2” from the dropdown list.
  • This will take you to the EC2 Dashboard.

Step 3: Go to the Snapshots Section

  • In the left-hand navigation pane under “Elastic Block Store,” click on “Snapshots.”
  • This will display a list of all the snapshots associated with your account.

Step 4: Select the Snapshot to Delete

  • Find the snapshot that you want to delete from the list. You can use the search box to filter by Snapshot ID or description.
  • Once you have located the snapshot, select the checkbox next to its name.

Step 5: Delete the Snapshot

  • With the snapshot selected, click the “Actions” button at the top of the page.
  • In the dropdown menu, select “Delete Snapshot.”

Step 6: Confirm the Deletion

  • A confirmation pop-up will appear. Review the information and confirm the deletion by clicking “Delete.”

Once the snapshot is deleted, it will no longer appear in the list, and AWS will stop charging you for storage associated with the snapshot.


Deleting an AWS Snapshot Using the AWS CLI

If you prefer to use the AWS Command Line Interface (CLI), follow these steps:

Step 1: Configure AWS CLI (If Not Already Configured)

  • Make sure the AWS CLI is installed and configured with your credentials. You can configure it using the command:
    bash
    aws configure
  • You’ll be prompted to enter your AWS Access Key ID, Secret Access Key, region, and output format.

Step 2: Delete the Snapshot

  • Use the delete-snapshot command to delete the snapshot. You’ll need the Snapshot ID, which can be found in the AWS Management Console or retrieved via the CLI.The command is as follows:
    bash
    aws ec2 delete-snapshot --snapshot-id
  • Replace <snapshot-id> with the actual Snapshot ID you want to delete.

Example:

bash
aws ec2 delete-snapshot --snapshot-id snap-0123456789abcdef0

Step 3: Verify the Deletion

  • You can verify that the snapshot has been deleted by listing your snapshots:

aws ec2 describe-snapshots --owner-ids self

Important Considerations

  1. Snapshot in Use:
    • You cannot delete a snapshot if it is currently being used by an EBS volume. You need to first detach or delete the volume using the snapshot (if necessary).
  2. Cost Savings:
    • Deleting a snapshot will stop AWS from charging you for the storage associated with the snapshot, but it will not affect any volumes that were created from that snapshot.
  3. Dependent Snapshots:
    • EBS snapshots are incremental. Deleting a snapshot does not affect the other snapshots in the chain. AWS automatically manages the dependencies between snapshots to ensure that data remains intact.
  4. IAM Permissions:
    • Ensure that the IAM user or role you are using has the necessary permissions to delete snapshots. The relevant permission is ec2:DeleteSnapshot.

Leave a Reply

Your email address will not be published. Required fields are marked *