Giter Club home page Giter Club logo

cookie-shop-serverless's Introduction

cookie-shop-serverless

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.

Prerequisites:

  1. Signup for an AWS account
  2. Fork this project into your GitHub account
  3. Python 3.9
  4. Postman
  5. Set up a virtual environment
  6. Install dependancies
    • boto3
    • aws-dynamodb-parser
    • coverage

Activity:

  1. Run unit tests coverage run --branch --source='.' -m unittest and coverage with coverage report -m --fail-under=100 --omit=*/__init__.py,tests/*,cookie-shop-env/*
  2. Run the setup-template.yaml in AWS Cloudformation
    • Give the S3 bucket a globally unique name (line 78)
    • If this fails it is most likely because Cloudformation cannot setup CodeBuild projects without first connecting to Github through OAuth. You should create a dummy CodeBuild project and connect to Github.
    • Explore the created resources in AWS - S3, IAM, CodeBuild, SSM
  3. Create a PR in the repo
    • This build will use buildspec-dev.yaml and should create a new Cloudformation stack (dev) and create all the resources for us. Note this will be a seperate stack for each PR.
    • Explore the created resources in AWS - Dynamo, Lambda, API Gateway, etc.
  4. Use the API's
    • Go to API Gateway -> Stages -> Prod and get the Invoke URL
    • Use swagger to figure out what to send the API, then postman to call it
    • Try the /cookies and /orders
    • Check Dynamo tables and see your things
    • When an order is placed it will update the quantity of cookies left
  5. Authentication
    • The orders endpoint is protected by IAM (AWS sigv4)
    • To use, go to the IAM User created, create an access key and secret, then add to the request

cookie-shop-serverless's People

Contributors

danpudwelluk 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.