Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aws/agent-toolkit-for-aws --skill connecting-lambda-to-api-gateway -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/connecting-lambda-to-api-gateway/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/connecting-lambda-to-api-gateway/

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

Similar skills

Everything for Cloud: AWS, Azure, GCP →

From the same set133

finding-data-lake-assets Resolves data lake and lakehouse asset references across AWS Glue Data Catalog, S3, S3 Tables, and Redshift. Useful when you need to locate a table by keyword, column, or S3 path. CX Codex +1 6,500installs creating-data-lake-table Creates managed Iceberg tables in Amazon S3 Tables: bucket, namespace, schema, partitioning and access. Useful when data needs an analytics-ready home. CX Codex +1 6,500installs aws-amplify Skill for building and deploying full-stack apps with AWS Amplify Gen2. Configure auth, databases, storage, and AI via TypeScript code — supports React, Next.js, Vue, Flutter, and more. CX Codex +1 6,600installs ingesting-into-data-lake Moves data from S3 files, JDBC databases, DynamoDB, BigQuery, or Snowflake into AWS data lake tables. Defaults to S3 Tables or Iceberg and configures Glue jobs. CX Codex +1 6,600installs troubleshooting-application-failures A skill that traces application failures through CloudWatch logs: it locates log groups, pulls error patterns and stack traces, then ranks fixes by priority. CX Codex +1 6,400installs connecting-lambda-to-dynamodb Connects AWS Lambda functions to DynamoDB tables. Guides IAM execution roles, DynamoDB stream event mappings, and troubleshooting. CX Codex +1 6,500installs troubleshooting-s3-files Diagnoses Amazon S3 Files issues, from mount timeouts and IAM permission errors to sync delays and file conflicts. CX Codex +1 6,300installs launching-ec2-instance-with-best-practices This skill launches EC2 instances with security and cost controls in place. Use it when deploying a new AWS instance and checking its setup after launch. CX Codex +1 6,300installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor