简体   繁体   中英

Restarting EC2 Apache instance on CloudWatchAlarm

I was wondering if there can be a process to restart apache if an alarm is triggered on ec2 instance. Either process can be triggered by Alarm or by SNS. In Alarm Actions i can see Auto Scaling or ECS Services or EC2 instance reboot kind option. I am trying to see if Lambda + SNS can work. But it dosen`t seem appropriate.

I am running ubuntu instances.

Yes you can achieve this by using Combination of AWS Lambda and EC2 Run Command Service from AWS.

https://aws.amazon.com/blogs/aws/new-ec2-run-command-remote-instance-management-at-scale/

You can create Lambda function that will trigger based on Cloudwatch Alarm and on trigger make Lambda to run service apache2 restart on your Ubuntu EC2 instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM