1

Is there a way to name an EBS snapshot created with a Cloudwatch Rule?

For instance, I have a cron-like rule:

31 10 ? * 3,6 * vol-0e743fcfd2f53198a

Which will create a snapshot of the data volume, every Tue and Fri on 10:31 UTC.

However, the snapshots are created with their Name field empty, which makes it difficult to know which snapshot belongs to which EC2 instance.

1

There are several ways you can accomplish this. I'd recommend using Lambda to accomplish your goal.

I use it to create a snapshot of my root volumes, utilizing CloudWatch events to trigger them. Here is a snippet of the python code:

snap = ec2.create_snapshot(VolumeId=volume['Ebs']['VolumeId'], Description=name_tag+today)
ec2.create_tags(Resources=[snap['SnapshotId']], 
Tags=[
    {
        'Key'   : 'Name',
        'Value' : name_tag
    },
    {
        'Key'   : 'Copied',
        'Value' : 'False'
    },
    {
        'Key'   : 'Customer',
        'Value' : customer
    }
])

ss1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.