Skip to content

Instantly share code, notes, and snippets.

@buonzz
Last active February 18, 2024 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buonzz/df7f140a832d20bc0b19164be50e41c1 to your computer and use it in GitHub Desktop.
Save buonzz/df7f140a832d20bc0b19164be50e41c1 to your computer and use it in GitHub Desktop.
AWS API Gateway

REST vs HTTP API

Choose REST APIs if you need features such as API keys, per-client throttling, request validation, AWS WAF integration, or private API endpoints. Choose HTTP APIs if you don't need the features included with REST APIs

HTTP Proxy Integrations w/ API key

  • Create new resource: method is ANY resource with {proxy+} as path
  • In method details, choose HTTP
  • in http method: ANY
  • in Endpoint URL: https://yourapi.example.com/path/{proxy} note that you cannot use root path here /, it has to be some subpath
  • ensure "HTTP proxy integration" is checked
  • click Save
  • Deploy the API, create a new stage called "prod"
  • Go to "Usage plans" in the sidebar
  • create a new plan called "Free". enter the Rate, Burst, Requests to your liking
  • Click the new plan you created, and go to "Associated Stages" tab, add the "prod" stage you created earlier
  • Go back to your API, and edit /{proxy+}/ANY method request. Ensure API key required is checked
  • Go to "Api Keys" in the sidebar. click "Create API Key"
  • For your new API key, click "Add to Usage Plan", choose the "Free" Plan

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment