AWS: Is it possible to monitor an external service?

Question:

With CloudWatch you can monitor applications running on AWS. Is it also possible to monitor an external service?

For example, I have a REST API and I want to get notified once that API is not accessible anymore. Does AWS offer you a monitoring tool for that purpose?

Answer:

Not Cloudwatch just by itself, but you can use a combination of Cloudwatch and Lambdas to do what you’re asking. You can use cloudwatch events to run lambdas on a schedule, something like once every 5 mins.

Your lambda can then ping the API you’re monitoring the health of, and either send its status to cloudwatch as a custom metric; or potentially if your lambda throws an error when the API fails, the lambda error metric which is already in cloudwatch becomes your API failure metric

Once the metric exists in cloudwatch, either as a custom metric or the lambda metric by proxy, you’re able to do usual cloudwatch things like alarms and notifications.

Leave a Reply