Skip to content

Be notified of EC2 instance events ๐Ÿš€ from any region ๐Ÿ—บ๏ธ via a Cloudtrail CloudWatch Logs subscription filter !Rules

License

Notifications You must be signed in to change notification settings

kaihendry/sam-cloudtrail-ec2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

23 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Prerequisites

Setup Cloudtrail to log to CloudTrail/DefaultLogGroup.

Setup an SNS Topic with subscribers who would like to be informed when an EC2 is launched in any AWS region.

SAM CLI and sam deploy -g.

How do I know if I have deployed this?

Cloudwatch subscription

There should be a subscription active upon CloudTrail/DefaultLogGroup.

Btw it takes ~15 minutes for Cloudtrail to capture and log the event in CloudWatch in my experience.

Why not use Cloudwatch events?

https://aws.amazon.com/premiumsupport/knowledge-center/ec2-email-instance-state-change/ is a good tip, but what they don't tell you, is that you need to deploy in EVERY REGION for it to work.

Maintenance consideration

Cloudtrail bucket isn't used by this function, so consider putting an expiration on the objects.

Similarly CloudTrail/DefaultLogGroup can get large, put a retention policy on it.

About

Be notified of EC2 instance events ๐Ÿš€ from any region ๐Ÿ—บ๏ธ via a Cloudtrail CloudWatch Logs subscription filter !Rules

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published