How do I troubleshoot HTTP 403 errors from API Gateway?

Amazon Web Services · Advanced ·☁️ DevOps & Cloud ·7mo ago

Key Takeaways

The video demonstrates how to troubleshoot HTTP 403 errors from API Gateway using tools like curl, Postman, and the AWS Management Console, covering topics such as IAM authorization, resource policies, and stage names.

Full Transcript

[music] Hello, I'm Sahil, a cloud support engineer here at the AWS office in Bangalore. Today I'm going to show you how to troubleshoot HTTP 403 forbidden errors that occur when calling APIs hosted on Amazon API gateway. Let's get started. When a client can't access a valid URL, you get an HTTP 403 forbidden response code, the server understands the request but can't fulfill it because of the client side issues. API gateway can return 403 forbidden errors for various reasons. Let's take a look at how to identify and troubleshoot these 403 forbidden errors. For this demonstration, let's say that we have a regional rest API with a basic as Lambda integrations. When we try to invoke the API from an Amazon Elastic Compute Cloud instance which is having a public internet access, we get the 403 error. To identify the root cause of the issue when invoking the API through the curl command, we first have to identify the following error characteristics. Error response header X Amazon error type error message error status code in the curl commands response. We can see that we are getting the error access denied exception in the response header X Amazon error type with the status code as 403 forbidden. The error message appears as user anonymous is not authorized to perform execute API invoke action on my API gateway source with an explicit deny. The error message could be because of either the caller isn't authorized to access an API that uses IM authorization or the API has an attached resource policy that doesn't explicitly allow the caller to invoke the API. For more information, see IM authentication and the resource policy. The first root cause is because of AWS identity and access management authorization. In this case, I don't have IM authorization attached in my method request for my API. So, this root cause isn't applicable. Now, let's look at the second root cause where my resource policy is denying access to the API. As we can see, I have a resource policy that denies all invocation on my resource. To resolve this issue, allow access to invoke this API in its resource policy. Make sure that you redeploy the API whenever there are any changes in the resource policy. Now, let's make a request to the rest API endpoint from Amazon EC2 instance. The request returns a 200 okay status code with a desired response. Now let's talk about how to troubleshoot the 403 forbidden error and find the response headers when invoking the API from any browser or third party API testing tools such as postman. For this demonstration we have a regional rest API which has a basic AWS Lambda integration. When we try to invoke the API from a browser, we get the error message forbiddenness. Let's take a look at the response headers for this request. Right click anywhere on the browser web page. Select inspect. Navigate to the network tab. As we can see, we are getting the response headers X Amazon error type forbidden exception when we invoke the rest API. Let's try invoking the API through the third party API testing tool Postman. When invoking the API using the same API gateway invocation URL, we get the error message forbidden. Let's check the response headers in the headers tab. We can see that we are getting the X Amazon error type forbidden exception error response header. The error message could be because of multiple reasons. One of the reasons is the caller request URL includes a stage that doesn't exist. This reason means that I'm invoking the API with an incorrect stage name for my API. Let's take a look at my API gateway stage. I have deployed the API with a stage name prod while I'm invoking the API with a stage name which doesn't exist in my API. Let's invoke the API with the correct stage name from the browser and Postman. When we use the correct stage invocation URL, we can see successful API invocation and request returning 200 okay status with the desired response. For more information about troubleshooting 403 forbidden errors, refer to the knowledge center article linked in the video description below. And now you know how to troubleshoot HTTP 403 forbidden errors that occur when calling APIs hosted on Amazon API gateway. Thanks for watching and happy cloud computing from all of us here at AWS. [music]

Original Description

For more details on this topic, visit the AWS Knowledge Center on AWS re:Post and read the full article associated with this video: https://repost.aws/knowledge-center/api-gateway-troubleshoot-403-forbidden The AWS Knowledge Center contains trusted, expert-reviewed answers to frequently asked questions across AWS services — including EC2, S3, IAM, Lambda, Bedrock, and more. Sahil shows you how to troubleshoot HTTP 403 forbidden errors that occur when calling APIs hosted on Amazon API Gateway. 0:00 Introduction 0:21 403 Forbidden Errors 0:47 API Gateway Setup 1:25 Error Characteristics 2:10 Root Causes 2:53 Resolving Issues 3:19 Browser Troubleshooting 4:12 Common Reasons 4:43 Correct API Invocation 5:15 Closing Subscribe to AWS: https://go.aws/subscribe Create a free AWS account: https://go.aws/signup Try AWS for free: https://go.aws/free Connect with an expert: https://go.aws/contact Explore more: https://go.aws/more Next steps: Explore on AWS in Analyst Research: https://go.aws/reports Discover, deploy, and manage software that runs on AWS: https://go.aws/marketplace Join the AWS Partner Network: https://go.aws/partners Learn more on how Amazon builds and operates software: https://go.aws/library Do you have technical AWS questions? Ask the community of experts on AWS re:Post: https://go.aws/3lPaoPb Why AWS? Amazon Web Services is the world’s most comprehensive and broadly adopted cloud, enabling customers to build anything they can imagine. We offer the greatest choice of innovative cloud capabilities and expertise, on the most extensive global infrastructure with industry-leading security, reliability, and performance. #AWS #AmazonWebServices #CloudComputing
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Amazon Web Services · Amazon Web Services · 0 of 60

