How Do You Use an Amazon API Gateway?

Problem scenario
You want to use the AWS PaaS offering for exposing an API and having it be able to scale and handle lots of users easily. How do you use Amazon API Gateway?

Solution
Overview: This is a proof-of-concept. You could use different API types (e.g., web socket APIs for persistent applications like a chat window).

Prerequisite
This assumes you have a working Lambda function configured and you know its name.

Procedures

  1. Log into the AWS Console.
  2. Go here: https://console.aws.amazon.com/apigateway/main/
  3. Go to HTTP API and click on "Build".
  4. For "Integrations", choose "Lambda". Find your desired lambda for the "Lambda function" drop-down menu.
  5. For "API name", enter whatever name you want. Click "Next".
  6. For "Configure routes", you may want to accept the defaults and click "Next".
  7. For "Define stages", you may want to keep the defaults and click "Next".
  8. Review and click "Create".
  9. Copy the "Invoke URL" hyperlink.
  10. Copy it into a Notepad or text edit (e.g., https://abcd1234.execute-aps.us-west-2.amazonaws.com/ ). Append the Lambda's name to this URL (e.g., append "foobar" to the URL).
  11. Open a web browser and go to the URL that you constructed in step #10. (The output in the browser should match what happens when you test the Lambada via the "Test" tab's "Invoke" button. When you click "Invoke" in the web console, that should show you a result in the AWS Console; you may need to expand "Details" to see it completely.)

Leave a comment

Your email address will not be published. Required fields are marked *