is this possible using lambda function. i am looking for remote monitor function for my EC2 instance.i have tried the post for schedule the start/stop ec2 instance using lambda function and cloudwatch. but in my scenario my application will be running on 24/7. if any case memoryheap size increased and instance getting down. i don't want to end up like that. So please
1 Answers
1
votes
First of Welcome to stackoverflow, looking at your question I have a suggestion that might help you.
If you end goal is instance being up all time and it should restart if ping fails, a simpler solution would be put it in AUTO SCALING Group with MAX and MIN instance count at 1.
You can configure health check at instance port you want and as soon as the instance fails ASG would remove it and as minimum instance is one i.e no matter what one instance should be up ASG would spin up another instance from AMI and your app would be up.
You can also set boot time commands if you want for your instance if application need some initialization using User Data
Hope this helps!