Code Monkey home page Code Monkey logo

awsserverlessmicroservicewithlambda's Introduction

AWS Serverless Microservice With Lambda Application

This project is a simple serverless microservice on AWS that enables users to create and manage movies data. The entire backend is based on API Gateway, Lambda and DynamoDB. To manage, document and visualize all APIs in one place, SwaggerHub is used.

SwaggerHub UI

Overview

The goal of this project is to show how to create an application composed of small, easily deployable, loosely coupled, independently scalable, serverless components.

As I’m strongly against managing environments manually and take Infrastructure as Code πŸ’™ for granted, AWS SAM will be a great fit for this serverless project. As a result, the entire application should be deployed in any AWS account with a single CloudFormation template.

Architecture

1️⃣ A user sends a request to the server by calling APIs from SwaggerHub UI. The request which includes all necessary information is sent to Amazon API Gateway restful service.

2️⃣ API Gateway transfers the collected user information to a Lambda function.

3️⃣ AWS Lambda function executes event-based logic calling DynamoDB database.

4️⃣ DynamoDB provides a persistence layer where data can be stored/retrieved by the API's Lambda function.

The high-level architecture for the serverless microservice is illustrated in the diagram below:

Architecture

Initial Setup

To codify, build, package, deploy, and manage our AWS resources in a fully automated fashion, use the following:

πŸ‘‰ AWS SAM

πŸ‘‰ AWS Cloud​Formation

πŸ‘‰ AWS CLI

πŸ‘‰ AWS SDK for Python (boto3)

πŸ‘‰ Docker

If you don't want to install or maintain a local IDE, use AWS Cloud9 instead (you can find how to set up AWS Cloud9 here). Otherwise you might need to install the latest AWS CLI, AWS SAM and Python on your development machine.

AWS Resources

Here is the list of AWS resources that the project template creates:

βœ”οΈ AWS Lambda

βœ”οΈ Amazon DynamoDB

βœ”οΈ Amazon API Gateway

βœ”οΈ AWS IAM

βœ”οΈ Amazon S3 (that is where your CloudFormation template will be stored)

Lambda functions are written on Python 3.8.

Demo

SwaggerHub

πŸŽ‰ Create a new movie:

CreateMovie

CreateMovie

πŸŽ‰ Get a list of all movies:

GetMovies

GetMovies

πŸŽ‰ Get a movie by uuid:

GetMovie

GetMovie

πŸŽ‰ Delete a movie by uuid:

DeleteMovie

DeleteMovie

πŸŽ‰ Update an existing movie:

UpdateMovie

UpdateMovie

UpdateMovie

A detailed explanation

You can find all the details of the project by reading my articles on dev.to:

πŸ‘‰ AWS project - Building a serverless microservice with Lambda (read)

πŸ‘‰ Serverless - Create, debug and deploy Lambda and API Gateway via AWS SAM and AWS Cloud9 (read)

Download the project

To clone the GitHub repository, execute the following command:

cd my-folder
git clone https://github.com/Tiamatt/AwsServerlessMicroserviceWithLambda.git

If you want to migrating a repository from GitHub into AWS CodeCommit, read this article.

Build and Deploy

To build and deploy your application for the first time, run the following in your shell:

sam build --use-container
sam deploy --guided

Cleanup

To delete the sample application that you created, use the AWS CLI:

aws cloudformation delete-stack --stack-name aws-serverless-microservice-app-stack

Happy dance

Finally, don't forget to do your happy dance!

UpdateMovie

awsserverlessmicroservicewithlambda's People

Contributors

tiamatt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.