All Projects โ†’ msfidelis โ†’ Serverless Architecture Boilerplate

msfidelis / Serverless Architecture Boilerplate

Licence: mit
๐Ÿ“ฆ โšก๏ธ ๐Ÿš€ Boilerplate to organize and deploy big projects using AWS API Gateway and AWS Lambda with Serverless Framework

Programming Languages

javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Serverless Architecture Boilerplate

Ng Toolkit
โญ๏ธ Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more
Stars: โœญ 1,116 (+314.87%)
Mutual labels:  aws, serverless, aws-lambda, boilerplate
Terraform Aws Lambda
Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless combinations
Stars: โœญ 190 (-29.37%)
Mutual labels:  aws, serverless, aws-lambda
Aws Lambda Typescript
This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, publish it through API Gateway to a custom domain registered on Route53, and document it with Swagger.
Stars: โœญ 228 (-15.24%)
Mutual labels:  aws, serverless, aws-lambda
Rust Crowbar
Wrapper to simplify writing AWS Lambda functions in Rust (using the Python execution environment)
Stars: โœญ 198 (-26.39%)
Mutual labels:  aws, serverless, aws-lambda
Aws Lambda Haskell Runtime
โšกHaskell runtime for AWS Lambda
Stars: โœญ 223 (-17.1%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Chrome
๐ŸŒ Run headless Chrome/Chromium on AWS Lambda
Stars: โœญ 2,625 (+875.84%)
Mutual labels:  aws, serverless, aws-lambda
Aws Lambda Power Tuning
AWS Lambda Power Tuning is an open-source tool that can help you visualize and fine-tune the memory/power configuration of Lambda functions. It runs in your own AWS account - powered by AWS Step Functions - and it supports three optimization strategies: cost, speed, and balanced.
Stars: โœญ 3,040 (+1030.11%)
Mutual labels:  aws, serverless, aws-lambda
Serverlessish
Run the same Docker images in AWS Lambda and AWS ECS
Stars: โœญ 177 (-34.2%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Haskell
Deploying Haskell applications to AWS Lambda with Serverless
Stars: โœญ 204 (-24.16%)
Mutual labels:  aws, serverless, aws-lambda
Retinal
๐Ÿ™ Retinal is a Serverless AWS Lambda service for resizing images on-demand or event-triggered
Stars: โœญ 208 (-22.68%)
Mutual labels:  aws, serverless, aws-lambda
Serverlessbydesign
A visual approach to serverless development. Think. Build. Repeat.
Stars: โœญ 254 (-5.58%)
Mutual labels:  aws, serverless, aws-lambda
Components
The Serverless Framework's new infrastructure provisioning technology โ€” Build, compose, & deploy serverless apps in seconds...
Stars: โœญ 2,259 (+739.78%)
Mutual labels:  aws, serverless, aws-lambda
Middy
๐Ÿ›ต The stylish Node.js middleware engine for AWS Lambda
Stars: โœญ 2,592 (+863.57%)
Mutual labels:  aws, serverless, aws-lambda
Algnhsa
AWS Lambda Go net/http server adapter
Stars: โœญ 226 (-15.99%)
Mutual labels:  aws, serverless, aws-lambda
Chrome Aws Lambda
Chromium Binary for AWS Lambda and Google Cloud Functions
Stars: โœญ 2,502 (+830.11%)
Mutual labels:  aws, serverless, aws-lambda
Aws Cdk Changelogs Demo
This is a demo application that uses modern serverless architecture to crawl changelogs from open source projects, parse them, and provide an API and website for viewing them.
Stars: โœญ 197 (-26.77%)
Mutual labels:  aws, serverless, aws-lambda
Laconia
Create well-crafted serverless applications, effortlessly
Stars: โœญ 260 (-3.35%)
Mutual labels:  aws, serverless, aws-lambda
Cartoonify
Deploy and scale serverless machine learning app - in 4 steps.
Stars: โœญ 157 (-41.64%)
Mutual labels:  aws, serverless, aws-lambda
Serverless Aws Alias
Alias support for Serverless 1.x
Stars: โœญ 171 (-36.43%)
Mutual labels:  aws, serverless, aws-lambda
Dialetus Service
API to Informal dictionary for the idiomatic expressions that each Brazilian region It has
Stars: โœญ 202 (-24.91%)
Mutual labels:  aws, serverless, aws-lambda

Logo

Serverless Architecture Boilerplate serverless License: MIT Build Status

CI / CD Pipeline

Need a Codepipeline Structure to deploy your Serverless Project with Quality? See this repo!

Serverless Archictecture Boilerplate with Go?

Looking for boilerplates to organize big projects using AWS Lambda with Go? See this repo

Structure

.
โ”œโ”€โ”€ modules (modules folder)
โ”‚   โ””โ”€โ”€ books (module / context)
โ”‚       โ”œโ”€โ”€ endpoints (API endpoints)
โ”‚       โ”‚   โ”œโ”€โ”€ create.js
โ”‚       โ”‚   โ”œโ”€โ”€ delete.js
โ”‚       โ”‚   โ”œโ”€โ”€ read.js
โ”‚       โ”‚   โ””โ”€โ”€ update.js
โ”‚       โ””โ”€โ”€ functions (workers / background functions)
โ”‚           โ””โ”€โ”€ worker
โ”‚               โ””โ”€โ”€ handler.js
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ serverless.yml (serverless config)
โ”œโ”€โ”€ handlers (functions config)
โ”‚   โ”œโ”€โ”€ books-endpoints.yml (endpoints config)
โ”‚   โ””โ”€โ”€ books-workers.yml (workers config)
โ”œโ”€โ”€ shared (shared components)
โ”‚   โ””โ”€โ”€ lib (shared libraries)
โ”‚       โ”œโ”€โ”€ dynamo.js
โ”‚       โ”œโ”€โ”€ kinesis.js
โ”‚       โ”œโ”€โ”€ lambda.js
โ”‚       โ”œโ”€โ”€ parsers.js
โ”‚       โ”œโ”€โ”€ sqs.js
โ”‚       โ””โ”€โ”€ uuid.js
โ””โ”€โ”€ test (tests folder)
    โ””โ”€โ”€ unit (unit tests folder)
        โ”œโ”€โ”€ modules (unit tests for modules)
        โ”‚   โ””โ”€โ”€ books
        โ””โ”€โ”€ shared (unit tests for shared components)
            โ””โ”€โ”€ lib (unit tests for libraries)
                โ”œโ”€โ”€ dynamo.test.js
                โ”œโ”€โ”€ kinesis.test.js
                โ”œโ”€โ”€ parsers.test.js
                โ”œโ”€โ”€ sqs.test.js
                โ””โ”€โ”€ uuid.test.js

Functions

HTTP Trigger Function (API Gateway)

functions:

  # API Endpoints
  books-register:
    handler: modules/books/endpoints/create.create #Path to function
    memorySize: 128 # Lambda Memory Limit
    timeout: 60 # Lambda Timeout
    events: 
      - http: # HTTP Trigger 
          path: services/books # API Endpoint
          method: post # HTTP Method

Cloudwatch Events Functions (Cron)

Lambda Schedule Docs

# Background Function
  books-consumer:
    handler: modules/books/functions/worker/handler.worker #Path to function
    events:
      - schedule: #Cloudwatch Event Trigger
        rate: cron(* * * * * *) # Cron Syntax 
        enabled: true # Trigger Enabled

Development environment

This boilerplate uses serverless-local plugin and some containers and plugins to emulate the AWS Resources

docker-compose up

The applications will start on http://localhost:3000

Dev Plugins

This boilerplate contains following plugins for local development:

Production environment

Deploy full services

serverless deploy -v

asciicast

Deploy a function

serverless deploy function -f books-consumer

Get function logs

serverless books-consumer -f bananinha -t

Clean All

serverless remove

Testing

Create Book

curl -X POST \
    -H "Content-Type: application/json" \
    -d '{"title": "American Gods", "author": "Neil Gaiman", "price": 10.00  }' \
    https://yur25zhqo0.execute-api.us-east-1.amazonaws.com/production/services/books -i

List Books

curl -X GET \
    https://yur25zhqo0.execute-api.us-east-1.amazonaws.com/production/services/books

asciicast

Detail Book

curl -X GET \
    https://yur25zhqo0.execute-api.us-east-1.amazonaws.com/production/services/books/456c9e8f-6c50-d656-dc69-dc828c42af65

Delete Book

curl -X DELETE \
    https://yur25zhqo0.execute-api.us-east-1.amazonaws.com/production/services/books/456c9e8f-6c50-d656-dc69-dc828c42af65 -i 

Update Book

curl -X PUT \
    -d '{"title": "updated modafoca"}' -H "Content-type: application/json" \
    https://eusrv4mci5.execute-api.us-east-1.amazonaws.com/production/services/books/bbafdb0c-ee6e-fca0-f224-ed534f5b7766 -i

asciicast

Custom and Environment Variables

Custom Items

Creating and Using custom variables to build dynamic name

custom:
  region: ${self:provider.region} 
  stage: ${opt:stage, self:provider.stage}
  prefix: ${self:custom.stage}-${self:service}
  process: ${self:custom.prefix}-process
  config: ${self:custom.prefix}-config
  dynamo-books: ${self:custom.prefix}-BooksCatalog
  sns-logs: ${self:custom.prefix}-trigger-logs 
  sqs-logs: ${self:custom.prefix}-messages-logs

Environment Variables

Building URL Resources using CloudFormation parameters and Custom Variables

  environment: # Global Environment variables
    DYNAMO_TABLE_BOOKS: ${self:custom.dynamo-books} # Reference to Custom Env
    SQS_QUEUE_URL: 'https://sqs.${self:provider.region}.amazonaws.com/#{AWS::AccountId}/${self:custom.sqs-logs}'
    REGION: ${self:custom.region}

Manage AWS Cloudformation with Serverless

IAM Roles

IAM Docs

  iamRoleStatements: # Permissions for all of your functions can be set here

  - Effect: Allow
    Action: # Gives permission to DynamoDB tables in a specific region
      - dynamodb:DescribeTable
      - dynamodb:Query
      - dynamodb:Scan
      - dynamodb:GetItem
      - dynamodb:PutItem
      - dynamodb:UpdateItem
      - dynamodb:DeleteItem
    Resource: "arn:aws:dynamodb:us-east-1:*:*"

  - Effect: Allow
    Action: # Gives permission to Lambda execution
      - lambda:InvokeFunction
      - lambda:InvokeAsync
    Resource: "*"

Manage Infrastructure Components - Docs

# Infrastrucure - Cloud Formation
resources:  # CloudFormation template syntax

  Resources:
    #DynamoDB Books Table
    BooksCatalog:
      Type: AWS::DynamoDB::Table # CloudFormation Pseudo Parameter Example
      Properties:
        TableName: ${self:custom.dynamo-books}
        AttributeDefinitions:
          - AttributeName: hashkey
            AttributeType: S
        KeySchema:
          - AttributeName: hashkey
            KeyType: HASH
        ProvisionedThroughput:
          ReadCapacityUnits: 2
          WriteCapacityUnits: 1

    # SQS Queue to Update DynamoDB
    BooksQueueExample:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: ${self:custom.sqs-logs}
        MessageRetentionPeriod: 1209600
        VisibilityTimeout: 60
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].