Amazon Web Services - Resolving 403 Forbidden Error When Connecting to API from VPC through API Gateway - GeeksforGeeks (2024)

Last Updated : 28 Mar, 2023

Summarize

Comments

Improve

The Amazon API Gateway is used to create scalable APIs. It can perform additional functionalities like publishing the API, monitoring and maintaining the API. These can also be used to develop RESTful APIs and WebSocket APIs which can be used for real-time two-way communication between the client and the server. In simpler words we can say that, the Amazon API Gateway is one spot for accepting, processing and managing APIs concurrently on a large scale.

In this article, we will resolve the error 403 forbidden that occurs while accessing a public API gateway API from within a Virtual Private Cloud(VPC). To resolve the 403 Forbidden error follow the below steps:

Step 1: First check if there is a VPC endpoint for the Execute API service, related within the VPC. To check this go to the AWS management console.

Amazon Web Services - Resolving 403 Forbidden Error When Connecting to API from VPC through API Gateway - GeeksforGeeks (1)

Step 2: After logging into the AWS management console navigate to the VPC console.

Amazon Web Services - Resolving 403 Forbidden Error When Connecting to API from VPC through API Gateway - GeeksforGeeks (2)

Step 3: Then choose Endpoints in the left navigation panel.

Amazon Web Services - Resolving 403 Forbidden Error When Connecting to API from VPC through API Gateway - GeeksforGeeks (3)

Here you can see the list of interface VPC endpoints in the current region for your account.

Amazon Web Services - Resolving 403 Forbidden Error When Connecting to API from VPC through API Gateway - GeeksforGeeks (4)

Step 4: Now filter the VPC endpoints using the VPC ID.

Amazon Web Services - Resolving 403 Forbidden Error When Connecting to API from VPC through API Gateway - GeeksforGeeks (5)

Step 5: Again filter the VPC endpoints using the Service name.

Amazon Web Services - Resolving 403 Forbidden Error When Connecting to API from VPC through API Gateway - GeeksforGeeks (6)

Now you can see the VPC endpoint for the execute API service, related within the VPC.

Amazon Web Services - Resolving 403 Forbidden Error When Connecting to API from VPC through API Gateway - GeeksforGeeks (7)

Note that VPC endpoints with Private DNS enabled will route all the API gateway requests to this VPC endpoint because we can access the private API gateway endpoint only from this VPC endpoint. We can’t access any public API gateway APIs and AWS will throw the error “403 forbidden”.

There are two ways we can resolve this error:

  1. Use a custom domain name.
  2. Disable the private DNS on the VPC endpoint that’s in use and then access the private APIs using the public DNS name of the VPC endpoint

Note: Any clients that are using the private DNS name will no longer be able to connect to the private API and would have to use the public DNS name of the VPC endpoint instead.

Let’s look into how to disable the private DNS name settings for a VPC endpoint.

Step 1: Using the VPC endpoint console select the VPC endpoint whose settings you want to change.

Step 2: Choose Actions followed by Modify Private DNS names option.

Amazon Web Services - Resolving 403 Forbidden Error When Connecting to API from VPC through API Gateway - GeeksforGeeks (8)

Step 3: To enable private DNS name, clear the checkmark next to “enable for this endpoint”. Then choose “Modify Private DNS names” to save your changes.

Amazon Web Services - Resolving 403 Forbidden Error When Connecting to API from VPC through API Gateway - GeeksforGeeks (9)

After the private DNS name setting is disabled you can access the private API gateway APIs using the below command in the AWS command-line interface.

curl -X GET -v https://apiId.execute-api.region.amazonaws.com/stageName/resourceName

This will resolve the 403 Forbidden Error in the API Gateway connection.



Please Login to comment...

Amazon Web Services - Resolving 403 Forbidden Error When Connecting to API from VPC through API Gateway - GeeksforGeeks (2024)
Top Articles
Gute Schulden ⇔ Schlechte Schulden: Der große Unterschied
Send Email to Many Recipients Using a Mail Merge - Knowledgebase / Email and Collaboration / Email
Caesars Rewards Loyalty Program Review [Previously Total Rewards]
The UPS Store | Ship & Print Here > 400 West Broadway
Jailbase Orlando
Craigslist Parsippany Nj Rooms For Rent
Localfedex.com
Klustron 9
Slapstick Sound Effect Crossword
Urinevlekken verwijderen: De meest effectieve methoden - Puurlv
Craigslistdaytona
LeBron James comes out on fire, scores first 16 points for Cavaliers in Game 2 vs. Pacers
18443168434
Citymd West 146Th Urgent Care - Nyc Photos
Craigslist Apartments In Philly
Payment and Ticket Options | Greyhound
Lancasterfire Live Incidents
Kaitlyn Katsaros Forum
Today Was A Good Day With Lyrics
Vegito Clothes Xenoverse 2
Sef2 Lewis Structure
Integer Division Matlab
Accuweather Minneapolis Radar
Best Middle Schools In Queens Ny
Black Panther 2 Showtimes Near Epic Theatres Of Palm Coast
Wonder Film Wiki
Motorcycle Blue Book Value Honda
Hobby Lobby Hours Parkersburg Wv
John Philip Sousa Foundation
Rs3 Bring Leela To The Tomb
Laveen Modern Dentistry And Orthodontics Laveen Village Az
Ridge Culver Wegmans Pharmacy
60 Second Burger Run Unblocked
The Venus Flytrap: A Complete Care Guide
Giantess Feet Deviantart
Flags Half Staff Today Wisconsin
Rhode Island High School Sports News & Headlines| Providence Journal
Riverton Wyoming Craigslist
Below Five Store Near Me
Promo Code Blackout Bingo 2023
60 Days From May 31
Avatar: The Way Of Water Showtimes Near Jasper 8 Theatres
Phmc.myloancare.com
City Of Irving Tx Jail In-Custody List
Pilot Travel Center Portersville Photos
Mawal Gameroom Download
Palmyra Authentic Mediterranean Cuisine مطعم أبو سمرة
Asisn Massage Near Me
Coldestuknow
Latest Posts
Article information

Author: Dan Stracke

Last Updated:

Views: 5969

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Dan Stracke

Birthday: 1992-08-25

Address: 2253 Brown Springs, East Alla, OH 38634-0309

Phone: +398735162064

Job: Investor Government Associate

Hobby: Shopping, LARPing, Scrapbooking, Surfing, Slacklining, Dance, Glassblowing

Introduction: My name is Dan Stracke, I am a homely, gleaming, glamorous, inquisitive, homely, gorgeous, light person who loves writing and wants to share my knowledge and understanding with you.