
Connecting Lambda To Api Gateway
If you've ever wired up Lambda to API Gateway manually and forgotten the invoke permission or botched the CORS setup, this walks you through the complete procedure. It handles REST API creation, resource and method configuration, Lambda proxy integration, and the security bits that are easy to skip like throttling and access logging. Supports different auth types including IAM, Cognito, and custom authorizers. The troubleshooting section covers the usual gotchas like 502 errors from malformed proxy responses and permission denied issues. Honestly most useful as a checklist to make sure you didn't miss something rather than learning this from scratch.
- skills.sh installs
- 7K
- GitHub stars
- 3.4K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add aws/agent-toolkit-for-aws --skill connecting-lambda-to-api-gateway --agent claude-codeInstalls into .claude/skills of the current project.
Files
Connecting Lambda to API Gateway
Overview
Domain expertise for creating Amazon API Gateway REST APIs and connecting them to existing Lambda functions. Covers API creation, resource and method setup, Lambda proxy integration, CORS configuration, security controls, deployment, and testing.
Connect a Lambda function to API Gateway
To create a REST API and wire it to a Lambda function, follow the procedure exactly. See Lambda to API Gateway connection procedure.
The procedure supports configurable authorization types (NONE, AWS_IAM, COGNITO_USER_POOLS, CUSTOM), optional API key requirements, CORS setup, and production security hardening including throttling and access logging.
Troubleshooting
502 Bad Gateway
The Lambda function must return a proxy-compatible response with statusCode,
headers, and a stringified body. See the full procedure for format details.
Permission denied invoking Lambda
Ensure lambda:InvokeFunction permission was added with the correct API Gateway
source ARN. See the full procedure for details.
CORS errors in browser
Sponsors
Details
- Repository
- github.com/aws/agent-toolkit-for-aws
- Categories
- Backend & APIs, Security, DevOps & CI/CD, AI & Agent Building, Cloud & Infrastructure
- First seen
- May 16, 2026
More from aws/agent-toolkit-for-aws
All 56- Aws Sdk Swift Usage7K
- Ingesting Into Data Lake7K
- Aws Amplify7K
- Creating Data Lake Table7K
- Finding Data Lake Assets7K
- Connecting Lambda To Dynamodb6.9K
- Troubleshooting Application Failures6.9K
- Configuring Vpc Endpoints For Private Aws Service Access6.8K
- Debugging Lambda Timeouts6.8K
- Setting Up Cloudwatch Alarm Notifications6.8K
- Launching Ec2 Instance With Best Practices6.8K
- Troubleshooting S3 Files6.7K
- Creating Api Gateway Stage6.7K
- Setting Up Ec2 Instance Profiles6.6K
- Creating Production Vpc Multi Az6.6K
- Signing In To Aws6.6K
- Aws Transform6.5K
- Connecting Vpcs With Peering6.5K
- Enabling Lambda Vpc Internet Access6.5K
- Exporting Rds To S36.5K
- Setting Up Cloudtrail Multi Region6.5K
- Routing Traffic With Route53 And Cloudfront6.5K
- Creating Amazon Aurora Db Cluster With Instances6.4K
- Troubleshooting Efs6.3K