aws-samples / amazon-cloudwatch-auto-alarms

Automatically create and configure Amazon CloudWatch alarms for EC2 instances, RDS, and AWS Lambda using tags for standard and custom CloudWatch Metrics.
MIT No Attribution
86 stars 84 forks source link

Only the last default RDS alarm is created #48

Open connorhsm opened 1 year ago

connorhsm commented 1 year ago

It appears there's a small indentation error that mistakenly left some items outside the for loop, causing only the last alarm configured in the RDS default alarms to be created. https://github.com/aws-samples/amazon-cloudwatch-auto-alarms/blob/118789b31d24a6943c7f6892327503840f351004/src/actions.py#L135-L157

If you compare to the earlier Lambda implementation: https://github.com/aws-samples/amazon-cloudwatch-auto-alarms/blob/118789b31d24a6943c7f6892327503840f351004/src/actions.py#L181-L213

Greatly appreciate this sample, thanks for your work here!

jbuiles1 commented 11 months ago

Can confirm this is an issue and also indenting it properly is the solution. As the code is, when adding RDS alarms to the default set, only the last alarm gets created since the create alarm function is outside the for loop so it does not properly iterate through all alarms in the default alarm dictionary