Getting started with Python AWS Lamda function? - SST Guide Forums
Lambda function
End-to-End Tutorial on Combining AWS Lambda, Docker, and Python
AWS Lambda recently added support for Docker images with Python, where before you had to zip all your code and dependencies. With this update I wanted to make a full length tutorial to cover everything necessary to be productive.
The playlist is broken into six parts:
-
An introduction to the app that will be built and the various AWS components that will be used
-
Cloning the GitHub repo and doing necessary setup to test the application locally
-
Creating a Docker image of the Python script and running it on AWS Lambda, while also showing how painful it is to do even minor updates
-
Adding CI/CD with GitHub Actions to speed up code updates
-
Adding AWS Cloudwatch to create a cron job that schedules the Lambda function to run on periodic intervals
-
Walking through an AWS Cloudformation yaml template that will create the Lambda function and Cloudwatch rule automatically and covering all the benefits of using a Cloudformation template
This tutorial truly is end-to-end. If you enjoy the content, you can help me a ton by doing any or all of the following:
-
supporting me on Patreon
-
subscribing to my YouTube channel
-
liking and/or commenting on the video
-
sharing the video or channel on any platform (reddit, twitter, discord, etc.)
-
starring the GitHub repo
-
following me on GitHub
Any questions or requests, just leave a comment.
More on reddit.comLooking for a basic and simple Lambda tutorial
Videos
I've been losing myself in rewriting a bunch of lambda functions. I can't help but notice that there's a bunch of different opinions and philosophies that make up the bulk of the samples and documentation.
In my own team, one of the guys wrote his own test framework and schema validation library. Another wrote his own logging library and was a big fan of the Serverless framework. I've been using Lambda Power Tools and unittest myself but my lambdas are pretty vanilla. Three guys, three different development styles.
Everything feels so arbitrary and I'm not sure what actually constitutes a production-ready, well structured Python lambda.
FWIW We use terraform for initial project deployment with codebuild, and I have my own makefiles to deploy if I want to bother outside of it. Most of my lambdas are interfaced by AGW and interact with s3, dynamodb, and sagemaker.
Edit: to be clear - most of these are <200ms calls. I'm not trying to cram crazy things into a lambda. If anyone could share some code samples of some well-done Lambda's I'm happy.