AWS Auto Restart Instance Every Week

Problem:

I need AWS to create auto reboot event (auto restart) my amazon instance every week. Preferably I don’t want to pay a monthly fee or one-off fees for running events. So I need a free solution and if possible for it to allocate a new IP address when it restarts.

Solution:

You can use cloudwatch to create a scheduled event.

https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#rules:action=create

aws auto restart

aws auto restart

Note that you can only obtain a new IP address for the instance if you stop it and then start it again, something not yet provided by Cloudwatch events maybe soon?

Other solutions:

Scheduled Events for Your Instances
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html

I know cloudwatch can now reboot the machines based on conditions also.
https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#

Stop and start Amazon EC2 Instances at scheduled intervals with AWS Data Pipeline
And also the data pipeline but this costs $0.60 per action?
https://aws.amazon.com/datapipeline/pricing/
https://aws.amazon.com/premiumsupport/knowledge-center/stop-start-ec2-instances/

Sam Deering is a web developer from England (currently living in Australia). In his spare time he enjoys coding, playing chess, reading and investing.

Leave a Reply

Your email address will not be published. Required fields are marked *