Create API Gateway

Create API Gateway

In this step, you will create a REST API using Amazon API Gateway, connect it to the Lambda function created in the previous step, and then deploy it to expose a public endpoint.

Objectives:

  • Create a REST API using API Gateway
  • Integrate the Lambda function as the backend
  • Configure the method and resource path
  • Deploy the API to a public endpoint

Steps to follow:

  1. Access API Gateway
  1. Create a new API:
  • Click the “Create API” button

apigateway

  • Choose the API type:

    • Select REST API (Build)
    • Click Build

apigateway

  • In API details, choose New API
  • Enter a name for your API -Example: Visitor

apigateway

  • Click Create API

apigateway

  • Click Create Method to add methods to the API
    • Select the GET method
    • Choose the Lambda function you created earlier as the integration target

apigateway

  • Click Create to finish apigateway
  1. Deloy API
  • Click Deploy API, then configure as follows:

apigateway

  • Click Deloy.
  1. Test if the API is working
  • Copy the Invoke URL of the newly deployed API apigateway

  • Paste it into a new browser tab and press Enter:

apigateway

  • Go to DynamoDB to verify if the API is functioning correctly. If successful, you should see new data added to the database.

apigateway

In the next section, we will begin monitoring and observing our APIs through CloudWatch.