← Previous Next →
1 Agentic AI Design Patterns Introduction and walkthrough | Amazon Web Services
Agentic AI Design Patterns Introduction and walkthrough | Amazon Web Services
Amazon Web Services
2 Galileo on modernizing on banking infrastructure | Amazon Web Services
Galileo on modernizing on banking infrastructure | Amazon Web Services
Amazon Web Services
3 Alliander Speeds Innovation and Energy Transition Using AWS | Amazon Web Services
Alliander Speeds Innovation and Energy Transition Using AWS | Amazon Web Services
Amazon Web Services
4 AWS and Scuderia Ferrari HP streamline F1 power unit assembly | Amazon Web Services
AWS and Scuderia Ferrari HP streamline F1 power unit assembly | Amazon Web Services
Amazon Web Services
5 How AWS machine learning supports Scuderia Ferrari HP pit stops | Amazon Web Services
How AWS machine learning supports Scuderia Ferrari HP pit stops | Amazon Web Services
Amazon Web Services
6 Nasdaq Builds Market Infrastructure of the Future with AWS | Amazon Web Services
Nasdaq Builds Market Infrastructure of the Future with AWS | Amazon Web Services
Amazon Web Services
7 AWS Security Hub Exposure Findings | Amazon Web Services
AWS Security Hub Exposure Findings | Amazon Web Services
Amazon Web Services
8 How do I use Session Manager port forwarding to connect to my EC2 instance through RDP?
How do I use Session Manager port forwarding to connect to my EC2 instance through RDP?
Amazon Web Services
9 How do I extend an EBS volume with LVM partitions?
How do I extend an EBS volume with LVM partitions?
Amazon Web Services
10 AWS Graviton makes it easy to optimize performance, cost, and sustainability | Amazon Web Services
AWS Graviton makes it easy to optimize performance, cost, and sustainability | Amazon Web Services
Amazon Web Services
11 Run Cloud Adoption Framework workshops with Miro | Amazon Web Services
Run Cloud Adoption Framework workshops with Miro | Amazon Web Services
Amazon Web Services
12 Getting Started with AWS Cost Optimization Hub | Amazon Web Services
Getting Started with AWS Cost Optimization Hub | Amazon Web Services
Amazon Web Services
13 Why did my Amazon SQS messages get sent to a dead-letter queue?
Why did my Amazon SQS messages get sent to a dead-letter queue?
Amazon Web Services
14 Declarative Policies for EC2 | Amazon Web Services
Declarative Policies for EC2 | Amazon Web Services
Amazon Web Services
15 How do I troubleshoot IAM permission issues for the Billing and Cost Management console?
How do I troubleshoot IAM permission issues for the Billing and Cost Management console?
Amazon Web Services
16 Integrity at Scale: Inside the Flo Health Mission | Amazon Web Services
Integrity at Scale: Inside the Flo Health Mission | Amazon Web Services
Amazon Web Services
17 Fueling Success: Small shifts, powerful performance | Amazon Web Services
Fueling Success: Small shifts, powerful performance | Amazon Web Services
Amazon Web Services
18 WEX enhances customer experience with AI-powered chatbot | Amazon Web Services
WEX enhances customer experience with AI-powered chatbot | Amazon Web Services
Amazon Web Services
19 Accelerate troubleshooting with Amazon CloudWatch investigations | Amazon Web Services
Accelerate troubleshooting with Amazon CloudWatch investigations | Amazon Web Services
Amazon Web Services
20 Why is my Windows WorkSpace stuck in the starting, rebooting, or stopping status?
Why is my Windows WorkSpace stuck in the starting, rebooting, or stopping status?
Amazon Web Services
21 Telemetry Pipelines for AI | Amazon Web Services
Telemetry Pipelines for AI | Amazon Web Services
Amazon Web Services
22 Getting Control over Security and Observability Data | Amazon Web Services
Getting Control over Security and Observability Data | Amazon Web Services
Amazon Web Services
23 The Problem with Telemetry Data Volume | Amazon Web Services
The Problem with Telemetry Data Volume | Amazon Web Services
Amazon Web Services
24 Telemetry Pipelines on AWS | Amazon Web Services
Telemetry Pipelines on AWS | Amazon Web Services
Amazon Web Services
25 What are Telemetry Pipelines? | Amazon Web Services
What are Telemetry Pipelines? | Amazon Web Services
Amazon Web Services
26 Using AI for RegEx on Telemetry Pipelines | Amazon Web Services
Using AI for RegEx on Telemetry Pipelines | Amazon Web Services
Amazon Web Services
27 Multi-Session Support in the AWS Console | Amazon Web Services
Multi-Session Support in the AWS Console | Amazon Web Services
Amazon Web Services
28 How CloudHedge delivers assessment with AWS ISV Tooling Program at no cost?
How CloudHedge delivers assessment with AWS ISV Tooling Program at no cost?
Amazon Web Services
29 How customers speed up migration and modernization to AWS with CloudHedge | Amazon Web Services
How customers speed up migration and modernization to AWS with CloudHedge | Amazon Web Services
Amazon Web Services
30 Chaos Experiment with Amazon ElastiCache | Amazon Web Services
Chaos Experiment with Amazon ElastiCache | Amazon Web Services
Amazon Web Services
31 Amazon S3 Access Points: Easily manage access for shared datasets on S3 | Amazon Web Services
Amazon S3 Access Points: Easily manage access for shared datasets on S3 | Amazon Web Services
Amazon Web Services
32 ElastiCache Valkey 8.0 - Savings and Efficiency | Amazon Web Services
ElastiCache Valkey 8.0 - Savings and Efficiency | Amazon Web Services
Amazon Web Services
33 Pennymac scales document processing with AWS | Amazon Web Services
Pennymac scales document processing with AWS | Amazon Web Services
Amazon Web Services
34 AWS | Next Level Innovation | Amazon Web Services
AWS | Next Level Innovation | Amazon Web Services
Amazon Web Services
35 Driving Cloud Innovation: Mindtickle's Partnership with AWS Enterprise Support | Amazon Web Services
Driving Cloud Innovation: Mindtickle's Partnership with AWS Enterprise Support | Amazon Web Services
Amazon Web Services
36 A Leader's Edge from Executive Insights | Amazon Web Services
A Leader's Edge from Executive Insights | Amazon Web Services
Amazon Web Services
37 How do I create a custom Amazon WorkSpaces image?
How do I create a custom Amazon WorkSpaces image?
Amazon Web Services
38 Charles Leclerc tests his AI-generated race track | Amazon Web Services
Charles Leclerc tests his AI-generated race track | Amazon Web Services
Amazon Web Services
39 Redington Scales India’s Cloud Access with AWS Partnership | Amazon Web Services
Redington Scales India’s Cloud Access with AWS Partnership | Amazon Web Services
Amazon Web Services
40 How do I prevent the resources in my CloudFormation stack from getting deleted or updated?
How do I prevent the resources in my CloudFormation stack from getting deleted or updated?
Amazon Web Services
41 How do I troubleshoot authentication errors when I use RDP to connect to an EC2 Windows instance?
How do I troubleshoot authentication errors when I use RDP to connect to an EC2 Windows instance?
Amazon Web Services
42 Exploring the Possibilities of Digital Twin & AI at the Edge | Amazon Web Services
Exploring the Possibilities of Digital Twin & AI at the Edge | Amazon Web Services
Amazon Web Services
43 Exploring the Possibilities of Digital Twin & AI at the Edge | Amazon Web Services
Exploring the Possibilities of Digital Twin & AI at the Edge | Amazon Web Services
Amazon Web Services
44 AWS at the FORMULA 1 AWS GRAN PREMIO DELL'EMILIA-ROMAGNA 2025 | Amazon Web Services
AWS at the FORMULA 1 AWS GRAN PREMIO DELL'EMILIA-ROMAGNA 2025 | Amazon Web Services
Amazon Web Services
45 What's new in RCPs | Amazon Web Services
What's new in RCPs | Amazon Web Services
Amazon Web Services
46 API Caching using Amazon ElastiCache | Amazon Web Services
API Caching using Amazon ElastiCache | Amazon Web Services
Amazon Web Services
47 Pendula: Amazon Nova Customer Testimonial | Amazon Web Services
Pendula: Amazon Nova Customer Testimonial | Amazon Web Services
Amazon Web Services
48 InDebted : Amazon Nova Customer Testimonial | Amazon Web Services
InDebted : Amazon Nova Customer Testimonial | Amazon Web Services
Amazon Web Services
49 Amazon DynamoDB global tables with multi-Region strong consistency | Amazon Web Services
Amazon DynamoDB global tables with multi-Region strong consistency | Amazon Web Services
Amazon Web Services
50 Siemens Mobility uses AWS to operate securely, efficiently on a global scale | Amazon Web Services
Siemens Mobility uses AWS to operate securely, efficiently on a global scale | Amazon Web Services
Amazon Web Services
51 How do I reuse a knowledge base session in Amazon Bedrock?
How do I reuse a knowledge base session in Amazon Bedrock?
Amazon Web Services
52 EP5: MBZUAI, CMU : Causal AI, Answering The “Why“ and “What if“ Questions | AWS for AI Podcast
EP5: MBZUAI, CMU : Causal AI, Answering The “Why“ and “What if“ Questions | AWS for AI Podcast
Amazon Web Services
53 Hema scales time to market developing a data mesh on AWS (Technical) - Cloud Adventures
Hema scales time to market developing a data mesh on AWS (Technical) - Cloud Adventures
Amazon Web Services
54 Hema scales time to market developing a data mesh on AWS (Business) - Cloud Adventures
Hema scales time to market developing a data mesh on AWS (Business) - Cloud Adventures
Amazon Web Services
55 How Langfuse Scaled Their AI Platform with AWS: From Open-Source to Enterprise | Amazon Web Services
How Langfuse Scaled Their AI Platform with AWS: From Open-Source to Enterprise | Amazon Web Services
Amazon Web Services
56 SLMs and LLMs: What’s the Difference? | Amazon Web Services
SLMs and LLMs: What’s the Difference? | Amazon Web Services
Amazon Web Services
57 SLMs and LLMs: When to use them? | Amazon Web Services
SLMs and LLMs: When to use them? | Amazon Web Services
Amazon Web Services
58 SLMs on CPU | Amazon Web Services
SLMs on CPU | Amazon Web Services
Amazon Web Services
59 Intelligent Model Routing | Amazon Web Services
Intelligent Model Routing | Amazon Web Services
Amazon Web Services
60 SLMs, LLMs, and Model Routing in Agents | Amazon Web Services
SLMs, LLMs, and Model Routing in Agents | Amazon Web Services
Amazon Web Services

