小编dev*_*yer的帖子

AWS Python层在本地运行

如何在本地运行具有层的 AWS Lambda 函数?

我的环境:

    +---.aws-sam
        ....
    +---test
    |       app.py
    |       requirements.txt
    |       
    +---dependencies
    |   \---python
    |           constants.py
    |           requirements.txt
    |           sql.py
    |           utils.py
Run Code Online (Sandbox Code Playgroud)
  • 和部署模板如下:
testFunc:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: teest/
      Handler: app.test
      Runtime: python3.6
      FunctionName: testFunc
      Events:
        test:
          Type: Api
          Properties:
            Path: /test
            Method: ANY
      Layers:
        - !Ref TempConversionDepLayer

  TempConversionDepLayer:
        Type: AWS::Serverless::LayerVersion
        Properties:
            LayerName: Layer1
            Description: Dependencies
            ContentUri: dependencies/
            CompatibleRuntimes:
              - python3.6
              - …
Run Code Online (Sandbox Code Playgroud)

python layer amazon-web-services aws-lambda

6
推荐指数
1
解决办法
2310
查看次数

标签 统计

amazon-web-services ×1

aws-lambda ×1

layer ×1

python ×1