I've got a node.js server deployed on beanstalk w/ an application loadbalancer. The node.js server has has a URL like the following:
app.get('/data/:id.json', async function (req, res) {
// do stuff with an API key URL
})
This API key that I'm using here with a 3rd party service (infura, but that's not important), kept getting called approx. 2k times an hour, and I kept trying to figure out why.
I have come to the conclusion that this may be a health check by AWS. Is there a way to disable this so I can prevent my API key from essentially being abused and charging me?
thanks
Depending of the nature of the health checks, but for the many projects, is just a route = url/path like /healthcheck that returns 200.
Keep in mind that the health check is not a functional test, it's just to know the application is alive and responds.
If you want to have a full checking, you can have a custom route ( checking a records in db...) but with a delay in checking not every 5 sec but I don't recommand it at all.
So my suggestion to you, add another route, path like /healthcheck, and return a json response with 200 code like server is ok. For this path do not put any security filter ( like token or api key checking...) and configure it in your beanstalk env.