Cloud JavaScript Software
aws AWS lambda cloud lamda function serverless serverless framework
Serverless Framework
Serverless Framework The Serverless Framework is a CLI tool that allows users to build & deploy auto-scaling, pay-per-execution, event-driven functions. Write your code, configure events to trigger your functions, then deploy & run those functions to your cloud provider via the Serverless CLI. You can create and run serverless service at the different platforms. These are aws, google cloud, azure, kubeless, spotinst, fn and cloudflare. You must decide one of these first. There are many plugins and resources in the serverless framework such as websocket, graphql, appsync, cognito, dynamodb, mongodb, appsync, bucket, tensorflow etc.- Serverless framework installed on your machine:
npm install -g serverless
- Set-up your Provider Credentials:
serverless config credentials –provider aws –key your-access-key-ıd –secret your-secret-key
or
sls config credentials –provider aws –key your-access-key-ıd –secret your-secret-key
- Create a new service:
serverless create –template aws-nodejs –path your-project-name
cd your-project-name
Available Templates :
– clojurescript-gradle
– clojure-gradle
– nodejs
– nodejs-typescript
– alexa-typescript
– nodejs-ecma-script
– python
– python3
– ruby
– provided
– kotlin-jvm-maven
– kotlin-jvm-gradle
– kotlin-nodejs-gradle
– groovy-gradle
– java-maven
– java-gradle
– scala-sbt
– csharp
– fsharp
– go
– aws-go-dep
– aws-go-mod
- Deploy the service: After make the your changes on the service.yaml
serverless deploy | sls deploy
- Cleanup: If at any point, you no longer need your service then you can remove the service from cloud
serverless remove | sls remove
1. Services : A service is like a project. It’s where you define your Lambda Functions, the events that trigger them and any infrastructure resources they require, all in a file called serverless.yml.Each service configuration is managed in the serverless.yml file. Example: Declare a Serverless service, defining functions, events, provider, plugins, database tables, cognito ect…npm install –save <custom-serverless-plugin>
Folder Structure of Serverless Project
Our serverless project start to grow in time. And for this we must determine the folder structure our serverless project. The folder structure of our serverless project is likes this.
0 Comments
Share