Deploy Simple Web Applications in AWS Lambda

   Go back to the Task List

  « 4: Create Lambda Function    6: Test Web Application »

5: Create API Gateway

In this step, you configure REST API in API Gateway which calls Lambda function as the backend. The URL of the API becomes the URL of the web application.

  1. In the API Gateway Console, click on the Build button for the REST API.

    API Gateway

  2. On the next screen, select REST for the protocol and select New API option. Type in dojowebapi for the API Name and select Regional for the endpoint type. Finally, click on the Create API button.

    API Gateway

  3. The API is created in no time. On the next screen, click on the Create Method option under the Action menu.

    API Gateway

  4. On the next screen, select GET as the method and click on the confirmation icon.

    API Gateway

  5. The method is created in no time. On the next screen, select Lambda Function option for the integration type. Select Use Lambda Proxy integration option. Select dojowebfunction for the Lambda Function. Keep rest of the configuration to the default and click on the Save button.

    API Gateway

  6. It will throw a popup asking API Gateway permission to call the Lambda function. Click on the OK button.

    API Gateway

  7. The GET method is updated. You repeat the same steps to create a POST method as well. Click on the Create Method option under the Action menu.

    API Gateway

  8. On the next screen, select POST as the method and click on the confirmation icon.

    API Gateway

  9. The method is created in no time. On the next screen, select Lambda Function option for the integration type. Select Use Lambda Proxy integration option. Select dojowebfunction for the Lambda Function. Keep rest of the configuration to the default and click on the Save button.

    API Gateway

  10. It will throw a popup asking API Gateway permission to call the Lambda function. Click on the OK button.

    API Gateway

  11. The POST method is updated. Go back to the API details and click on the Deploy API option under the Action menu.

    API Gateway

  12. It will throw popup to configure the deployment stage. Select [New Stage] as the deployment stage. Type in dev for the stage name and click on the Deploy button.

    API Gateway

  13. The API is deployed to the dev stage. Make note of the Invoke URL. You will need it later when testing the API.

    API Gateway

  14. The API is deployed and ready. It will render the web application. Let’s test it in the next step.