GithubHelp home page GithubHelp logo

kamran-saeed / comparing-serverless-and-sam Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sanderknape/comparing-serverless-and-sam

0.0 1.0 0.0 5 KB

Repository with a serverless application deployed through both the Serverless framework and AWS SAM

JavaScript 100.00%

comparing-serverless-and-sam's Introduction

Comparing the Serverless framework with AWS SAM

This repository contains both a Serverless and a SAM infrastructure template for generating the following infrastructure:

Serverless S3 upload architecture

The full setup is explained in my blog post: Comparing AWS SAM with Serverless framework.

Installation

Make sure you have configured AWS credentials for your account. These credentials must have the permissions to create the resources defined in the stacks.

Please note that all Lambda function assume to be ran in the eu-west-1 region. You must change the NodeJS code to reflect the correct region. Find the following line:

aws.config.update({region: 'eu-west-1'});

Serverless

Deploy the serverless.yaml file through the following steps;

  1. If required, change the region to the region you wish to use (line 7)
  2. Replace unique_bucket_name and your_email_address with proper values. The bucket shouldn't yet exist. Your e-mail adress is used to attach it to an SNS topic.
  3. Run serverless deploy -v. This will generate a CloudFormation stack that is deployed to your AWS account. You will receive an e-mail that you are now subscribed to an SNS topic.

Run serverless remove to destroy the stack.

Serverless Application Model (SAM)

Deploy the template.yaml file through the following steps:

  1. Create a new S3 bucket in your AWS account. This is used to upload the CloudFormation and Lambda artifacts to by SAM.
  2. Replace your_email_address with your e-mail address. This is used to attach it to an SNS topic.
  3. Run the following command to generate the CloudFormation: sam package --template-file template.yaml --s3-bucket [your_s3_bucket]ย --output-template-file package.yaml. Replace your_s3_bucket with the name of the bucket you just created.
  4. Run the following command to deploy the generated stack: sam deploy --template-file package.yaml --stack-name serverless-application --capabilities CAPABILITY_IAM

Run aws cloudformation delete-stack --stack-name serverless-application to destroy the stack.

comparing-serverless-and-sam's People

Contributors

sanderknape avatar

Watchers

 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.