start and stop EC2 windows server

0

how to automatic start and stop EC2 windows server in a specific time in a weekend without expense more money.

hITESH
asked 3 months ago276 views
4 Answers
4

Hello, To automatically start and stop an EC2 Windows server on weekends without extra cost, utilize Amazon EventBridge scheduler. Set up scheduled events to stop the instance on Saturdays and start it on Sundays. Ensure accurate configuration of event rules. No additional costs are incurred beyond regular AWS service charges. Refer to the provided blog for detailed setup steps.

i hope this will helpful

profile picture
EXPERT
answered 3 months ago
3

Hello.

You can automate stopping and starting on Saturdays and Sundays using the EventBridge scheduler.
The blog below automates stopping EC2, but starting can also be automated using the same steps.
https://dev.to/aws-builders/easy-setup-for-ec2-stop-jobs-with-amazon-eventbridge-scheduler-4lpg

profile picture
EXPERT
answered 3 months ago
profile picture
EXPERT
reviewed 3 months ago
profile pictureAWS
EXPERT
reviewed 3 months ago
1

Hii,

  • Create an IAM role for your instance ([AWS create iam role ON Amazon.com docs.aws.amazon.com]).
  • Build a Lambda function with PowerShell scripts to stop/start the server ([AWS Lambda function ON Amazon.com docs.aws.amazon.com]).
  • Set up CloudWatch Events with a Cron expression (e.g., 0 8 ? * SAT,SUN for weekends at 8 AM) to trigger the Lambda function (https://crontab.guru/).
  • Enjoy weekend savings! (Free tier quotas apply to Lambda and CloudWatch Events).

https://repost.aws/knowledge-center/start-stop-lambda-eventbridge

profile picture
EXPERT
answered 3 months ago
0

You should consider only powering the instance on with an EventBridge schedule or the Instance Scheduler, which is the full solution for large-scale instance scheduling that AWS provides: https://aws.amazon.com/solutions/implementations/instance-scheduler-on-aws/

Windows servers can spend a lot of time installing patches before shutting down. That's the stage where your regular laptop shows "Do not power off your computer" on the screen. When the server is powered off by EC2, Windows is notified of the pending shutdown, but EC2 will forcibly power it off if Windows doesn't finish it in some minutes. EC2 won't understand the warning message Windows displays on the screen. If patch installation is still in progress when the server loses power, the whole Windows installation can easily get irreversibly corrupted. That only happens in certain situations, so it might take months or a couple of years before you see this happen.

If you only use EventBridge to power the server on, and use the Windows Task Scheduler to trigger shutdown.exe to power the server off, Windows will control the entire power-off sequence, allowing it to use as much time as it needs to finish the installation.

EXPERT
Leo K
answered 3 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions