LoginSignup
0
0

More than 3 years have passed since last update.

Lambda layer(python)で5分くらい遊ぶ

Posted at

まとめ

  • ディレクトリ構成: python/layer/function.py
  • インポート: from layer import layer1

Layer化したいファイルの用意

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

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)
    }

さいごに

  • python/ ディレクトリ以下に配置して、その先をimportする
    • Zip化する際に共通系がそこに入るようにコーディネートしなければならないのめんどくさい
    • そんなモジュールないぜ、ってPython的に言われるだけで、ちょっとデバッグしづらい
    • Lambda視点からのエラーメッセージを出力してくれたらもう少し親切なのに
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0