How to Deploy a Python Lambda Using AWS CDK?

Learn how to deploy a Python AWS Lambda function with dependencies using AWS CDK

Utkarsha Bakshi
Geek Culture

--

Image source (link)

In this post, we will learn how to deploy a Python Lambda function with dependencies using AWS CDK. If your Python Lambda doesn’t contain any 3rd party library dependencies, you can easily deploy but in this tutorial, we will explore how to do bundle the dependencies along with your Python function.

If you are looking to manually bundle the Lambda package and upload it to the S3 then refer to this tutorial.

Let us get started and learn how to do it.

Prerequisites

You will need to setup the following for this tutorial.

Creating a AWS CDK app

First, let us create a Typescript based CDK app

mkdir cdk-sample-app
cd cdk-sample-app
cdk init app --language typescript

Defining a Lambda function

Next, let us define a AWS Lambda function. Create a lambda directory in the CDK project’s root directory.

--

--