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.

boardrider
  • 889
  • 2
  • 15
  • 26

1 Answers1

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

slm
  • 7,355
  • 16
  • 54
  • 72
kenlukas
  • 2,886
  • 2
  • 14
  • 25