This is an example project for Serverless in AWS
We will be using SAM (https://github.com/awslabs/serverless-application-model)
Most services will be using the free tier so costs should be very minimal.
- Signup for an AWS account
- Fork this project into your GitHub account
- Python 3.7
- Postman
- Run
source cookie-shop-env/bin/activate
- Run unit tests
coverage run --branch --source='.' -m unittest
and coverage withcoverage report -m --fail-under=100 --omit=*/__init__.py,tests/*,cookie-shop-env/*
- Run the setup-template.yaml in AWS Cloudformation
- Create a CodeBuild project
- Connect your GitHub fork
- This sets up our CI/CD pipeline
- Run the build
- This build should create a new Cloudformation stack and create all the resources for us
- Explore the created resources in AWS - Dynamo, Lambda, API Gateway, IAM
- Add a stream to our Orders DynamoDB
- Uncomment the stream stuff in template.yaml
- When an order is placed it will now update the quantity of cookies left
- Run unit tests and coverage again
- Add authentication
- Uncomment the authentication stuff in template.yaml and swagger.yaml
- The orders endpoint is now protected by IAM (AWS sigv4)
- To use, go to IAM User, create an access key and secret, then add to the request