connecting-lambda-to-api-gateway — Claude Code skill for Lambda + API
A skill that walks the agent through wiring an existing Lambda function into Amazon API Gateway: resources, methods, proxy integration, permissions and deploy.
npx skills add aws/agent-toolkit-for-aws --skill connecting-lambda-to-api-gateway -a claude-codeWhat connecting-lambda-to-api-gateway does
The skill hands your agent a procedure for creating a REST API in Amazon API Gateway and attaching it to a Lambda function you already have. It covers API creation, resource and method setup, Lambda proxy integration, invoke permissions, deployment and testing. Authorization types are configurable (NONE, AWS_IAM, COGNITO_USER_POOLS, CUSTOM), and an API key requirement is optional.
There is a troubleshooting section for the usual failures. On CORS errors in the browser, check that enable_cors is true, the OPTIONS method exists, and CORS headers are set in both method and integration responses. A 502 means the function's response is not proxy-compatible: it needs statusCode, headers and a stringified body. Permission denied on invoke usually points at lambda:InvokeFunction being granted without the right API Gateway source ARN.
The full procedure lives in references/lambda-gateway-api.md, and the skill asks the agent to follow it exactly. Throttling, access logging and production security hardening are part of the same walkthrough. Worth installing if you are putting an HTTP front door on Lambda and would rather not hand-assemble CORS and permissions.
What it helps with
- connect an existing Lambda to API Gateway without hand-building resources and methods
- turn on CORS so the browser stops blocking requests
- grant the function invoke permission with the correct source ARN
- debug why the API returns 502 Bad Gateway
- add throttling and access logging before shipping to production
Example prompts for the agent
- Connect my Lambda function to API Gateway and create a REST API with a GET method on /items
- Set up Lambda proxy integration and enable CORS for this API
- Check why API Gateway returns 502 when it calls my function
How to install connecting-lambda-to-api-gateway
1Skills CLI (Vercel)
npx skills add aws/agent-toolkit-for-aws --skill connecting-lambda-to-api-gateway -a claude-code2Manually: put the files in place
~/.claude/skills/connecting-lambda-to-api-gateway/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/connecting-lambda-to-api-gateway/
1Skills CLI (Vercel)
npx skills add aws/agent-toolkit-for-aws --skill connecting-lambda-to-api-gateway -a codex2Manually: put the files in place
.agents/skills/connecting-lambda-to-api-gateway/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add aws/agent-toolkit-for-aws --skill connecting-lambda-to-api-gateway -a cursor2Manually: put the files in place
.cursor/skills/connecting-lambda-to-api-gateway/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install aws/agent-toolkit-for-aws connecting-lambda-to-api-gateway2Manually: put the files in place
.github/skills/connecting-lambda-to-api-gateway/SKILL.md1Skills CLI (Vercel)
npx skills add aws/agent-toolkit-for-aws --skill connecting-lambda-to-api-gateway -a gemini-cli2Platform CLI
gemini skills install https://github.com/aws/agent-toolkit-for-aws --path skills/specialized-skills/serverless-skills/connecting-lambda-to-api-gatewayManually: put the files in place
.devin/skills/connecting-lambda-to-api-gateway/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add aws/agent-toolkit-for-aws --skill connecting-lambda-to-api-gateway -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about connecting-lambda-to-api-gateway
How do I install connecting-lambda-to-api-gateway in Claude?
Run npx skills add aws/agent-toolkit-for-aws --skill connecting-lambda-to-api-gateway -a claude-code. The skill file then lands at ~/.claude/skills/connecting-lambda-to-api-gateway/SKILL.md.
What does connecting-lambda-to-api-gateway do?
It guides the agent through creating a REST or HTTP API in Amazon API Gateway and connecting an existing Lambda function to it: resources, methods, proxy integration, permissions and deployment.
What should I check on a CORS error?
The skill says to verify that enable_cors is on, the OPTIONS method was created, and CORS headers are configured in both method and integration responses.
Source text
SKILL.md · Apache-2.0
--- name: connecting-lambda-to-api-gateway description: Connects an existing AWS Lambda function to Amazon API Gateway by creating a REST or HTTP API with resource/method setup, Lambda proxy integration, permissions, and deployment. Always use this skill when connecting Lambda to API Gateway — it handles CORS, throttling, access logging, and production security hardening that are easy to miss. version: 1 --- # 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](references/lambda-gateway-api.md). 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 Verify `enable_cors` was set to true, the OPTIONS method was created, and CORS headers are configured in both method and integration responses.
© aws · Apache-2.0 · aws/agent-toolkit-for-aws