All Projects → aws-samples → Aws Serverless Samfarm

aws-samples / Aws Serverless Samfarm

Licence: apache-2.0
This repo is full CI/CD Serverless example which was used in the What's New with AWS Lambda presentation at Re:Invent 2016.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Aws Serverless Samfarm

Node Lambda Log
Basic logging mechanism for Node 6.10+ Lambda Functions
Stars: ✭ 115 (-57.56%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Serverless Chrome
🌐 Run headless Chrome/Chromium on AWS Lambda
Stars: ✭ 2,625 (+868.63%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Serverless Layers
Serverless.js plugin that implements AWS Lambda Layers which reduces drastically lambda size, warm-up and deployment time.
Stars: ✭ 119 (-56.09%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Lambda Refarch Webapp
The Web Application reference architecture is a general-purpose, event-driven, web application back-end that uses AWS Lambda, Amazon API Gateway for its business logic. It also uses Amazon DynamoDB as its database and Amazon Cognito for user management. All static content is hosted using AWS Amplify Console.
Stars: ✭ 1,208 (+345.76%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Serverlessish
Run the same Docker images in AWS Lambda and AWS ECS
Stars: ✭ 177 (-34.69%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Aws Serverless Airline Booking
Airline Booking is a sample web application that provides Flight Search, Flight Payment, Flight Booking and Loyalty points including end-to-end testing, GraphQL and CI/CD. This web application was the theme of Build on Serverless Season 2 on AWS Twitch running from April 24th until end of August in 2019.
Stars: ✭ 1,290 (+376.01%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Aws Lambda List
A list of hopefully useful AWS lambdas and lambda-related resources.
Stars: ✭ 130 (-52.03%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+3014.02%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Serverless Next.js
⚡ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
Stars: ✭ 2,977 (+998.52%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Serverless Sam
Serverless framework plugin to export AWS SAM templates for a service
Stars: ✭ 143 (-47.23%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Serverless Node Simple Messaging
Simple email AWS lambda function
Stars: ✭ 75 (-72.32%)
Mutual labels:  aws, serverless, aws-lambda, 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 (+1021.77%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Serverless Node Simple Image Resize
Simple image resize AWS lambda function
Stars: ✭ 74 (-72.69%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Lambcycle
🐑🛵 A declarative lambda middleware with life cycle hooks 🐑🛵
Stars: ✭ 88 (-67.53%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Aws Github Actions
Deploy 🚀 to AWS ☁️ with GitHub Actions!
Stars: ✭ 70 (-74.17%)
Mutual labels:  aws, serverless, aws-lambda, ci-cd
Iopipe Js Core
Observe and develop serverless apps with confidence on AWS Lambda with Tracing, Metrics, Profiling, Monitoring, and more.
Stars: ✭ 123 (-54.61%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-81.18%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Apex
Old apex/apex
Stars: ✭ 20 (-92.62%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Spark On Lambda
Apache Spark on AWS Lambda
Stars: ✭ 137 (-49.45%)
Mutual labels:  aws, serverless, aws-lambda, lambda
Components
The Serverless Framework's new infrastructure provisioning technology — Build, compose, & deploy serverless apps in seconds...
Stars: ✭ 2,259 (+733.58%)
Mutual labels:  aws, serverless, aws-lambda, lambda

aws-serverless-samfarm

This repo contains the full code and templates needed to create a the Serverless SamFarm demo as shown in the What's New with AWS Lambda presentation at Re:Invent 2016.

There are three separate parts to this application: the api, the pipeline which detects, builds, and deploys changes, and the website. Lets start by getting that website up and running.

Step 1

Website

In the website directory there are four files:

  1. index.html: This is the index file that our S3 bucket will be displaying.
  2. app.js: The heart of our website. We will be making some changes to this in a bit, but for now we can leave it alone.
  3. squirrel.png: Our friend! SAM the squirrel.
  4. website.yaml: The CloudFormation template used to create the Amazon S3 bucket for the website.

To create the website stack.

Once the stack is complete, we will need to keep track of the S3 bucket name and the URL for the website.

Now we have all the seperate parts of our website, but lets get SAM up and running:

sh upload_website.sh <s3-bucket-name>

And visit the url you saved before. You should see something like this:

SAM Screenshot

Ta-da, a working website! SAM the squirrel may be all alone right now, but we'll fix that in a bit.

Step 2

API

The Serverless API we are building! The api directory contains five files.

  1. beta.json: The CloudFormation staging file. This will be used by CloudFormation to pass parameters to our CloudFormation template.
  2. buildspec.yml: This is used by CodeBuild in the build step of our pipeline. We will get to that later.
  3. index.js: The Lambda function code!
  4. package.json: The package.json that defines what packages we need for our Lambda function.
  5. saml.yaml: SAML my YAML! This is the SAM template file that will be used to create our API gateway resource and Lambda function, hook them up together

Create a new github repo from the api directory and place these files in there. This repo will be used for your automated CI/CD pipeline we build below.

Step 3

Pipeline

The pipeline is a full CI/CD serverless pipeline for building and deploying your api. In this example we are using CloudFormation to create the pipeline, all resources, and any permissions needed.

The following resources are created:

  • An S3 bucket to store deployment artifacts.
  • An AWS CodeBuild stage to build any changes checked into the repo.
  • The AWS CodePipeline that will watch for changes on your repo, and push these changes through to build and deployment steps.
  • All IAM roles and policies required.

The CloudFormation templates being used to create these resources can be found in pipeline directory.

To create the pipeline stack, click the launch stack button below.

Step 4

Update your website

If you have looked at the code in the website (or if you haven't, now is your chance!), you may have noticed that the website makes http requests to an api periodically to update the number of SAMs on the screen. Right now it is pointing at nothing, so lets update it to point it to brand spanking new API. In the app.js, look for the line

var GET_SAM_COUNT_URL = 'INSERT API GATEWAY URL HERE';

and update that to your API Gateway endpoint. It should be in the format:

https://<api-id>.execute-api.us-east-1.amazonaws.com/Prod/sam

Now lets update your S3 static website with this change:

sh upload_website.sh <s3-bucket-name>

Step 5

Start the party (or how I learned to stop worrying and push a change)

Now that we have our website, our code repository with our lambda function and our pipeline configured, lets see it in action. We are going to make two changes to our repository, first were going to setup our API for CORS, and second were going to update our Lambda function. Both changes will be made in the repo you created in Step 2.

CORS

Go to the beta.json file and update the following line:

"OriginUrl": "*"

to the url for the S3 static site we created. Something like:

"OriginUrl": "http://<s3-bucket-name>.s3-website-us-east-1.amazonaws.com"

Lambda Function

Go to index.js file the repo you made in Step 2 and update the line:

var samCount = 1;

to

var samCount = 15;

Commit and push the changes.

Go back to the pipeline we generated in Step 3, you will see AWS CodePipeline automatically pick up your change, and start the build and deploy process. Voila! A completely version controlled, serverless, CI/CD solution to give a squirrel a few friends. Technology!

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