{"id":13820304,"url":"https://github.com/kaihendry/sam-cloudtrail-ec2","last_synced_at":"2025-04-19T10:57:44.023Z","repository":{"id":142044364,"uuid":"265779159","full_name":"kaihendry/sam-cloudtrail-ec2","owner":"kaihendry","description":"Be notified of EC2 instance events 🚀 from any region 🗺️ via a Cloudtrail CloudWatch Logs subscription filter !Rules","archived":false,"fork":false,"pushed_at":"2020-06-01T06:06:05.000Z","size":19,"stargazers_count":9,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T22:13:44.981Z","etag":null,"topics":["aws-billing","aws-cloudtrail","aws-ec2","aws-sam","aws-sns","serverless","serverless-application-model"],"latest_commit_sha":null,"homepage":"https://youtu.be/uDbQ9zl7xoU","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaihendry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-21T07:05:20.000Z","updated_at":"2023-01-06T18:46:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"46e88dc0-2624-4bad-99cf-0d6f955e3ea0","html_url":"https://github.com/kaihendry/sam-cloudtrail-ec2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihendry%2Fsam-cloudtrail-ec2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihendry%2Fsam-cloudtrail-ec2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihendry%2Fsam-cloudtrail-ec2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaihendry%2Fsam-cloudtrail-ec2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaihendry","download_url":"https://codeload.github.com/kaihendry/sam-cloudtrail-ec2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246150452,"owners_count":20731419,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-billing","aws-cloudtrail","aws-ec2","aws-sam","aws-sns","serverless","serverless-application-model"],"created_at":"2024-08-04T08:01:01.175Z","updated_at":"2025-03-29T07:16:59.128Z","avatar_url":"https://github.com/kaihendry.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Prerequisites\n\nSetup Cloudtrail to log to **CloudTrail/DefaultLogGroup**.\n\n\u003cimg src=\"https://s.natalian.org/2020-05-27/cloudtrail-with-cloudwatchlogs.png\"\u003e\n\nSetup an SNS Topic with subscribers who would like to be informed when an EC2\nis launched in any AWS region.\n\n[SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) and `sam deploy -g`.\n\n# How do I know if I have deployed this?\n\n\u003cimg src=\"https://s.natalian.org/2020-05-21/cloudtrail-subscription.png\" alt=\"Cloudwatch subscription\"\u003e\n\nThere should be a subscription active upon **CloudTrail/DefaultLogGroup**.\n\nBtw 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.\n\n# Why not use Cloudwatch events?\n\n\u003chttps://aws.amazon.com/premiumsupport/knowledge-center/ec2-email-instance-state-change/\u003e\nis a good tip, but what they don't tell you, is that you need to deploy in\nEVERY REGION for it to work.\n\n# Maintenance consideration\n\nCloudtrail bucket isn't used by this function, so consider putting an\nexpiration on the objects.\n\nSimilarly **CloudTrail/DefaultLogGroup** can get large, put a retention policy\non it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaihendry%2Fsam-cloudtrail-ec2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaihendry%2Fsam-cloudtrail-ec2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaihendry%2Fsam-cloudtrail-ec2/lists"}