Working with CloudWatch Events
- In this lab, we will work with CloudWatch Event, we will use cloudwatch event to create snapshot of EC2 instance root EBS volume whenever there’s instance state change ie power-off, stopping or shutting down
- Go to cloudwatch > Events > Rules > Create Rule
- Select Service Name as EC2
Event Type as EC2 Instance State-change Notification
Specific State radio button & select state: shutting-down, Stopped & stopping
Specific instance Id radio button & input the instance id of instance we created for cloudwatch lab seriesNow under Target
Select EC2 Create Snapshot API call
Input Volume ID of Cloudwatch EC2 instance
- Input the Name of this event
- Now stop the EC2 instance, this should initiate snapshot process
- Snapshot 😀
- Delete the EC2 instance