Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
K

Klayers

> 编程语言
Open source

Python Packages as AWS Lambda Layers

2.5K stars0 likes1 views
WebsiteGitHub

About

Python Packages as AWS Lambda Layers

Keith's Layers (Klayers)

A collection of Python Packages as AWS Lambda(λ) Layers

  • List of ARNs
  • Python Packages
  • Using the Layers
    • Option 1: Using the Console
    • Option 2: Download copy of layer
    • Option 3: Using Serverless Framework
    • Option 4: Using AWS Serverless Application Model (SAM)
    • Option 5: Using Terraform with the Klayer provider
    • Option 6: Using CDK with cdk-klayers
  • Status of layers
  • Layer expiry
  • Architecture Diagram
  • API
    • Get latest ARN for all packages in region
    • Get all ARNs for specific package in region
  • Special Thanks
  • Asking for additional layers

List of ARNs

List of the latest layer version arns are available by region:

  • Python 3.12
  • Python 3.13
  • Python 3.14
  • Python 3.12-arm64
  • Python 3.13-arm64
  • Python 3.14-arm64

End of life approaching (still supported by Klayers, but plan your migration):

  • Python 3.11 | Python 3.11-arm64 — EOL October 2027
  • Python 3.10 | Python 3.10-arm64 — EOL October 2026

Deprecated versions (no longer receiving updates, existing layers still accessible):

  • Python 3.9
  • Python 3.8

Please use Python 3.12 or later for new functions.

Python Packages

For the full list of Python packages, refer to the following, feel free to make a pull requests modifying the files below to requests for a specific package.

  • Python 3.12
  • Python 3.13
  • Python 3.14
  • Python 3.12-arm64
  • Python 3.13-arm64
  • Python 3.14-arm64

Using the Layers

You can use the layers anyway you see fit, and here are 6 options based on what method you use to deploy your lambda functions:

Option 1: Using the Console

Add the arn directly from the console, by selecting Layers->Add a Layer->Specify an Arn:

Option 2: Download copy of layer

Use the Get Layer Version by ARN in python or aws-cli command which will provide an S3 location to download the layer as a zip.

Note: You can only get layers from the specific region your client is configured for, otherwise you'll get a AccessDeniedException error.

Option 3: Using Serverless Framework

You can include layers in your deployments, by utilizing the layers property at the function level, and setting it to the arn of your choice. You must use layers from the same region as your function:

yaml
check:
  handler: 02_pipeline/check.main
  description: Checks for package on PyPi via the API
  runtime: python3.9
  timeout: 30
  memorySize: 256
  layers:
  - arn:aws:lambda:${self:provider.region}:113088814899:layer:Klayers-python37-packaging:1
  - arn:aws:lambda:${self:provider.region}:113088814899:layer:Klayers-python38-aws-lambda-powertools:23

Option 4: Using AWS Serverless Application Model (SAM)

Using AWS SAM, you can include layers in your serverless applications.You must use layers from the same region as your function:

yaml
ServerlessFunction:
  Type: AWS::Serverless::Function
  Properties:
    CodeUri: .
    Handler: my_handler
    Runtime: Python3.9
    Layers:
        - arn:aws:lambda:ap-southeast-1:113088814899:layer:Klayers-p39-packaging:1

Option 5: Using Terraform with the Klayer provider

Using Terraform, you can use the terraform-provider-klayer. The provider uses the API to enable your functions to always reference the latest layer versions.

…

Option 6: Using CDK with cdk-klayers

Using CDK, you can use the cdk-klayers package to help you pull in the latest layers for your Stack or App.

…

Status of layers

Layers are built with the latest package version at 2am UTC on the first day of the Month.

If there's a critical issue with a package, which needs a new version of it published, raise an issue for the package, and I'll try my best to perform the deploy.

Layer expiry

Some layer versions will have a expiry_date field. This is the date for when the layers will be deleted.

In general, layers are scheduled for deletion 365 days after a new layer version has been published for that package. If you use that latest version of a layer, you're guaranteed at least 365 days before the layer is deleted.

All functions deployed with a layer will still work indefinitely, but you won't be able to deploy new functions referencing a deleted layer version.

Architecture Diagram

API

API v1 has been deprecated. Please use API v2 instead.

All API calls are http-based, and work only with https (TLS1.2 and above). The API is heavily cached, so there could be minor delays in updates.

Get latest ARN for all packages in region

Returns data on the latest layer for a all packages in a specific {region} for your {python_version}. Defaults to json, but both csv and html can be returned as well.

https://api.klayers.cloud/api/v2/{python_version}/layers/latest/{region}/{format}

example:

  • https://api.klayers.cloud/api/v2/p3.14/layers/latest/us-east-1/
  • https://api.klayers.cloud/api/v2/p3.13/layers/latest/ap-southeast-1/
  • https://api.klayers.cloud/api/v2/p3.12/layers/latest/ap-southeast-1/csv
  • https://api.klayers.cloud/api/v2/p3.12-arm64/layers/latest/ap-southeast-1/html

Get all ARNs for specific package in region

Returns data on the all layers (latest and deprecated) for a specific {package} in a specific {region} for your {python_version}

https://api.klayers.cloud/api/v2/{python_version}/layers/{region}/{package}

example:

  • https://api.klayers.cloud/api/v2/p3.14/layers/us-east-1/requests
  • https://api.klayers.cloud/api/v2/p3.13/layers/ap-southeast-1/boto3

Special Thanks

  • Chahna107
  • @ldcorentin for making the awesome Terraform klayers-provider
  • @DanielKilgallon for helping keep the documentation up to date

Asking for additional layers

If you would like a new package to be made a layer, raise a pull request modifying the pipeline/config/packages_p314.csv or pipeline/config/packages_p314-arm64.csv file (depending on which architecture you prefer). By default, please request for the latest version of python unless you absolutely need an older version.

Consider Making a Donation

If you've found Klayers helpful, consider making a small donation here.

Repository History Rewrite (March 7, 2026)

On March 7, 2026, this repository underwent a major history rewrite to remove large, non-essential artifacts and significantly reduce the repository's clone size (from ~200MB+ down to ~17MB).

Impact on existing Clones and Forks: Because the commit hashes have changed, your existing local clone or fork is now incompatible with the current master branch. To continue contributing or staying up-to-date, you must perform one of the following:

  1. Re-clone the repository:
    bash
    git clone https://github.com/keithrozario/Klayers.git
  2. Hard Reset (for existing clones):
    bash
    git fetch origin
    git reset --hard origin/master

A full backup of the legacy history (including the removed large files) is preserved as a permanent asset in the Legacy History Backup Release.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Pythonaws-lambdalambdalambda-layerpython

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言