I forgot to return to this, so I figured I would post this here to assist others that may be struggling as Python is really finicky.

The following is the structure of a functional project in Lambda:

β”œβ”€β”€ README.md
β”œβ”€β”€ buildspec.yml
β”œβ”€β”€ lambda_handler.py
β”œβ”€β”€ locales
β”‚   β”œβ”€β”€ en
β”‚   β”‚   └── LC_MESSAGES
β”‚   β”‚       └── base.po
β”‚   β”œβ”€β”€ es
β”‚   β”‚   └── LC_MESSAGES
β”‚   β”‚       └── base.po
β”‚   β”œβ”€β”€ fr
β”‚   β”‚   └── LC_MESSAGES
β”‚   β”‚       └── base.po
β”œβ”€β”€ my_project_name
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ python_file_1.py
β”‚   β”œβ”€β”€ python_file_2.py
β”‚   β”œβ”€β”€ python_file_3.py
β”‚   β”œβ”€β”€ repositories
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ resolvers_1.py
β”‚   β”‚   β”œβ”€β”€ resolvers_2.py
β”œβ”€β”€ requirements-dev.txt
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ template.yml
└── tests
    β”œβ”€β”€ __init__.py
    β”œβ”€β”€ tests_file_1.py
    β”œβ”€β”€ tests_file_2.py
    β”œβ”€β”€ tests_file_3.py
    └── tests_file_4.py

Note that the base.mo files are generated in the build in the same location as the base.po files and that requirements-dev.txt has dev-only libraries, such as pep8 for formatting and is only run within my local conda environments [I set up virtual environments for each project using miniconda]. The purpose of the resolvers in the nested repositories folder is to separate out the controller-like python files from the calls to the repositories to retrieve data.

Answer from MapLion on Stack Overflow
🌐
Reddit
reddit.com β€Ί r/aws β€Ί best way to structure a multi-lambda python project?
r/aws on Reddit: Best way to structure a multi-Lambda Python project?
June 12, 2024 -

My team and I are using 1 single repo with Python to create multiple Lambda functions that will have some shared dependencies.

Does anyone have any recommendations for how to best structure the project folder structure?

Discussions

Multiple lambda functions from the same project?
https://aws.amazon.com/blogs/aws/new-for-aws-lambda-use-any-programming-language-and-share-common-components/ This seems to be exactly what you are looking for More on reddit.com
🌐 r/aws
18
18
April 16, 2019
Best way to structure a multi-Lambda Python project?
Try this search for more information on this topic. Comments, questions or suggestions regarding this autoresponse? Please send them here . I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/aws
8
4
June 12, 2024
Lambda beginner project with python

You can use API Gateway to expose your Lambda function to the internet. Make sure you restrict access via an API key or something.

Everything else is just python.

More on reddit.com
🌐 r/aws
7
10
October 4, 2020
Lambda serverless projects
Not mine but this is my goto when people ask about serverless applications: Code: https://github.com/Nordstrom/hello-retail Explanation/workshop: https://github.com/Nordstrom/hello-retail-workshop More on reddit.com
🌐 r/aws
51
55
September 5, 2018
Top answer
1 of 1
1

I forgot to return to this, so I figured I would post this here to assist others that may be struggling as Python is really finicky.

The following is the structure of a functional project in Lambda:

β”œβ”€β”€ README.md
β”œβ”€β”€ buildspec.yml
β”œβ”€β”€ lambda_handler.py
β”œβ”€β”€ locales
β”‚   β”œβ”€β”€ en
β”‚   β”‚   └── LC_MESSAGES
β”‚   β”‚       └── base.po
β”‚   β”œβ”€β”€ es
β”‚   β”‚   └── LC_MESSAGES
β”‚   β”‚       └── base.po
β”‚   β”œβ”€β”€ fr
β”‚   β”‚   └── LC_MESSAGES
β”‚   β”‚       └── base.po
β”œβ”€β”€ my_project_name
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ python_file_1.py
β”‚   β”œβ”€β”€ python_file_2.py
β”‚   β”œβ”€β”€ python_file_3.py
β”‚   β”œβ”€β”€ repositories
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ resolvers_1.py
β”‚   β”‚   β”œβ”€β”€ resolvers_2.py
β”œβ”€β”€ requirements-dev.txt
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ template.yml
└── tests
    β”œβ”€β”€ __init__.py
    β”œβ”€β”€ tests_file_1.py
    β”œβ”€β”€ tests_file_2.py
    β”œβ”€β”€ tests_file_3.py
    └── tests_file_4.py

