Giter Site home page Giter Site logo

natashakss / aws-lambda-serverless-barebones Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 18 KB

A starter serverless function - Built with the Serverless Platform; Deployed to AWS Lambda

License: GNU General Public License v3.0

JavaScript 100.00%
serverless-framework aws-lambda nodejs

aws-lambda-serverless-barebones's Introduction

Barebones Serverless Function Boilerplate

A barebones serverless function; Built with the Serverless Platform on a NodeJS runtime; Deployed to AWS Lambda.

Instructions

Set up .AWS credentials on your local machine

  1. Install the AWS CLI

  2. Run aws configure. It will prompt you to provide these settings:

AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: ap-southeast-1
Default output format [None]: json

Note: Enter your preferred "default region name", for me, it's ap-southeast-1. Also, these credentials will be saved into your ~/.aws folder.


Install the Serverless CLI

Needs >= Node v4.

npm install -g serverless

Create a new service

A service on Serverless is a collection of all your AWS Lambda functions, the events that trigger them and any AWS infrastructure resources they need. These settings are specified in a file called serverless.yml.

  1. Create a new service from a variety of templates by running
# Choose a template
serverless create --template [aws-nodejs / aws-nodejs-ecma-script / aws-python3 / hello-world ...]

# View all available templates
serverless create --help
  1. Edit your serverless.yml file, or use the one included in this repository. More serverless.yml settings may be found on the official Serverless documentation site.

  2. Deploy your Service using your default AWS credentials by running

serverless deploy -v

this deploys all changes to your Functions, Events or Resources in serverless.yml


Deploying your function

Deploy your function without re-deploying your service with

serverless deploy function -f hello

Logging

Invoke and fetch function logs with

serverless invoke -f hello -l

Alternatively, if you want to do this within your AWS Lambda Management Console, navigate to "Monitoring" > "View logs in CloudWatch" > Click on a log stream.

aws-lambda-serverless-barebones's People

Contributors

natashakss avatar

Stargazers

 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.