我成功地创建了一个无服务器的lambda层,但是现在我必须对SAM CLI做同样的事情,但是我做不到。
在没有服务器的情况下,我仅使用两个文件:
serverless.yml内容如下:
service: MyService
provider:
name: aws
layers:
awswrangler:
package:
artifact: awswrangler-layer-0.0.23-py3.7.zip
如何使用SAM CLI执行相同操作?请举例说明template.yaml
答案 0 :(得分:0)
我必须解压缩,这是解决方案:
AwswranglerLayer :
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: !Join ['-', [!Ref Project, !Ref Environment, 'AwswranglerLayer']]
ContentUri: ../layers/awswrangler/
Description: "ETL and wrangling utility belt to handle data on AWS. Pandas, PySpark"
CompatibleRuntimes:
- python3.7
- python3.8
RetentionPolicy: Retain
答案 1 :(得分:0)
AwswranglerLayer: 类型:AWS :: Serverless :: LayerVersion 特性: LayerName:!Sub'$ {EnvironmentKey} -AwswranglerLayer' 兼容的运行时间: -nodejs12.x ContentUri:AwswranglerLayerPath /