Recommendations and best practices
To start off, here are a few simple recommendations when it comes to working with the Serverless Framework:
- Use
sls deploy <functioname>
: Although seemingly straight forward,sls deploy
andsls deploy <function_name>
have a lot of difference between them and knowing what command to use when can significantly improve the time it takes to deploy your applications. For starters, running thesls deploy
command redeploys the entire CloudFormation stack from the ground up, so each time you run this command, CloudFormation will tend to go through the entire resource list for your application. This can be time-consuming if you have a complex application using a lot of AWS resources. On the other hand,sls deploy <function-name>
simply packages and uploads your code to a new Lambda function without changing any of the other AWS resources. - Test your functions: Although repeated in quite a few chapters, testing your functions before deploying them...