This video teaches how to troubleshoot HTTP 403 errors from API Gateway, covering topics such as IAM authorization, resource policies, and stage names. By following the steps outlined in the video, viewers can learn how to identify and resolve common issues with API Gateway.

Key Takeaways
  1. Identify the error characteristics using curl or Postman
  2. Check the error response header X-Amazon-Error-Type
  3. Verify IAM authorization and resource policies
  4. Check the stage name and deployment status
  5. Redeploy the API if necessary
💡 The error message and response headers can provide valuable information for troubleshooting HTTP 403 errors from API Gateway

Related Reads

📰
We Kept Writing More Terraform to Fix Terraform’s Problems. There’s a Simpler Way.
Learn how to simplify Terraform configuration for cloud provisioning and avoid common pitfalls
Medium · DevOps
📰
Apple Just Built Its Own Docker Alternative — Apple Container 1.0
Apple introduces Apple Container 1.0, a potential Docker alternative, and its implications for developers
Medium · DevOps
📰
Your Cron Job Works. That’s Not the Same as Surviving Cron.
Learn to differentiate between a working cron job and one that can survive long-term unattended execution, and why it matters for reliability
Medium · DevOps
📰
Your Cron Job Works. That's Not the Same as Surviving Cron
Ensure your cron jobs are resilient and can survive unexpected failures, not just run successfully
Dev.to · Anguishe

Chapters (10)

Introduction
0:21 403 Forbidden Errors
0:47 API Gateway Setup
1:25 Error Characteristics
2:10 Root Causes
2:53 Resolving Issues
3:19 Browser Troubleshooting
4:12 Common Reasons
4:43 Correct API Invocation
5:15 Closing
Up next
AWS, Azure, GCP: The One Thing Every Business Gets Wrong
AI Daily
Watch →