Note that the base.mo files are generated in the build in the same location as the base.po files and that requirements-dev.txt has dev-only libraries, such as pep8 for formatting and is only run within my local conda environments [I set up virtual environments for each project using miniconda]. The purpose of the resolvers in the nested repositories folder is to separate out the controller-like python files from the calls to the repositories to retrieve data.

🌐
GitHub
github.com β€Ί amguerrero β€Ί py_aws_lambda_skeleton
GitHub - amguerrero/py_aws_lambda_skeleton: AWS Lambda python solution skeleton Β· GitHub
This is a structure for a python AWS Lambda solution. In this structure the AWS Lambda which make the solution are directories in the root of the project's solution (i.e.
Starred by 9 users
Forked by 6 users
Languages: Python
🌐
Informed
informediq.com β€Ί home β€Ί blog β€Ί python src layout for aws lambdas
Python src Layout for AWS Lambdas | Informed
September 7, 2023 - All Python source code that makes up your appplication (other than tests or build utilities) for the project are in these sub folder[s] Modern Python tooling expects / works best with this layout ... We were looking for standards and best practices for organizing our Python AWS Lambda projects using Poetry in our monorepo and kept coming across the src layout as the recommended way to organize Python projects that had multiple modules.
🌐
Linuxbeast
linuxbeast.com β€Ί home β€Ί how to structure your python projects for aws lambda, apis, and cli tools
How to Structure Your Python Projects for AWS Lambda, APIs, and CLI Tools | Linuxbeast
March 9, 2026 - Here’s a structure that keeps things organized without overengineering it. my-lambda-project/ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ __init__.py β”‚ β”œβ”€β”€ handler.py # Lambda entry point β”‚ β”œβ”€β”€ services.py # Business logic / external API calls β”‚ β”œβ”€β”€ config.py # Environment variables β”‚ β”œβ”€β”€ utils.py # Shared helper functions β”‚ β”œβ”€β”€ validator.py # Input validation β”‚ └── exceptions.py # Custom exceptions β”œβ”€β”€ tests/ β”‚ β”œβ”€β”€ __init__.py β”‚ └── test_handler.py β”œβ”€β”€ requirements.txt β”œβ”€β”€ Dockerfile # If deploying as container image └── README.md
🌐
DEV Community
dev.to β€Ί fwojciec β€Ί how-to-structure-a-python-aws-serverless-project-4ace
How to Structure a Python AWS Serverless Project - DEV Community
January 6, 2022 - Module resolution is broken, since Python doesn't automatically understand a codebase structured as described above. It seems that many projects end up accepting this state of affairs as the fact of life when building with lambdas - some really hacky workarounds for this very issue can be found, for example, in official serverless project examples published by AWS.
Find elsewhere
🌐
Hackers and Slackers
hackersandslackers.com β€Ί improve-your-aws-lambda-workflow-with-python-lambda
Python-Lambda: The Essential Library for AWS Cloud Functions
June 19, 2026 - When you're ready to 'deploy' to AWS, you copy all your dependencies from /site-packages and move them into your root directory, temporarily creating an abomination of a project structure. With your project fully bloated and confused, you cherry-pick the files to zip into an archive. Finally, you upload your code via zip either to Lambda directory or to S3, only to run your code, realize it's broken, and need to start all over. Indeed, there is, and surprisingly enough, the solution is 100% Python (sorry, HashiCorp, we'll talk another time). This "better way" is my method of leveraging the following: The official AWS CLI.
🌐
Peterkovari
peterkovari.blog β€Ί aws-lambda-in-python-with-sam
AWS Lambda in Python with SAM – Peter's Blog
SAM’s original project structure for Python is less than ideal. 3rd party libraries, dependencies, are expected to be in the project root. All project assets in the root will be deployed. I want to maintain a virtualenv for development and define different dependencies (requirements.txt) ...
🌐
YouTube
youtube.com β€Ί codelink
aws lambda python project structure - YouTube
Download this code from https://codegive.com Certainly! Below is an informative tutorial on structuring an AWS Lambda Python project with code examples.AWS L...
Published: February 3, 2024
Views: 5
🌐
JetBrains
jetbrains.com β€Ί pycharm β€Ί guide β€Ί tutorials β€Ί intro-aws β€Ί project-structure
Exploring Project Structure - JetBrains Guide
February 17, 2023 - According to AWS an event is a JSON-formatted document that contains data for a Lambda function to process. The Lambda runtime converts the event to an object and passes it to your function code.
🌐
Chester
chester.codes β€Ί python-lambda-structure
Project structure for python AWS Lambda functions | chester.codes
April 17, 2017 - This file contains the main handler method which is called when the lambda runs on AWS.
🌐
Medium
medium.com β€Ί @e-miguel β€Ί lambda-and-python-projects-beginner-1b0db01be87c
Lambda and Python Projects: Beginner | by Eugene Miguel | Medium
October 2, 2023 - We verified that the files (jupyter, python, and zip) are successfully pushed into our python-projects repository on GitHub. ... We will create an IAM role that Lambda will use to trigger our code for this project. Select AWS service under entity.
🌐
Medium
aws.plainenglish.io β€Ί structuring-your-python-code-for-aws-lambda-is-easy-b815e779b202
Structuring Your Python Code for AWS Lambda is Easy | by Joseph Schambach | AWS in Plain English
May 26, 2025 - TL;DR β€” Want to keep your AWS Lambda functions clean, maintainable, and production-ready? This article walks through a simple structure using handler.py, utils.py, and config.py to separate concerns, improve readability, and make scaling your logic easier.
🌐
W11i
w11i.me β€Ί how_to_structure_a_python_aws_serverless_project
How to Structure a Python AWS Serverless Project | w11i.me
January 3, 2022 - A practical guide to structuring Python serverless projects using editable packages. Covers sharing code between Lambda functions, solving module resolution issues, configuring pytest and mypy, and deploying shared code as layers.
🌐
Ran the Builder
ranthebuilder.cloud β€Ί home β€Ί blog β€Ί aws lambda functions with architecture layers
AWS Lambda Functions with Architecture Layers
April 24, 2023 - So, in this blog post, you will learn how to write AWS Lambda function code containing three architectural layers: the handler, the logic, and data access layer. These layers result in well-organized code that is easier to maintain, easier to ...
🌐
Medium
bombillazo.medium.com β€Ί python-aws-lambda-monorepo-part-1-project-setup-12bdcca47d2d
Python AWS Lambda Monorepo β€” Part 1: Project Setup | Medium
November 27, 2020 - We have our whole project setup and our services integrated! Now we can focus on our application itself. To learn more about infrastructure setup, I challenge you to create the Lambda functions or the DynamoDB table using AWS CloudFormation. In Part 2, we will look at how to create custom Python packages and share them across our Lambda functions.
🌐
GitHub
github.com β€Ί aws-samples β€Ί aws-cdk-project-structure-python
GitHub - aws-samples/aws-cdk-project-structure-python: Recommended AWS CDK project structure for Python applications Β· GitHub
The project implements a user ... AWS Lambda and Amazon DynamoDB to provide basic CRUD operations for managing users. The project also includes a toolchain with continuous deployment pipeline. * Diagram generated using https://github.com/pistazie/cdk-dia Β· This project is a template. Click β€œUse this template” (see the screenshot below) in the repository main page to create your own repository based on aws-samples/aws-cdk-project-structure-python...
Starred by 187 users
Forked by 32 users
Languages: Python 88.1% | Shell 11.9%