Generated banner for Connecting Lambda To API Gateway
Generated logo for Connecting Lambda To API Gateway

Connecting Lambda To API Gateway

AWSOfficialPublished by AWS

  • Skill
  • Workflow
  • Cloud and DevOps
  • Apache-2.0
  • No issues found

From the author

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.
— the description by AWS

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured procedure for integrating an existing AWS Lambda function with Amazon API Gateway. It automates the creation of REST APIs, resource and method configuration, Lambda proxy integration, and necessary permission settings. The workflow includes options for configuring authorization types, API keys, and CORS, while incorporating standard security hardening practices like throttling and access logging.

What it does

  • Creates a new Amazon API Gateway REST API.
  • Configures API resources and HTTP methods for Lambda integration.
  • Sets up Lambda proxy integration and required IAM permissions.
  • Configures optional security controls including API keys and authorization types.
  • Enables CORS settings for cross-origin requests.
  • Handles deployment and provides troubleshooting guidance for common integration errors.

When to use it

  • When you need to expose an existing Lambda function as an HTTP endpoint.
  • When setting up a new REST API that requires integration with a backend Lambda function.
  • When you need to apply consistent security and access configurations to API endpoints.
  • When troubleshooting 502 errors or permission issues between API Gateway and Lambda.

Advantages

  • Ensures consistent configuration of API Gateway resources.
  • Reduces manual effort in setting up complex proxy integrations.
  • Includes built-in checks for common configuration pitfalls like CORS and permissions.
  • Supports configurable security parameters for varied access requirements.

Usage examples

“Connect my existing Lambda function named user-data-processor to a new API Gateway named user-api.”
The agent will initiate the workflow to create the API, configure the necessary resources, and link them to the specified Lambda function.
“Set up an API Gateway for my Lambda function with CORS enabled and AWS_IAM authorization.”
The agent will guide you through the setup process, ensuring the API is created with the requested security and cross-origin settings.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/aws/connecting-lambda-to-api-gateway/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip connecting-lambda-to-api-gateway.zip -d .agents/skills

Documentation by AWS

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

Verify enable_cors was set to true, the OPTIONS method was created, and CORS headers are configured in both method and integration responses.

Files

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs an API key

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
AWS
Publisher
AWS (Official)
Source
aws/agent-toolkit-for-aws · skills/specialized-skills/serverless-skills/connecting-lambda-to-api-gateway · commit 0a218f8
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • NOTICE (added by AutoGineer from NOTICE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by AWS or AWS.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download connecting-lambda-to-api-gateway.zip