Heading image

Prerequisites

  1. Basic familiarity with AWS CDK for TypeScript.

Getting started

We will clone the template repo to get started:

Adding a pattern construct

We want to create a re-useable construct that will allow us to deploy a basic Python lambda functions.

Creating the function

Inside of functions/hello-python-lambda/index.py, add the following code:

Adding the construct to our stack

Inside of lib/aws-cdk-with-typescript-foundations-stack.ts, add the following code:

Deploying to LocalStack

This will follow on from what was demonstrated in the “Using The AWS CDK With LocalStack And aws-cdk-local” post.

Invoking the function

Tear down

Finally, we can tear down the stack:

Summary

Today’s post demonstrated how to deploy a basic Python lambda function to LocalStack using the TypeScript AWS CDK.

Resources and further reading

  1. AWS CDK for TypeScript
  2. Project code

--

--

--

Senior Engineer @ UsabilityHub. Formerly Culture Amp.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

FarmCraft — An Agriculture SaaS PoC

Badgerloop in California: Day 4

Originally, using git seemed like a daunting task to me but the process for pushing changes to…

Building a chatbot with Rasa

Image source — www.ecommerce-nation.com

Azure Machine Learning Pipelines

Polymer pattern: Sliding page transitions

Test Driven Development (TDD) in Swift

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dennis O'Keeffe

Dennis O'Keeffe

Senior Engineer @ UsabilityHub. Formerly Culture Amp.

More from Medium

Configuring Cognito’s Hosted UI with a Custom Resource in CDK + Python

8 AWS Serverless Patterns in Kafka-land

AWS AppSync GraphQL APIs to invoke Lambda function

Configuring APIGateway VTL to store JSON object directly on S3 —With Lambda authorizer enabled