Prakash
Prakash

Reputation: 183

Webservice exposed using AWS API Gateway is not accessible from the EC2 instance. Returns 403 { "message": "Forbidden" }

I created REST API using AWS API Gateway with following details

I successfully deployed the API

API is accessible from the outside world/ public network

API is not accessible from the EC2 instance launched in same account(Not tried to access it from other AWS account). API returns with 403 { "message": "Forbidden" }

What I am missing here which makes the API inaccessible from EC2 ?

Upvotes: 3

Views: 1715

Answers (2)

STiLeTT
STiLeTT

Reputation: 1073

I had the same problem. It turned out that I had a VPC endpoint with private DNS in that VPC, see https://aws.amazon.com/ru/premiumsupport/knowledge-center/api-gateway-vpc-connections/:

When you select the Enable Private DNS Name option while creating an interface VPC endpoint for API Gateway, you can access your private APIs using a private or public DNS, but you can't access your public APIs.

Upvotes: 2

AlexK
AlexK

Reputation: 1420

Can you please check if you are acessing the correct API GW Endpoint?

API GW returns 403 when you are trying to access an endpoint that doesn't exist.

Also check if you have deployed your latest version.

Upvotes: 0

Related Questions