How to make api only available to lambda function?

Viewed 39

I have a .net monolithic architecture project, I also have an aws lambda function that makes a request to one of the api from this project, the question is how to restrict access to this api so that other users cannot use it, but only this lambda function.

Do I need to use for example api gateway or some type of authorization?

1 Answers

There are a lot of valid ways to go about this. Perhaps the most simple is requiring an API key on the end point that only you and your lambda function know about. A relevant answer which tackles something similar: https://stackoverflow.com/a/70287196/1431405

This answer references this blog which goes into more detail: http://codingsonata.com/secure-asp-net-core-web-api-using-api-key-authentication/

This would mean anyone trying to access that API, or any you decorate stating they need a valid API key, would need to have the API key included in the header, or else they would be denied.

Related