GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — my-python-lambda-layers/README.md at develop · gugzkumar/my-python-lambda-layers

Expand file tree

/

README.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
67 lines (59 loc) · 2.24 KB
/

README.md

Copy path

File metadata and controls

67 lines (59 loc) · 2.24 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

My Python Lambda Layers

This repo is meant to be the source of truth and code to build AWS lambda Layers for my personal projects. I would suggest if you are trying to build a AWS Lambda app, you build your own layers using this repo as a source of inspiration.

Layers in This Repo

python-core

requests==2.22.0
SQLAlchemy==1.3.12
beautifulsoup4==4.8.2
flashtext==2.7
slackclient==2.5.0

python-crypto

pyjwt==1.7.1
cryptography==2.8

python-math

numpy==1.18.0
pandas==0.25.3

Building or Updating a Layer

IMPORTANT: If you update a layer make sure to also update your Lambda function to us the new version.

Option 1: Manual Creation

  1. Run bash generate-layer-zip.sh.
  2. Confirm that in the zipped-layers folder of this project, you have zip files for each of your layers.
  3. Go to AWS create your layer by uploading the zip file, with python 3.7 as the lambda environment

Option 2: Create With Continuous Deployment Via Github Actions

  1. In the github repo create the following secrets: AWS_DEFAULT_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY.
  2. Next just add a commit to the master branch.
  3. Monitor the Publish_Layers workflow on the Actions tab of your repo. When this succeeds the layers should be created.
  4. Look in your AWS account to confirm that they are created

Adding new layers

  1. Add a new new folder to the root of the folder with the following folder structure. Fill requirements.txt with your versioned dependencies.
    .
    ├── ...
    ├── my-new-layer
    │   ├── python
    │   │   ├── lib
    │   │   │   ├── python3.7
    │   │   │   │   ├── site-packages
    │   │   │   │   │   ├── .gitkeep
    │   ├── requirements.txt
    │   └── ...
    └── ...
    -
    
  2. Add this line to build.sh
    ...
    build_a_layer "{LAYER_FOLDER_NAME}"
    
  3. Add these lines line to .github/workflows/publish_layers.yml. Properly replace LAYER_FOLDER_NAME and LAYER_FOLDER_NAME.
    ...
    - name: Publish {LAYER_FOLDER_NAME}
      run: aws lambda publish-layer-version --layer-name {LAYER_NAME} --zip-file fileb://zipped-layers/{LAYER_FOLDER_NAME}.zip
    
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.