Bootstrap FreeKB - Amazon Web Services (AWS) - Create an Elastic Block Storage (EBS) Volume Snapshot using Lifecycle Manager
Amazon Web Services (AWS) - Create an Elastic Block Storage (EBS) Volume Snapshot using Lifecycle Manager


Lifecycle Manager can be used to:

  • Create an Elastic Block Storage (EBS) Volume Snapshot (this article)
  • Create an Policy to create, retain or delete Elastic Block Storage (EBS) Amazon Machine Images (AMIs)

Before creating a Lifecycle Manager Policy to create Elastic Block Storage (EBS) Volume Snapshots, the volumes you want to include in the policy will need to have a tag that will be matched by the policy.

The aws ec2 create-tags command can be used to tag your Elastic Block Storage (EBS) Volumes.

aws ec2 create-tags --resource vol-abcefg123456789ab --tags Key=environment,Value=staging

 

The aws ec2 describe-volumes command can be used to list the tags associated with the volume.

]$ aws ec2 describe-volumes --query 'Volumes[?VolumeId==`vol-abcefg123456789ab`]'
[
    {
        "Attachments": [
            {
                "AttachTime": "2023-07-28T19:58:37+00:00",
                "Device": "/dev/xvda",
                "InstanceId": "i-0a3ea97aa2383de58",
                "State": "attached",
                "VolumeId": "vol-0d989fe3bad4dd2f9",
                "DeleteOnTermination": true
            }
        ],
        "AvailabilityZone": "us-east-1b",
        "CreateTime": "2023-07-28T19:58:37.544000+00:00",
        "Encrypted": false,
        "Size": 8,
        "SnapshotId": "snap-096dd96dde7d24189",
        "State": "in-use",
        "VolumeId": "vol-abcefg123456789ab",
        "Iops": 3000,
        "Tags": [
            {
                "Key": "environment",
                "Value": "staging"
            }
        ],
        "VolumeType": "gp3",
        "MultiAttachEnabled": false,
        "Throughput": 125
    }
]

 

In the EC2 console, select Elastic Block Store > LifeCycle Manager and then I would go with Custom policy and EBS snapshot policy.

 

Then select Volume and use tags so that the LifeCycle Manager Policy is only applied to the Volumes matching the tag(s).

 

Then create the schedule for how often the LifeCycle Manager Policy will be invoked, at what time it will be invoked, and when to expire older volume snapshots from the S3 Standard Tier.

 

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 079372 in the box below so that we can be sure you are a human.