You are currently viewing How to create an API Gateway with lambda integration using AWS CLI?

How to create an API Gateway with lambda integration using AWS CLI?

How to create an API Gateway with lambda integration using AWS CLI?

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In today’s blog post, we will discuss how to create an HTTP API Gateway with lambda integration using AWS CLI with example.

We will first create a lambda function and DynamoDB table that will serve as the backend for your REST API and then create an Amazon HTTP API Gateway that routes your REST API methods to the Lambda function which provides a CRUD (GET, POST/PUT, DELETE) functionality using the DynamoDB table.

How to create an API Gateway with lambda integration using AWS CLI?

Note: This is intended for a demo, do not share the API endpoint to anyone as we have not added any authentication to this public API endpoint and anyone who has or can guess the endpoint URL will be able to interact with the API.

How to create an API Gateway with lambda integration using AWS CLI?

Prerequisites:

AWS CLI installed and configured with proper access. You can use below link to install and configure AWS CLI.

https://cloudaffaire.com/how-to-install-aws-cli/

https://cloudaffaire.com/how-to-configure-aws-cli/

Step 1: Create a DynamoDB table that stores the persistent data for your REST API.

Step 2: Create a lambda function that will serve as the backend for your HTTP API endpoint.

Step 3: Create a new AWS HTTP API Gateway using AWS CLI.

If everything goes right, you should have a new API Gateway endpoint ready to serve your REST API.

How to create an API Gateway with lambda integration using AWS CLI?

How to create an API Gateway with lambda integration using AWS CLI?

Next, we will test our API Gateway with some GET/PUT/DELETE REST API call.

Step 4: Make some API call to AWS API Gateway endpoint.

Step 5: Clean-up

Hope you have enjoyed this article. We will explore each of these components in upcoming blogs. Please find below links for additional reference

https://docs.aws.amazon.com/apigateway/index.html

https://cloudaffaire.com/category/devops/rest-api/

This Post Has 2 Comments

  1. Avatar
    David

    it is posible to integrate with SQS directly from apigateway?

  2. Avatar
    David

    is it posible to integrate directly from apigateway to sqs or sns?

Leave a Reply