Deploy web application with Lambda, API Gateway and DynamoDB | AWS Serverless Services

Utkarsh GuptaUtkarsh Gupta
3 min read

In this post, I am going to build a serverless REST API using API Gateway, AWS Lambda, and DynamoDB.

What is Amazon API Gateway?

Amazon API Gateway is an AWS services for creating, publishing, maintaining, monitoring, and securing REST, HTTP, and WebSocket APIs at any scale. API developers can create APIs that access AWS or other web services, as well as data stored in the aws cloud.

What is the difference between GET and POST in REST API?

GET is for fetching data, appending parameters in the URL, ideal for searches. POST, used for updates, sends data securely in the request body, perfect for forms.

Steps

  1. Creating IAM Role for lambda

  2. Create a Lambda Function

  3. Creating an Amazon DynamoDB table

  4. Creating an AWS API gateway in REST API

  5. Integrating API endpoints with Amazon API Gateway

  6. Testing

Creating IAM Role for lambda

Sign in to the AWS Management Console and open IAM.

Click on "Create role"

Add "AmazonDynamoDBFullAccess"

Create a Lambda Function

Click on "Create function" to create a new Lambda function.

Provide a name for your function and select the desired programming language, such as Python.

Leave the advanced settings as default and click "Create function" to create the Lambda function.

Add your role which you created earlier

Build Your Website

From my Github : https://github.com/gutkarsh08/aws-projects-Lambda-API-Gateway-and-DynamoDB

Download a zip file.

Click on "Upload from"

Now, code uploaded in your Lambda function code

Creating an Amazon DynamoDB table

Provide a name for your table and Partition key "email"

Creating an AWS API gateway in REST API

Now, need to create a method [GET and POST]

FOR GET

FOR POST

After creating your API, you must deploy it to make it callable by your users

To deploy an API, you create an API deployment and associate it with a stage. A stage is a logical reference to a lifecycle state of your API (for example, dev, prod, beta, v2).

API stages are identified by the API ID and stage name. They're included in the URL that you use to invoke the API. Each stage is a named reference to a deployment of the API and is made available for client applications to call.

Choose the copy icon to copy your API's resource-level invoke URL. Pasted in browser:

Now, you going to fill your information. Then, Click "submit"

Whenever we submitting your information the data it's storing in the backend Dynamodb table.

0
Subscribe to my newsletter

Read articles from Utkarsh Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Utkarsh Gupta
Utkarsh Gupta

๐Ÿš€ Hi everyone! I'm Utkarsh Gupta, IAM Consultant. I am very passionate for all things DevOps. Right now, I'm learning and working on some cool projects and I can't wait to share what I'm learning with you all! ๐Ÿ› ๏ธ Here's what's in my toolbox: Linux Docker Kubernetes Jenkins AWS Python Prometheus Grafana Ansible Terraform Join me as we explore AWS DevOps together. Let's learn and grow together in this ever-changing field! ๐Ÿค Feel free to connect with me for: Sharing experiences Friendly chats Learning together Follow my journey on Hashnode and LinkedIn for daily updates. Let's dive into the world of DevOps together! ๐Ÿš€ #DevOps #AWS #DevOpsJourney #90DaysOfDevOps