LinuxCommandLibrary

serverless

Deploy serverless functions to cloud providers

TLDR

Create new service

$ serverless create --template [aws-nodejs] --name [my-service]
copy
Deploy service
$ serverless deploy
copy
Deploy single function
$ serverless deploy function -f [functionName]
copy
Invoke function
$ serverless invoke -f [functionName]
copy
View logs
$ serverless logs -f [functionName]
copy
Remove service
$ serverless remove
copy
Run locally
$ serverless invoke local -f [functionName]
copy
Print config
$ serverless print
copy

SYNOPSIS

serverless [create] [deploy] [invoke] [logs] [remove] [options]

DESCRIPTION

serverless (sls) is a framework for building serverless applications. It deploys functions to AWS Lambda, Azure Functions, Google Cloud Functions, and others.
Service configuration in serverless.yml defines functions, events, and resources. Events trigger functions from HTTP, queues, schedules, and other sources.
Deployment packages code and provisions infrastructure. CloudFormation (AWS) or equivalent handles resource creation.
Local invocation tests functions without deployment. This speeds up development iteration.
Logs stream function output from cloud providers. They show invocations, errors, and execution details.
Plugins extend functionality: custom domains, monitoring, optimization, and framework integrations.

PARAMETERS

create

Create new service.
deploy
Deploy service.
deploy function
Deploy single function.
invoke -f FUNC
Invoke function.
invoke local
Invoke locally.
logs -f FUNC
View function logs.
remove
Remove service.
package
Package without deploying.
print
Print configuration.
--template, -t TPL
Project template.
--name, -n NAME
Service name.
--stage, -s STAGE
Deployment stage.
--region, -r REGION
AWS region.
--config, -c FILE
Config file.

CONFIGURATION

serverless.yml

Main service configuration file defining functions, events, resources, plugins, and provider settings.
~/.serverlessrc
User-level configuration for tracking and telemetry preferences.
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY
AWS credentials for deployment (or configured via AWS CLI profiles).

CAVEATS

Cloud provider credentials required. Deployment creates many resources. Cold starts affect latency. Provider lock-in considerations.

HISTORY

Serverless Framework was created by Austen Collins in 2015, originally named JAWS. It pioneered serverless deployment tooling and became the most popular framework for Lambda development.

SEE ALSO

aws(1), sam(1), terraform(1), pulumi(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community