GithubHelp home page GithubHelp logo

mihaibogdaneugen / how-to-serverless-with-aws-part1 Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 274 KB

How to Serverless with AWS - Part 1

License: Apache License 2.0

Java 71.76% Makefile 10.30% Python 15.11% JavaScript 2.83%
amazon-corretto jdk11 python38 lambda dynamo s3 api-gateway amazon

how-to-serverless-with-aws-part1's Introduction

How to Serverless with AWS - Part 1

This is Part 1 in a series of 3 workshops on how to build Serverless applications using AWS Technologies

Part 2

Part 3

Prerequisites

Introduction

Movies is a fictional application used for the management of movies.

Data Models

Movie Info

Property Type
movie_id String
name String
country_of_origin String
release_date String

Movie Rating

Property Type
movie_id String
rotten_tomatoes_rating Number
imdb_rating Number

Data Flows

  • batch ingestion: periodically, a new file is uploaded to the S3 bucket, containing all Movie Info objects
  • single update: occasionally, ratings (a Movie Rating object) are updated
  • data retrieval: frequently, a full Movie model is retrieved

Architecture

Movies Architecture

AWS Technologies

  • Serverless, event-driven, stateless compute workloads
  • Lightweight, limited execution time, resource-bound
  • Works best as "glue" between other stateless AWS services
  • Highly performant, Key-Value and Document NoSQL Data Store
  • Serverless, automatically scalable
  • Supports ACID transactions
  • Simple and secure object storage
  • Serverless & stateless
  • Object management supports event notifications
  • Basic API Gateway, translates events from "web" protocols (HTTP, WebSockets, etc.) into AWS events
  • Fully managed service

Others

  • AWS IAM - secures access to AWS services and resources
  • AWS CloudWatch - logging and monitoring for AWS services
  • AWS X-Ray - tracing for AWS services

Action Plan

  1. Create the DynamoDB tables, note down their names
  2. Create the S3 buckets, note down their name
  3. Create the IAM Policies using the values from 1. and 2.
  4. Create the IAM Roles for lambda.amazonaws.com trusted entities, using the previously defined policies
  5. Package the AWS Lambdas into zip archives using the package make target
  6. Create AWS Lambdas used the packages generated at 5., the roles defined at 4.
  7. Configure AWS Lambdas with proper environment variables, memory settings and tracing
  8. Create an API Gateway
  9. Add required resources for route movies/{movieId}
  10. Add get method with AWS Lambda Proxy integration for specific lambda
  11. Add patch method with AWS Lambda Proxy integration for specific lambda
  12. Create a deployment for the API Gateway
  13. Add S3 bucket integration for specific lambda

Test

  • Generate input test file:
cat movie-infos.csv
mv1,Interstellar,United States,2014-10-26
mv2,The Dark Knight Rises,United States,2012-07-16
mv3,The Prestige,United Kingdom,2006-10-17
  • Upload file to S3 bucket
aws s3 cp ~/movie-infos.csv s3://${bucket_name}
  • Send PATCH request
curl --request PATCH \
  --url ${API_GW_DEPLOYMENT_URI}/movies/mv1 \
  --header 'content-type: application/json' \
  --data '{
	"movie_id": "mv1",
	"rotten_tomatoes_rating": 98,
	"imdb_rating": 43
}'
  • Send GET request, verify results
curl --request GET \
  --url ${API_GW_DEPLOYMENT_URI}/movies/mv1

how-to-serverless-with-aws-part1's People

Contributors

mihaibogdaneugen avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

wilq87

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.