I want an alarm to operate only overnight between 18:00 and 08:00 so I can keep an EC2 instance running all the working day and stop overnight if no-one is using it. Is this possible?
Disable AWS Cloudwatch alarm during normal working hours
2.2k views Asked by N Burnett At
2
There are 2 answers
0
x89
On
You can automate this by creating an EventBridge rule where you specify a cron or schedule expression that runs a Python lambda function on specific timings.
Then, you can use your Lambda function to enable or disable an alarm(s) according to your required schedules.
disable_alarm = client.disable_alarm_actions(AlarmNames=alarm_names)
Here's a good tutorial: https://medium.com/geekculture/terraform-structure-for-enabling-disabling-alarms-in-batches-5c4f165a8db7
Related Questions in AMAZON-EC2
- Failed to connect to your instance after deploying mern app on aws ec2 instance when i try to access frontend
- Using Amazon managed Prometheus to get EC2 metrics data in Grafana
- Unable to ping remote websites from an ipV6 only ubuntu ec2 Instance
- Unable to install mysql on Amazon Linux 2023
- AWS Elastic Beanstalk - Deployment Issues with Flask backend (React frontend already deployed with S3 and Cloudfront)
- AWS ECS agent does not start in EC2 instance
- Moving a website from a subdomain to the domain root
- Switch to Cloudfront CDN causing issues for small number of users
- Selenium parser
- ReadTimeout error when downloading images on AWS EC2 but not locally
- Iam not able to login to bastion server-permission denied error
- No GPU EC2 instances associated with AWS Batch
- Django Deployment on AWS EC2 with Docker Compose: Seeking Advice on Security, Scalability, and Best Practices
- How to host a react and django application on ec2
- Connection services in different containers in the same ec2 instance
Related Questions in ALARM
- Getting Scheduled Alarms from Default Alarm Clock App (specifically Clock on Android)
- flutter_local_notifications is NOT working - zonedSchedule
- How can I make it so other people (and myself) can open the .py file and not have it crash when using mp3 files in the code?
- When we set the alarm, the alarm will run automatically with javascript. without pressing any buttons
- Alarm rules in device profile with Dynamic source type doesn't work?
- How do I create an alarm with nested alarms from 2 arrays
- Alarm BroadcastReceiver is never called
- How to schedule reminder for daily habits
- Unable to start service Intent u=0 not found: AlarmReceiver
- Creating an alarm application using Expo and React Native
- how to add a screen when the screen is off like the default alarm screen when the alarm ring with flutter, alarm screen is not its not coming
- Issue on Android 13 : Android — Repeat notification daily on specific time
- Notification sound never stop when connected to a bluetooth device - Android
- Infinite local notifications for alarm app
- how to kill winsound task after an if condition
Related Questions in AMAZON-CLOUDWATCH
- Setting up alarms for Cloudwatch Insight Queries
- Sending metrics data from on-premise Linux server to Cloudwatch
- Log retation setting for ECS
- How to configure CPU utilized metric for ECS in AWS for Alarm?
- How to get ECS task to communicate with cloudwatch agent?
- eb CLI won't download logs files from /var/log after setup amazon cloudwatch agent
- Step scaling option disabled for ECS Fargate service
- Log ruby on rails application running in phusion passenger to aws cloudwatch
- AWS CloudWatch parsing logs
- How can I set the log_stream_prefix to get the cloudwatch data from lambda
- Does Vercel has any features to moniter static asset response time?
- Custom metrics script on window instances in two different regions in two different account
- Can you parse then query on the parse value in CloudWatch Insights?
- Cloudwatch Alarm 4xx Errors API Gateway Terraform
- A way to get sum of continous points in cloudwatch for a sparse graph
Related Questions in CLOUDWATCH
- AWS: how to schedule deleting EBS Snapshots after 1 week?
- To extract the threshold values of the alarms using python boto
- CloudWatch Logs Filter case insensitive multiple terms or connected
- AWS CloudWatch, setting up alarm on against a metric dimension
- Use Nlog for CloudwatchLog
- Sdk Java API for creating dashboard
- CloudWatch alarm for Amazon EC2 Service Instance Limits
- Aws cloudwatch get.metrics with more than one dimension
- Wrong event time in CloudWatch log events
- How to change alarm details schema on cloudwatch
- Boto / Cloudwatch recover instance alarm
- Can AWS Cloudwatch alarms detect no activity?
- How do I continuously add servers to an autoscaling group as long as an alarm is firing?
- AWS Lambda function with multipal cron expressions
- CloudWatch logs acting weird
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Of course this is possible but you need to write your own script to imitate this scenario, there are ec2-api's available which will help you make this happen.
What you can do:
nperiod.Hope this helps.