This is Part 1 in a series of 3 workshops on how to build Serverless applications using AWS Technologies
- AWS Command Line Interface installed and properly set up
- access to the Amazon Console GUI
- Amazon Corretto 11
- Python 3.8.x
Movies is a fictional application used for the management of movies.
Property | Type |
---|---|
movie_id | String |
name | String |
country_of_origin | String |
release_date | String |
Property | Type |
---|---|
movie_id | String |
rotten_tomatoes_rating | Number |
imdb_rating | Number |
- 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
- 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
- AWS IAM - secures access to AWS services and resources
- AWS CloudWatch - logging and monitoring for AWS services
- AWS X-Ray - tracing for AWS services
- Create the DynamoDB tables, note down their names
- Create the S3 buckets, note down their name
- Create the IAM Policies using the values from 1. and 2.
- Create the IAM Roles for
lambda.amazonaws.com
trusted entities, using the previously defined policies - Package the AWS Lambdas into zip archives using the
package
make target - Create AWS Lambdas used the packages generated at 5., the roles defined at 4.
- Configure AWS Lambdas with proper environment variables, memory settings and tracing
- Create an API Gateway
- Add required resources for route
movies/{movieId}
- Add
get
method with AWS Lambda Proxy integration for specific lambda - Add
patch
method with AWS Lambda Proxy integration for specific lambda - Create a deployment for the API Gateway
- Add S3 bucket integration for specific lambda
- 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