Senior DevOps Engineer
Rohit is passionate about designing and implementing scalable, secure, and efficient DevOps solutions including automation pipelines, cloud architectures, and infrastructure as code.
When working with AWS, we may want to track AWS EC2 instance launches. By default, both manual launches and Auto Scaling Group (ASG) launches generate the same RunInstances API event in CloudTrail.
But in real-world use cases, we often want alerts only for manually created (standalone) AWS EC2 instances, not for instances spawned automatically by ASGs.
We can achieve this using CloudTrail + EventBridge + SNS.
Whenever an AWS EC2 instance is launched, CloudTrail records a RunInstances event.
When the instance is created by ASG, then we have the below userAgent value.

This difference in userAgent lets us filter out ASG events.
Go to Amazon SNS → Topics → Create topic
a) Type: Standard
b) Name: EC2CreationAlerts


Click on Custom Pattern(Json Editor) and paste the pattern below.







Note: If you prefer a custom message format over raw event JSON via email, you can create a Lambda function and attach it to EventBridge according to your requirements. Please ensure that AWS Lambda has the required permissions to send logs to Amazon CloudWatch and publish messages to an SNS topic.
With this setup, we get real-time visibility into EC2 instances that are created manually, while avoiding noise from Auto Scaling events. This not only helps us enforce governance and security policies, but also ensures we can act quickly to prevent unnecessary costs from forgotten or unauthorized resources.
By combining CloudTrail, EventBridge, and Amazon SNS (or AWS Lambda for custom messages), we build a lightweight yet powerful guardrail that keeps your AWS environment clean, secure, and cost-efficient.
Speak with our advisors to learn how you can take control of your Cloud Cost
I remember once, our team found a whole bunch of test servers someone spun up months ago and completely forgot about. The cost savings were significant when we finally killed them off. It felt like discovering money on the ground, but on the steep Slope of resource optimization. https://slopegame-online.com
Managing AWS EC2 instances is crucial. I'm curious about the alert mechanisms. Are we talking about something that can catch manually spun-up instances before they become a whole "Cookie Clicker" chain reaction of uncontrolled resource usage? It's easy for standalone instances to slip through the cracks, so a real-time alerting system would definitely improve governance and prevent potential cost overruns. https://cookieclickers.io/
The explanation of filtering ASG events through the userAgent in CloudTrail is clear and practical. It’s a great tip for AWS monitoring and automation enthusiasts. For more tech insights and tools, check out https://www.bat-smash.com/ —your ultimate tech companion!
Managing AWS EC2 instances can feel like navigating Granny's house - full of unexpected surprises! Implementing real-time alerts for manually created, standalone instances is crucial for governance. Without it, you're wandering in the dark. Proactive monitoring prevents configuration drift and cost overruns, ensuring your EC2 environment remains secure and compliant. Think of these alerts as your escape plan - get out before Granny catches you! https://grannyfree.io/