How it works...
In this recipe, we selected Event Pattern and set the Service Name to EC2 and Event Type to EC2 Instance State-change Notification to match EC2 events whose state gets changed. Instead of an event pattern, we can select Schedule to invoke our targets on a schedule, just like we can with cron jobs.
We configured to notify any state change. We can also select a specific state, such as pending, running, shutting-down, stopped, stopping, or terminated. We also configured to apply this rule to all the instances within our account. Instead of doing this, we can select a specific EC2 instance. We selected our SNS topic as the target. When we configure a target, CloudWatch Events will provide necessary permissions for targets so that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access