0

I have two EC2 instances, in which I have running Node engine in one EC2 and Mongo in another EC2 instance.

When I am trying to connect with Node instance to Mongo instance it is not connecting. But the Mongo Instance is running. Later I found that the Mongo is not-working/stopped inside the instance.

Is there any way to know when a Mongo service is not-working/stopped. Like for enabling cloudwatch alarm to know the status of an instance.

MLavoie
  • 9,671
  • 41
  • 36
  • 56
Rakesh
  • 23
  • 3

1 Answers1

1

You can use AWS Lambda to write a function to ping your mongodb, then trigger it by AWS Cloudwatch in minutes interval.

Steps:

  1. write an api in your node server which is used to ping mongodb
  2. write a function to send request to your node server in AWS Lambda Node
  3. attach a AWS Cloudwatch to your lambda function in minutes interval
YuTing
  • 6,555
  • 2
  • 6
  • 16