Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kaihendry/sam-cloudtrail-ec2

Be notified of EC2 instance events πŸš€ from any region πŸ—ΊοΈ via a Cloudtrail CloudWatch Logs subscription filter !Rules
https://github.com/kaihendry/sam-cloudtrail-ec2

aws-billing aws-cloudtrail aws-ec2 aws-sam aws-sns serverless serverless-application-model

Last synced: 3 months ago
JSON representation

Be notified of EC2 instance events πŸš€ from any region πŸ—ΊοΈ via a Cloudtrail CloudWatch Logs subscription filter !Rules

Awesome Lists containing this project

README

        

# 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](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) 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](https://ap-southeast-1.console.aws.amazon.com/cloudwatch/home?region=ap-southeast-1#logEventViewer:group=CloudTrail/DefaultLogGroup;filter=%257B%2520%2524.eventName%2520%253D%2520%2522RunInstances%2522%2520%257D) in my experience.

# Why not use Cloudwatch events?

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.