

Quick notes to use the serverless framework to deploy a Node project on AWS
source link: https://dev.to/rounakcodes/quick-notes-to-use-the-serverless-framework-to-deploy-on-aws-3kaj
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.


Quick notes to use the serverless framework to deploy a Node project on AWS
May 18
・2 min read
Intro
serverless framework consists of an open source CLI and a hosted dashboard to provide you with full serverless application lifecycle management.
The purpose of the article is to provide you a quick configuration to get started with it.
Install serverless cli
npm i -g serverless
Configure serverless to use AWS
serverless config credentials --provider aws --key <access-key-id> --secret <secret-access-key> --profile <profileName>
If you do not wish to provide secrets in the shell, use ~/.aws/credentials
file to save credentials in the following format:
[<Enter profile name here>]
aws_access_key_id=*********
aws_secret_access_key=***************
[<Enter another profile name here>]
aws_access_key_id=*******************
aws_secret_access_key=**********************
Create a new project (nodejs)
serverless create --template aws-nodejs --path myServerlessProject
The following files are created:
handler.js
.npmignore
serverless.yml
In serverless.yml
, add profile
and region
Deploy to AWS
In a shell, runsls deploy
After every change in serverless.yml
, you must run this command to deploy the changes.
Add a S3 bucket
In serverless.yml
add:
Add a plugin
In a shell, run
npm i --save serverless-s3-sync
In serverless.yml
add:
Configure the plugin
Example configuration for s3sync
plugin
Add lambda functions
In serverless.yml
add:
Enable debug when deploying
In a shell, runSLS_DEBUG=* sls deploy
Example config of serverless.yml
Discussion (1)
If anyone can tell me how to insert yaml
in a dev.to
article, I will replace the images. Using code blocks in markdown for yaml code removed indentation.
Recommend
-
87
Recently, Netlify has become one of the most popular hosts in Web Development. Netlify offers an incredible variety of features like
-
52
TL;DR: Configure Next.js 8 serverless mode to generate lambdas for each page. Use Hasura GraphQL API as data layer. Deploy to Zeit Now. Instant setup. Tutorial/boilerplate :point_right:
-
19
A quick starter for a production ready Serverless Angular application on Amazon Web Services
-
11
Introduction APIs are everywhere these days as the popularity of microservices continues to increase and cloud usage s...
-
13
Introduction Released in 2015, AWS API Gateway allows developers to build and publish APIs that can be consumed by cli...
-
15
AWS SAM The AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications. It provides shorthand syntax to express functions, APIs, databases, and event source mappings. With just a few lines...
-
6
Serverless framework deploy for Java AWS Lambdas The Serverless framework ‘serverless deploy’ deploys whatever .jar you have packaged and ready to go within your source project. If you make local code changes but d...
-
7
Deploy OpenFaaS Serverless Framework on KubernetesWelcome to this guide on how to deploy OpenFaaS Serverless Framework on Kubernetes. But before we commence on the crux of this tool, I would like to explain a few concepts.Serverless is...
-
10
Using Serverless Framework to build and deploy Docker images for AWS Lambdas AWS Lambdas can be packaged and deployed using a Docker image, described in the docs
-
5
Article How to use the new OpenShift quick starts to deploy JBoss EAP
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK