aws-solutions / instance-scheduler-on-aws

A cross-account and cross-region solution that allows customers to automatically start and stop EC2 and RDS Instances
https://aws.amazon.com/solutions/implementations/instance-scheduler-on-aws/
Apache License 2.0
553 stars 273 forks source link

CloudWatch alarm enable and disabl #498

Closed easante817 closed 8 months ago

easante817 commented 11 months ago

Is there a way to disable cloud watch alarms when instance schedular starts and enable alarm when instance turns back on ????

CrypticCabub commented 11 months ago

hi @easante817

do you have any more detail you can provide on the type of alarms you are wanting to suppress and how you would expect instance scheduler to discover these alarms?

easante817 commented 11 months ago

hi @easante817

do you have any more detail you can provide on the type of alarms you are wanting to suppress and how you would expect instance scheduler to discover these alarms?

These are cloud watch alarms that fire off when the scheduler turns off the instances.

CrypticCabub commented 11 months ago

But how would Instance Scheduler discover them? CloudWatch Alarms are configured on your account independently from the instance and tags that Instance Scheduler is tasked with managing.

Are there specific default alarms that come up during normal operation that Instance Scheduler should be aware of, or are these alarms that have been manually configured on your account? (in which case it may be better to alter the alarm's settings to not identify regularly scheduled stop as an alarm)

easante817 commented 11 months ago

Alarms are in a different environment from the instance scheduler

CrypticCabub commented 11 months ago

So then how would Instance Scheduler be able to identify which alarms to disable? If they are configured separately then the alarms are outside the scope of the solution.

tfentonz commented 10 months ago

This re:Post question has a couple of suggestions.

Is there a way to restrict CloudWatch alarms to only trigger during specified time periods?

CrypticCabub commented 10 months ago

Thanks for the link!

The problem for Instance Scheduler isn't how to disable an alarm, but rather how to determine which alarms should be disabled.

It is my personal understanding that if you have an EC2 instance that you register with Instance Scheduler for scheduling and also configure an alarm for the uptime of that instance, that it is a misconfiguration outside the scope of the solution when that independently configured alarm triggers due to a scheduled stop action.

When examining this and similar requests, I have not yet been able to find a use-case where instance scheduler would be scheduling an instance that has a cloudwatch alarm attached to it for which the disabling of the alarm by instance scheduler could not be considered a band-aid solution for a misconfigured cloudwatch alarms further up stream. (and that disabling alarms upstream would not also introduce the possibility of disabling an alarm that should not be disabled)

easante817 commented 9 months ago

Thanks for the link!

The problem for Instance Scheduler isn't how to disable an alarm, but rather how to determine which alarms should be disabled.

It is my personal understanding that if you have an EC2 instance that you register with Instance Scheduler for scheduling and also configure an alarm for the uptime of that instance, that it is a misconfiguration outside the scope of the solution when that independently configured alarm triggers due to a scheduled stop action.

When examining this and similar requests, I have not yet been able to find a use-case where instance scheduler would be scheduling an instance that has a cloudwatch alarm attached to it for which the disabling of the alarm by instance scheduler could not be considered a band-aid solution for a misconfigured cloudwatch alarms further up stream. (and that disabling alarms upstream would not also introduce the possibility of disabling an alarm that should not be disabled)

So true I am just now wondering if I should use the cross account template

CrypticCabub commented 9 months ago

the Instance Scheduler remote template deploys an IAM role in an account that the main hub account can use to access your EC2 and RDS resources for the purpose of scheduling. Other than that, the only other thing it does is send a registration message back to the hub account when the AWS Organizations remote account auto registration feature is enabled.

The remote stack is required to be installed on any additional accounts that Instance Scheduler will be scheduling, but it is useless if you install it on the same account as the hub stack (the hub stack already deploys all necessary IAM roles for itself)

easante817 commented 9 months ago

Was going to put the main stack in the environment where the alarms are located and the remote template in the environment with the servers. Do you think that would work???

CrypticCabub commented 9 months ago

I'm not sure I follow what you are asking? Instance Scheduler does not attempt to disable any CloudWatch alarms.

CrypticCabub commented 8 months ago

closing due to inactivity