‫So we have learned a lot on Lambda
‫in this section
‫and that was necessary going to the exam.
‫So just some final words of wisdom before we leave you.
‫So best practices.
‫You need to perform heavy duty work
‫outside of your function handler
‫to minimize the amount of time your handler will run for.
‫So that means that you need to connect your databases
‫outside of your function handler,
‫initialize the AWS SDK outside of your handler again
‫and building any dependencies or datasets,
‫again, outside of your function handler.
‫You should use environment variables
‫for anything that is going to be changing over time.
‫So your database connection strings,
‫your S3 bucket name, et cetera, et cetera.
‫Do not put these values in your code.
‫And for password and sensitive values,
‫you can encrypt these environment variables with KMS.
‫Next, you should minimize your deployment package size
‫to its runtime necessities.
‫So that means that if your function is too big,
‫please break it down.
‫Also, remember the Lamda limits
‫for your package size and so on.
‫And if you need to reuse some libraries,
‫think of leveraging Lambda layers.
‫And finally, avoid recursing code.
‫Okay, never have a Lambda function call itself.
‫That is going to be a disaster
‫and is going to be very expensive for you.
‫Okay, so that's it for this lecture.
‫I hope you liked it and I will see you in the next lecture.