I am very new to AWS and I want to make it so that I can set an alarm on any new EC2 instances that ANYONE makes in the organization. I could do this manually by setting an alarm the moment the EC2 instance is made or maybe during the setup process BUT I don’t want the end user to have to set the alarm.
I want them to setup there instance like normal, but after its created, an alarm is automatically applied because a rule or policy on the user or group that forces an alarm on the EC2 instance.
Does this make sense?
Like I want to have an alarm on a VM based on the user who created the VM. Is that possible?
Look into tools that are made for this.
Terraform can do this when you deploy and cloud custodian can do things after deploy (or created in the console)
There are a number of ways to do this but the best way for anything like this in general is to be using infrastructure as code and your users aren’t clicking anything in to existence but rather using modules you’ve set up to create the resources. Terraform is the most popular way to do this. Cloud formation resources could work too, but less popular for a reason. There are 15 other ways you can do what you want but in any respectable organization infrastructure as code is the base layer to start at. Config, tower, any of these things are just cleaning up mistakes that shouldn’t have happened to begin with by fixing your modules to have the right settings by default. You have bigger problems than an alarm not being automatic it sounds like. There are a dozen or two other policies you need to be enforcing too probably.
This doesn’t work. The creation of an EC2 instance and tagging are done with two separate API calls. If you enforce tagging for an EC2 instance to be created, no one will ever be able to create an instance - either manually or via IAC.