Skip to content

A starter repo for deploying Python & Node.js applications to AWS with SST

Notifications You must be signed in to change notification settings

apetta/aws-python-node-starter

Repository files navigation

Python and Node.js AWS Lambdas w/ SST

Deploy hybrid python & node.js applications using sst v3.

BUG: SST version currently fixed at 3.2.5; see issue.

Setup

pnpm install

Ensure you have the AWS CLI configured locally.

AWS Resources

Defined in sst.config.ts.

Python

Defined in python-functions/. SST uses uv to manage your python runtime. If you do not have uv installed, it will be installed for you and will install a compatible version of python. You can configure the version of python used by SST when creating your function:

const python = new sst.aws.Function("MyPythonFunction", {
  python: { container: true },
  handler: "src/python.handler",
  runtime: "python3.11",
  url: true,
});

If you are using live lambdas for your python functions, it is recommended to specify your python version to match your Lambda runtime otherwise you may encounter issues with dependencies.

[project]
name = "aws-python"
version = "0.1.0"
description = "A SST app"
authors = [
    {name = "<your_name_here>", email = "<your_email_here>" },
]
requires-python = ">=3.11"

Live lambda will locally run your python code with the environment specified in the closes pyproject.toml file - no need to install packages locally. If you have multiple environments, you can create multiple pyproject.toml files and specify the environment in your function:

.
├── function_a
│ ├── pyproject.toml
│ └── index.py
└── function_b
├── pyproject.toml
└── index.py

Dependencies

Since SST packages and manages your environment, you can easily add dependencies with uv and they will be automatically installed when you deploy your function.

uv add requests

or

uv pip install requests

This example will deploy the python function using a container instead of the native python runtime. This means you can customize the build if you need and you have bigger limits for dependencies. This is great for use cases such as the SciPy ecosystem, which is challenging to use with the native runtime.

Node.js

Defined in node-functions. Refer to sst.dev for standard usage.

About

A starter repo for deploying Python & Node.js applications to AWS with SST

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published