Configure API Gateway with Lambda
✓Works with OpenClaudeYou 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-userto confirm AWS CLI credentials are configured - Verify the Lambda function exists:
aws lambda list-functions --query 'Functions[*].FunctionName' - Check IAM role has
lambda:InvokeFunctionandapigateway:*permissions
Steps
- Create a new REST API in API Gateway using
aws apigateway create-rest-api --name MyAPI --description "Lambda integration" - Get the root resource ID with
aws apigateway get-resources --rest-api-id <api-id> --query 'items[0].id' - Create a new resource under root:
aws apigateway create-resource --rest-api-id <api-id> --parent-id <root-id> --path-part users - 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 - 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 - Configure the method response:
aws apigateway put-method-response --rest-api-id <api-id> --resource-id <resource-id> --http-method POST --status-code 200 - 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 - Deploy the API:
aws apigateway create-deployment --rest-api-id <api-id> --stage-name prod - 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
Related Cloud (AWS/GCP/Azure) Skills
Other Claude Code skills in the same category — free to download.
Lambda Function
Create AWS Lambda function with handler
S3 Operations
Set up S3 bucket operations (upload, download, presigned URLs)
DynamoDB CRUD
Create DynamoDB CRUD operations
SQS Setup
Set up SQS queue producer and consumer
SNS Notifications
Configure SNS for push notifications
CloudFront Setup
Set up CloudFront CDN distribution
Cognito Auth
Implement AWS Cognito authentication
RDS Setup
Configure RDS database connection
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.