Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. Download free →
CLSkills
Cloud (AWS/GCP/Azure)intermediate

API Gateway Setup

Share

Configure API Gateway with Lambda

Works with OpenClaude

You are an AWS solutions architect. The user wants to configure an API Gateway with Lambda integration to create a serverless REST API.

What to check first

  • Run aws iam get-user to confirm AWS CLI credentials are configured
  • Verify the Lambda function exists: aws lambda list-functions --query 'Functions[*].FunctionName'
  • Check IAM role has lambda:InvokeFunction and apigateway:* permissions

Steps

  1. Create a new REST API in API Gateway using aws apigateway create-rest-api --name MyAPI --description "Lambda integration"
  2. Get the root resource ID with aws apigateway get-resources --rest-api-id <api-id> --query 'items[0].id'
  3. Create a new resource under root: aws apigateway create-resource --rest-api-id <api-id> --parent-id <root-id> --path-part users
  4. Create a POST method on the resource: aws apigateway put-method --rest-api-id <api-id> --resource-id <resource-id> --http-method POST --authorization-type NONE
  5. Set up Lambda integration with aws apigateway put-integration --rest-api-id <api-id> --resource-id <resource-id> --http-method POST --type AWS_PROXY --integration-http-method POST --uri arn:aws:apigateway:region:lambda:path/2015-03-31/functions/arn:aws:lambda:region:account:function:function-name/invocations
  6. Configure the method response: aws apigateway put-method-response --rest-api-id <api-id> --resource-id <resource-id> --http-method POST --status-code 200
  7. Grant API Gateway permission to invoke the Lambda: aws lambda add-permission --function-name function-name --statement-id apigateway-access --action lambda:InvokeFunction --principal apigateway.amazonaws.com
  8. Deploy the API: aws apigateway create-deployment --rest-api-id <api-id> --stage-name prod
  9. Get the invoke URL: aws apigateway get-stage --rest-api-id <api-id> --stage-name prod --query 'invokeUrl'

Code

import boto3
import json

apigateway = boto3.client('apigateway')
lambda_client = boto3.client('lambda')

def setup_api_gateway_with_lambda(api_name, lambda_function_arn, resource_path, http_method):
    """Configure API Gateway with Lambda integration."""
    
    # Create REST API
    api_response = apigateway.create_rest_api(
        name=api_name,
        description=f"API for {lambda_function_arn}"
    )
    api_id = api_response['id']
    print(f"Created API: {

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
cloudawsapi-gateway

Install command:

curl -o ~/.claude/skills/api-gateway-setup.md https://claude-skills-hub.vercel.app/skills/cloud/api-gateway-setup.md

Related Cloud (AWS/GCP/Azure) Skills

Other Claude Code skills in the same category — free to download.

Want a Cloud (AWS/GCP/Azure) skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.