AWS - Deploy Function
The sls deploy function command deploys an individual function without AWS CloudFormation. This command simply swaps out the zip file that your CloudFormation stack is pointing toward. This is a much faster way of deploying changes in code.
serverless deploy function -f functionName
Note: This command now deploys both function configuration and code by
default. Just as before, this puts your function in an inconsistent state that
is out of sync with your CloudFormation stack. Use this for faster development
cycles and not production deployments. A later serverless deploy does not
undo a configuration change made this way: CloudFormation changes only what
differs from the template it deployed last, and when nothing else changed,
the deploy is skipped. To put the function back, run
serverless deploy function again from the configuration you want. With
codeStorageMode: reference, this command updates the function using
Lambda-managed storage; the next serverless deploy restores reference mode.
Options
--functionor-fThe name of the function which should be deployed--stageor-sThe stage in your service that you want to deploy to.--regionor-rThe region in that stage that you want to deploy to.--aws-profileThe AWS profile you want to use.--update-configor-uPushes ONLY Lambda-level configuration changes e.g. handler, timeout or memorySize
Examples
Deployment without stage and region options
serverless deploy function --function helloWorld
Deployment with stage and region options
serverless deploy function --function helloWorld \
--stage dev \
--region us-east-1
Deploy only configuration changes
serverless deploy function --function helloWorld --update-config