Reputation: 3385
Sometimes my application dies without any reason and I can detect that using CloudWatch and CPU usage metric going down.
At this moment I want to restart the java application or the whole EC2 instance.
Any suggestions how can I achive that?
Thanks.
Upvotes: 3
Views: 3569
Reputation: 9220
You can configure in Cloudwatch Alarm EC2 Action for reboot the instance.
References:
Upvotes: 0
Reputation: 257
You can let CloudWatch terminate your EC2 instance and let AutoScaling bring up another "fresh" instance with your application configured.
Upvotes: 2
Reputation: 108
If only your application halt but EC2 instance works.
You could write a shell monitor the app using CloudWatch API and shoot the app when necessary,then make it a task in cron. Or you can using a shell right in your EC2 instance.
To restart your EC2 instance automatically is way too dangerous ,you can try Autoscaling, which automatically starts a new instance when your instance frozen and keep your SLA.
Upvotes: 0