Play with Lambda layer (python) for about 5 minutes

Summary

--Directory structure: python/layer/function.py --Import: from layer import layer1

Preparation of files to be layered

function.py


def sum(x:int, y:int) -> int:
    return x + y

Preparation of functions that use Layer

lambda_function.py


import json
from layer import function

def lambda_handler(event, context):
    # TODO implement
    return {
        'statusCode': 200,
        'body': function.sum(1,2)
    }

at the end

--Place it under the python / directory and import the destination ――It's annoying that you have to coordinate so that the common system fits in when you zip it. ――It's a little difficult to debug just because Python says that there is no such module. ――It would be a little more kind if you output an error message from Lambda's point of view.

Recommended Posts

Play with Lambda layer (python) for about 5 minutes
Create a Layer for AWS Lambda Python with Docker
Play with 2016-Python
About Python for loops
About Python, for ~ (range)
Stop EC2 for specified time + start with Lambda (python)
Create Python version Lambda function (+ Lambda Layer) with Serverless Framework
[Piyopiyokai # 1] Let's play with Lambda: Creating a Python script
About Fabric's support for Python 3
Operate TwitterBot with Lambda, Python
[Python] Play with Discord's Webhook.
Play RocketChat with API / Python
About "for _ in range ():" in python
I was hooked for 2 minutes with the Python debugger pdb
[AWS] Try adding Python library to Layer with SAM + Lambda (Python)
About folder structure when uploading Python module to Lambda Layer
Face detection with Lambda (Python) + Rekognition
Getting Started with Python for PHPer-Classes
Let's play with Excel with Python [Beginner]
AWS Layer Creation Script for python
Notify HipChat with AWS Lambda (Python)
Use PostgreSQL with Lambda (Python + psycopg2)
Getting Started with Python for PHPer-Functions
[Let's play with Python] Aiming for automatic sentence generation ~ Completion of automatic sentence generation ~
Multi Layer Perceptron for Deep Learning (Deep Learning with Python; MPS Yokohama Deep Learning Series)
[For Python] Quickly create an upload file to AWS Lambda Layer
Play video with sound with python !! (tkinter / imageio)
[AWS] Using ini files with Lambda [Python]
Easy keyword extraction with TermExtract for Python
INSERT into MySQL with Python [For beginners]
Play audio files from Python with interrupts
[Python] Minutes of study meeting for beginners (7/15)
Use DeepL with python (for dissertation translation)
Play handwritten numbers with python Part 2 (identify)
Memo to ask for KPI with python
Amplify images for machine learning with python
Tips for dealing with binaries in Python
Fractal to make and play with Python
Manipulate DynamoDB data with Lambda (Node & Python)
Tips for using python + caffe with TSUBAME
I want to play with aws with python
[Shakyo] Encounter with Python for machine learning
Process multiple lists with for in Python
Getting Started with Python for PHPer-Super Basics
[Let's play with Python] Aiming for automatic sentence generation ~ Perform morphological analysis ~
Debug for mysql connection with python mysql.connector
[Python] Read images with OpenCV (for beginners)
Connect to s3 with AWS Lambda Python
WebApi creation with Python (CRUD creation) For beginners
Preparation for scraping with python [Chocolate flavor]
Try assigning or switching with Python: lambda
[For beginners] Try web scraping with Python
Python + Selenium + Headless Chromium with aws lambda
A story about cross-compiling a python package for AWS Lambda and deploying it serverless
Python hand play (let's get started with AtCoder?)
AWS-Perform web scraping regularly with Lambda + Python + Cron
[REAPER] How to play with Reascript in Python
[Piyopiyokai # 1] Let's play with Lambda: Creating a Lambda function
Causal reasoning and causal search with Python (for beginners)
Get a ticket for a theme park with python
Create a LINE BOT with Minette for Python