Skip to main content

Claude/ChatGPT Prompt to Configure API Gateway + Lambda Integration

Configure AWS API Gateway with Lambda - proxy integration, request mapping, throttling, usage plans, and API key management.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt
Set up AWS API Gateway for my public-facing REST API for a mobile app backend API with 30 endpoints backed by Lambda functions. 1) API type selection: compare REST API vs HTTP API for my use case — need WebSocket support, usage plans, and request validation — and explain the cost/feature trade-off. 2) Resource structure: design the API resource tree for /users, /products, /orders, /payments, /notifications with proper HTTP methods and path parameters. 3) Integration: configure Lambda Proxy integration with Lambda — show request/response mapping templates for inject auth context into the request and reshape errors into a consistent envelope. 4) Authorization: set up Cognito User Pools with JWT with scopes for read:orders, write:orders, admin:users. 5) Throttling and quotas: configure account-level and stage-level throttle of 10,000 req/s burst, 5,000 req/s steady state, create usage plans with API keys for free (100 req/day), pro (10k req/day), partner (unlimited). 6) Request validation: add request validators for body, query parameters, and headers to reject invalid requests before they reach Lambda. 7) CORS: configure proper CORS headers for https://app.example.com and https://staging.example.com including preflight handling. 8) Custom domain: set up api.example.com with base path mappings for API versioning.

What this prompt does

This prompt makes the AI configure AWS API Gateway for a [api_purpose] API with [endpoint_count] Lambda-backed endpoints. It compares REST versus HTTP API against your [api_requirements], designs the resource tree for [resources], configures [integration_type] integration with request/response mapping for [mapping_needs], sets up [auth_method] with [auth_scopes], configures throttling at [rate_limit] with usage plans and API keys for [consumer_tiers], adds request validators, configures CORS for [frontend_origins], and sets up [api_domain] with base-path mappings for versioning.

The structure works because it front-loads the decisions that are expensive to change later — REST versus HTTP API, and how usage plans are structured — before consumers are live. Request validation at the gateway rejects malformed requests before they ever reach Lambda, saving invocations. Tiered usage plans for [consumer_tiers] are far easier to design up front than to retrofit onto an API people already depend on. Designing the resource tree for [resources] with proper methods and path parameters from the start also means the URL structure stays stable, which is exactly the kind of thing consumers hate seeing change after they integrate.

When to use it

  • You are wiring a public API in front of Lambda where throttling and validation actually matter.
  • You need to decide REST API versus HTTP API based on real [api_requirements] like WebSocket support or usage plans.
  • You want tiered usage plans and API keys for [consumer_tiers] designed before consumers go live.
  • You need request validation at the gateway so invalid requests never reach Lambda.
  • You want consistent error reshaping and auth-context injection via mapping for [mapping_needs].
  • You need CORS configured correctly for [frontend_origins] including preflight handling.

Example output

Expect a configuration spec: a REST-vs-HTTP-API recommendation with the cost/feature trade-off, a resource tree for [resources] with methods and path parameters, [integration_type] integration details with mapping templates for [mapping_needs], an authorizer setup for [auth_method] and [auth_scopes], throttle and usage-plan definitions at [rate_limit] for [consumer_tiers], request-validator config, a CORS policy for [frontend_origins], and a custom-domain setup for [api_domain] with versioning base paths.

Pro tips

  • Decide REST versus HTTP API against real [api_requirements] first; HTTP API is cheaper and faster, but if you need usage plans or WebSocket, that constrains the choice.
  • Design [consumer_tiers] usage plans before launch — retrofitting per-key quotas onto a live API with existing consumers is genuinely painful.
  • Add request validators for body, query, and headers so malformed requests are rejected at the gateway and never burn a Lambda invocation.
  • Use mapping templates for [mapping_needs] to inject auth context and reshape errors into one consistent envelope rather than per-Lambda glue.
  • Configure CORS for the exact [frontend_origins] and handle preflight explicitly; wildcard origins on an authenticated API are a security smell.
  • Set base-path mappings on [api_domain] for versioning from the start so you can run /v1 and /v2 side by side without a new domain.
  • Apply throttling at both account and stage level using [rate_limit]; a stage-level limit protects one environment, but the account-level limit is your last line of defense against a runaway consumer.

Frequently Asked Questions

Should I use REST API or HTTP API?
The prompt compares both against your `[api_requirements]` and explains the cost/feature trade-off. HTTP API is cheaper and lower-latency, but features like usage plans, API keys, and request validation may push you toward REST API depending on what you need.
Can it reject invalid requests before they hit Lambda?
Yes — it adds request validators for body, query parameters, and headers so malformed requests are rejected at the gateway. That saves Lambda invocations and keeps obviously bad input out of your function code entirely.
Does it support tiered access with API keys?
It creates usage plans with API keys for `[consumer_tiers]` such as free, pro, and partner, each with its own quota and throttle. Designing these before launch matters because retrofitting per-key quotas onto a live API with existing consumers is difficult.
How does it handle CORS for my frontend?
It configures CORS headers for `[frontend_origins]` including preflight (OPTIONS) handling. Specifying exact origins rather than a wildcard is important on an authenticated API, since a wildcard origin combined with credentials is a security risk.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in AWS & Cloud Architecture Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

AI assistant · trained on my work

👋

Hey there!

Quick Actions

WhatsApp Direct line to me

Chat on WhatsApp

+880 1723 741224 · Replies within the hour on working days

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

mejba.13@gmail.com

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support