Kevser 4 months ago
DevOps
Serverless installation

$ npm install -g serverless


Serverless AWS Configuration

$ serverless config credentials --provider aws --key <aws-key> -secret <aws-secret-key> -profile custom-profile

Serverless Python Requirements Plugin Installation

$ serverless plugin install -n serverless-python-requirements

Serverless Lambda  Example with Python Plugin
service: python-lambda-example

provider:
  name: aws
  runtime: python3.6
  region: us-east-1
  timeout: 900
  memorySize: 1024

functions:
  hello:
    handler: handler.hello
    description: Description for python lambda
    layers:
      - <layer arn>

plugins:
  - serverless-python-requirements
custom:
  pythonRequirements:
    dockerizePip: non-linux

Serverless Deployment
$ serverless deploy

Serverless Deployment History

$ serverless deploy list

Serverless Invoke


# local
$ serverless invoke local --function functionName

#aws
$ serverless invoke --function functionName --stage dev --region us-east-1

# aws with data
$ serverless invoke --function functionName --stage dev --region us-east-1 --data "hello world"