Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda function REST API end point - 403 error

I have an AWS Lambda function that is exposed as a REST API.

When it is invoked it via the Test button on aws lambda console, it works.

When it is invoked via a online REST client, i get 403 error. It was created as requiring - no authentication (Open).

What configuration am i missing?

like image 264
Jasper Avatar asked Oct 13 '15 17:10

Jasper


People also ask

Why do I get an HTTP 403 Forbidden error when connecting to my API gateway APIs from a VPC?

The HTTP 403 Forbidden error most commonly occurs when private DNS is enabled for an API Gateway interface VPC endpoint that's associated with a VPC. In this scenario, all requests from the VPC to API Gateway APIs resolve to that interface VPC endpoint.

Why do I get HTTP 403 forbidden?

You might encounter the 403 forbidden error when you visit an empty website directory or a specific page that has a permission error. This is because most websites are set up to disallow directory browsing to prevent attackers from accessing sensitive files.


2 Answers

Supposedly the Lambda is exposed through an AWS API Gateway. One reason why you'd get 403 on a fresh "no authentication" API Gateway resource is because you haven't yet deployed your changes.

In API Gateway Console click the Actions dropdown and select Deploy API.

You should be good to go.

like image 132
David Salamon Avatar answered Sep 20 '22 14:09

David Salamon


Perhaps you are sending request to a wrong endpoint.

I was getting 403 error response by sending a POST request to https://example.com/locate

However, once I added stage http://example.com/dev/locate and deployed changes to this API, it worked ok, returning 200 response.

enter image description here

Hope that helps.

like image 44
sapenov Avatar answered Sep 21 '22 14:09

sapenov