In this AWS hands-on lab, we will be creating a CloudWatch Events rule for the purpose of automating the creation of EBS snapshots (and notifying system admins).
Creating and storing EBS snapshots are essentials for any backup/disaster recovery plan. Automating the creation process allows for reliable backup planning. And by utilizing SNS in this process, we can inform an administrator when each snapshot creation job has begun.
Successfully complete this lab by achieving the following learning objectives:
- Create One (1) SNS Topic with One (1) SNS Subscription
We will create a new SNS topic and SNS email subscription that we will use with our CloudWatch Events rule.
- Navigate to the SNS section of the AWS console.
- Click Create Topic.
- Click Create Subscription.
- Configure an email subscription sending a message to your personal email.
- Create One (1) CloudWatch Events Rule
Create the CloudWatch Events rule that will once-daily snapshot the specified EBS volume and initiates an email via SNS.
- Navigate to EC2 > Elastic Block Store > Volumes, and copy a volume-id to your clipboard.
- Navigate to CloudWatch > Events > Rules.
- Click Create rule at the top of the console.
- Select Schedule, and set it to 1, days for once per day.
- Add a target of EC2 CreateSnapshot API call, and paste in the volume-id from the clipboard.
- Select Create a new role for this specific resource with the predefined name.
- Add a target of SNS topic, and select our newly created SNS topic.
- Click Configure details.
- Configure the rule with a name, and save the rule.
- Verify That One (1) EBS Snapshot Has Been Created
Confirm that your new CloudWatch Events rule is working as expected by checking that a new EBS snapshot was created.
- Confirm in your email for the message from SNS.
- Check in EC2 > Elastic Block Store > Snapshots that a new snapshot has been created.