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
What is the iconic weapon of the D&D druid.
Redeem Codes
No Hard Feelings (2023) Tickets & Showtimes
Is pickleball Betts' next conquest? 'That's my jam'
Ingles Weekly Ad Lilburn Ga
Evil Dead Rise Showtimes Near Massena Movieplex
Georgia Vehicle Registration Fees Calculator
David Packouz Girlfriend
Mylife Cvs Login
Heska Ulite
My.doculivery.com/Crowncork
Myunlb
Herbalism Guide Tbc
Sports Clips Plant City
Enderal:Ausrüstung – Sureai
Babyrainbow Private
Costco Gas Foster City
Aspen.sprout Forum
Void Touched Curio
Grasons Estate Sales Tucson
Patrick Bateman Notebook
Salem Oregon Costco Gas Prices
Loves Employee Pay Stub
623-250-6295
Ubg98.Github.io Unblocked
Dr Ayad Alsaadi
Is Windbound Multiplayer
Valic Eremit
Kirk Franklin Mother Debra Jones Age
Rek Funerals
Unity Webgl Car Tag
TMO GRC Fortworth TX | T-Mobile Community
Darktide Terrifying Barrage
South Florida residents must earn more than $100,000 to avoid being 'rent burdened'
Composite Function Calculator + Online Solver With Free Steps
Poster & 1600 Autocollants créatifs | Activité facile et ludique | Poppik Stickers
Joplin Pets Craigslist
Jennifer Reimold Ex Husband Scott Porter
Vanessa West Tripod Jeffrey Dahmer
Admissions - New York Conservatory for Dramatic Arts
Eastern New Mexico News Obituaries
Main Street Station Coshocton Menu
Craigslist Jobs Brownsville Tx
Indio Mall Eye Doctor
How To Upgrade Stamina In Blox Fruits
511Pa
Tunica Inmate Roster Release
Pink Runtz Strain, The Ultimate Guide
Ehome America Coupon Code
Access to Delta Websites for Retirees
Bridgeport Police Blotter Today
Códigos SWIFT/BIC para bancos de USA
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.