Giter Site home page Giter Site logo

serverless-aws-alias-example's Introduction

Serverless test project

This project uses some central functionality of Serverless and shows how the alias plugin works.

You can deploy the available branches master and warmup-apig to different aliases. The branches have different configurations:

master

Simple Lambda function + DynamoDB table + DynamoDB event source

warmup-apig

The warmup branch simulates feature development in a project perspective as well as developer changes in the Serverless configuration.

The DynamoDB is removed in this branch, APIG endpoints are added and the warmup plugin has been added to serverless yml.

This branch can be deployed to a separate alias without destroying anything that is deployed on master. Branch development in master and warmup can even get more different over time.

sns-topic

This branch adds a SNS subscription event to one of the functions. It shows how the alias plugin will handle these when deployed to different aliases.

authorizer

This branch deploys a custom authorizer and attaches it to the func1 GET method. You can call GET https://XXXXXXXXX.execute-api.us-east-1.amazonaws.com/auth/func1 with an Authorization header set to an arbitrary value. The function will echo the incoming event object, that contains the results of the authorizer under requestContext.authorizer.

Deploying the system

Checkout the master branch and deploy the stage without specifying an alias (i.e. the branch gets deployed into the master/stage alias dev).

git checkout master
npm install
node ./node_modules/serverless/bin/serverless deploy

Checkout the warmup branch and deploy it to a different alias

git checkout warmup-apig
npm install
node ./node_modules/serverless/bin/serverless deploy --alias=warmup
git checkout sns-topic
npm install
node ./node_modules/serverless/bin/serverless deploy --alias=sns

Afterwards you will have everything deployed in your AWS account. The functions for the different aliases are labeled (aliased) with the alias name. See the documentation of the alias plugin for details.

Attention: The project will create resources in your AWS account. These will generate costs. You should delete the created resources (CF stacks) if you do not need them anymore.

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.