{"id":15014106,"url":"https://github.com/keithrozario/klayers","last_synced_at":"2026-03-06T11:08:27.073Z","repository":{"id":37850218,"uuid":"164266648","full_name":"keithrozario/Klayers","owner":"keithrozario","description":"Python Packages as AWS Lambda Layers","archived":false,"fork":false,"pushed_at":"2025-04-23T06:12:42.000Z","size":174020,"stargazers_count":2312,"open_issues_count":16,"forks_count":336,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-25T15:48:42.381Z","etag":null,"topics":["aws-lambda","lambda","lambda-layer","python","spacy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keithrozario.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-01-06T01:49:43.000Z","updated_at":"2025-04-23T06:12:47.000Z","dependencies_parsed_at":"2023-09-26T08:57:58.682Z","dependency_job_id":"1825fa8f-8b4b-4e26-8b29-4cf6c8867174","html_url":"https://github.com/keithrozario/Klayers","commit_stats":{"total_commits":690,"total_committers":74,"mean_commits":9.324324324324325,"dds":0.5,"last_synced_commit":"1d691d006a5853897ee36e8ef04d5052f1fd6c1d"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithrozario%2FKlayers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithrozario%2FKlayers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithrozario%2FKlayers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keithrozario%2FKlayers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keithrozario","download_url":"https://codeload.github.com/keithrozario/Klayers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990499,"owners_count":21995776,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-lambda","lambda","lambda-layer","python","spacy"],"created_at":"2024-09-24T19:45:11.809Z","updated_at":"2026-03-06T11:08:27.027Z","avatar_url":"https://github.com/keithrozario.png","language":"Python","funding_links":["https://www.buymeacoffee.com/keithrozario"],"categories":[],"sub_categories":[],"readme":"# Keith's Layers (Klayers)\n\n🐍 A collection of Python Packages as AWS Lambda(λ) Layers 🐍\n\n[![Python 3.10](https://img.shields.io/badge/python-3.10-green?style=for-the-badge)](https://www.python.org/downloads/release/python-3100/)  [![Python 3.11](https://img.shields.io/badge/python-3.11-green?style=for-the-badge)](https://www.python.org/downloads/release/python-3110/)  [![Python 3.12](https://img.shields.io/badge/python-3.12-green?style=for-the-badge)](https://www.python.org/downloads/release/python-3120/)  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000?style=for-the-badge)](https://github.com/psf/black)\n\n  -   [List of ARNs](#list-of-arns)\n  -   [Python Packages](#python-packages)\n  -   [Using the Layers](#using-the-layers)\n      -   [Option 1: Using the Console](#option-1-using-the-console)\n      -   [Option 2: Download copy of layer](#option-2-download-copy-of-layer)\n      -   [Option 3: Using Serverless Framework](#option-3-using-serverless-framework)\n      -   [Option 4: Using AWS Serverless Application Model (SAM)](#option-4-using-aws-serverless-application-model-sam)\n      -   [Option 5: Using Terraform with the Klayer provider](#option-5-using-terraform-with-the-klayer-provider)\n      -   [Option 6: Using CDK with cdk-klayers](#option-6-using-cdk-with-cdk-klayers)\n  -   [Status of layers](#status-of-layers)\n  -   [Layer expiry](#layer-expiry)\n  -   [Architecture Diagram](#architecture-diagram)\n  -   [API](#api)\n      -   [Get latest ARN for all packages in region](#get-latest-arn-for-all-packages-in-region)\n      -   [Get all ARNs for specific package in region](#get-all-arns-for-specific-package-in-region)\n  -   [Special Thanks](#special-thanks)\n  -   [Asking for additional layers](#asking-for-additional-layers)\n\n## List of ARNs\n\nList of the latest layer version arns are available by region:\n\n* [Python 3.10](deployments/python3.10)\n* [Python 3.11](deployments/python3.11)\n* [Python 3.12](deployments/python3.12)\n* [Python 3.10-arm64](deployments/python3.10-arm64)\n* [Python 3.11-arm64](deployments/python3.11-arm64)\n* [Python 3.12-arm64](deployments/python3.12-arm64)\n\n*Note: We have deprecated layers for python3.6, python3.7, python 3.8 and python3.9, Please use the latest version of python (currently python3.12) going forward*\n\n## Python Packages\n\nFor 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.\n\n* [Python 3.10](pipeline/config/packages_p310.csv)\n* [Python 3.11](pipeline/config/packages_p311.csv)\n* [Python 3.12](pipeline/config/packages_p312.csv)\n* [Python 3.10-arm64](pipeline/config/packages_p310-arm64.csv)\n* [Python 3.11-arm64](pipeline/config/packages_p311-arm64.csv)\n* [Python 3.12-arm64](pipeline/config/packages_p312-arm64.csv)\n\n## Using the Layers\n\nYou can use the layers anyway you see fit, and here are 6 options based on what method you use to deploy your lambda functions:\n\n### Option 1: Using the Console\n\nAdd the arn directly from the console, by selecting Layers-\u003eAdd a Layer-\u003eSpecify an Arn:\n\n![Screenshot](documentation/add_arn.png)\n\n### Option 2: Download copy of layer\n\nUse the `Get Layer Version by ARN` in [python](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.get_layer_version_by_arn) or [aws-cli](https://docs.aws.amazon.com/cli/latest/reference/lambda/get-layer-version-by-arn.html) command which will provide an S3 location to download the layer as a zip.\n\n*Note: You can only get layers from the specific region your client is configured for, otherwise you'll get a `AccessDeniedException` error.*\n\n### Option 3: Using Serverless Framework\n\nYou 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:\n\n```yaml\ncheck:\n  handler: 02_pipeline/check.main\n  description: Checks for package on PyPi via the API\n  runtime: python3.9\n  timeout: 30\n  memorySize: 256\n  layers:\n  - arn:aws:lambda:${self:provider.region}:113088814899:layer:Klayers-python37-packaging:1\n  - arn:aws:lambda:${self:provider.region}:113088814899:layer:Klayers-python38-aws-lambda-powertools:23\n```\n\n### Option 4: Using AWS Serverless Application Model (SAM)\n\nUsing AWS SAM, you can include layers in your serverless applications.You must use layers from the same region as your function:\n\n```yaml\nServerlessFunction:\n  Type: AWS::Serverless::Function\n  Properties:\n    CodeUri: .\n    Handler: my_handler\n    Runtime: Python3.9\n    Layers:\n        - arn:aws:lambda:ap-southeast-1:113088814899:layer:Klayers-p39-packaging:1\n```\n\n### Option 5: Using Terraform with the Klayer provider\n\nUsing Terraform, you can use the [terraform-provider-klayer](https://github.com/ldcorentin/terraform-provider-klayer). The provider uses the API to enable your functions to always reference the latest layer versions.\n\n```terraform\nterraform {\n  required_providers {\n    klayers = {\n      version = \"~\u003e 1.0.0\"\n      source  = \"ldcorentin/klayer\"\n    }\n    aws = {\n      source  = \"hashicorp/aws\"\n      version = \"~\u003e 3.0\"\n    }\n  }\n}\n\nprovider \"aws\" {\n  region = \"us-east-1\"\n}\n\ndata \"klayers_package_latest_version\" \"pandas\" {\n  name   = \"pandas\"\n  region = \"us-east-1\"\n}\n\nresource \"aws_lambda_function\" \"test_lambda\" {\n  filename      = \"index.zip\"\n  function_name = \"klayers-test\"\n  role          = aws_iam_role.iam_for_lambda.arn\n  handler       = \"index.handler\"\n  runtime       = \"python3.9\"\n  layers = [\n    data.klayers_package_latest_version.pandas.arn\n  ]\n}\n```\n\n### Option 6: Using CDK with cdk-klayers\n\nUsing CDK, you can use the [cdk-klayers](https://github.com/keithrozario/cdk-klayers) package to help you pull in the latest layers for your Stack or App.\n\n```python\n\nfrom cdk_klayers import Klayers\n\nclass MockStack(Stack):\n\n    def __init__(self, scope: Construct, construct_id: str, **kwargs) -\u003e None:\n        super().__init__(scope, construct_id, **kwargs)\n\n        runtime = aws_lambda.Runtime.PYTHON_3_12\n\n        # Initialize Klayers Class\n        klayers = Klayers(\n            self,\n            python_version = runtime,\n            region = \"ap-southeast-1\"\n        )\n    \n        # get the latest layer version for the requests package\n        requests_layer = klayers.layer_version(self, \"requests\")\n\n        lambda_function = aws_lambda.Function(\n            self, 'HelloHandler',\n            runtime=runtime,\n            layers=[requests_layer],\n            code=aws_lambda.Code.from_asset('lambda'),\n            handler='hello.handler'\n        )\n\n```\n\n\n## Status of layers\n\nLayers are built with the latest package version at 2am UTC on the first day of the Month.\n\nIf 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.\n\n## Layer expiry\n\nSome layer versions will have a `expiry_date` field. This is the date for when the layers will be deleted.\n\nIn 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.\n\nAll functions deployed with a layer will still work indefinitely, but you won't be able to deploy new functions referencing a deleted layer version.\n\n## Architecture Diagram\n\n![Screenshot](documentation/Klayers-Architecture.png)\n\n## API\n\nAPI v1 has been deprecated. Please use API v2 instead.\n\nAll 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.\n\n### Get latest ARN for all packages in region\n\nReturns 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.\n\n*https://api.klayers.cloud/api/v2/{python_version}/layers/latest/{region}/{format}*\n\nexample:\n\n* [https://api.klayers.cloud/api/v2/p3.9/layers/latest/us-east-1/](https://api.klayers.cloud/api/v2/p3.9/layers/latest/us-east-1/)\n* [https://api.klayers.cloud/api/v2/p3.8/layers/latest/ap-southeast-1/](https://api.klayers.cloud/api/v2/p3.9/layers/latest/ap-southeast-1/)\n* [https://api.klayers.cloud/api/v2/p3.10/layers/latest/ap-southeast-1/csv](https://api.klayers.cloud/api/v2/p3.10/layers/latest/ap-southeast-1/csv)\n* [https://api.klayers.cloud/api/v2/p3.10-arm64/layers/latest/ap-southeast-1/html](https://api.klayers.cloud/api/v2/p3.10-arm64/layers/latest/ap-southeast-1/html)\n\n### Get all ARNs for specific package in region\n\nReturns data on the all layers (latest and deprecated) for a **specific** *{package}* in a specific *{region}* for your *{python_version}*\n\n*https://api.klayers.cloud/api/v2/{python_version}/layers/{region}/{package}*\n\nexample:\n\n* [https://api.klayers.cloud/api/v2/p3.8/layers/us-east-1/requests](https://api.klayers.cloud/api/v2/p3.8/layers/us-east-1/requests)\n* [https://api.klayers.cloud/api/v2/p3.9/layers/ap-southeast-1/boto3](https://api.klayers.cloud/api/v2/p3.9/layers/ap-southeast-1/boto3)\n\n## Special Thanks\n\n* [Chahna107](https://github.com/chahna107) \n* [@ldcorentin](https://github.com/ldcorentin) for making the awesome Terraform klayers-provider\n\n## Asking for additional layers\n\nIf you would like a new package to be made a layer, raise a `pull request` modifying the `pipeline/config/packages_p310.csv` or `pipeline/config/packages_p310-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.\n\n## Consider Making a Donation\n\nIf you've found Klayers helpful, consider making a small donation [here.](https://www.buymeacoffee.com/keithrozario)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeithrozario%2Fklayers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeithrozario%2Fklayers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeithrozario%2Fklayers/lists"}