【发布时间】:2021-07-29 05:17:00
【问题描述】:
我在 PyCharm 中创建了一个 python 包,这是文件夹结构
我正在尝试使用 Cloud Formation Template 将其部署到 AWS Lambda,并使用以下模板。 code.zip 放置在 S3 存储桶中,在部署期间将从该存储桶中获取它。
AWSTemplateFormatVersion: '2010-09-09'
Description: Lambda function
Resources:
Function:
Type: AWS::Lambda::Function
Properties:
FunctionName: code
Handler: index.lambda_handler
Role: arn:aws:iam::xxxxxxxxxxxx:role/lambdaExecutionRole11030037
Code:
S3Bucket: apicode11
S3Key: code.zip
Runtime: python3.8
Timeout: 15
在 Lambda 中成功部署后,代码的文件夹结构正在发生变化,并且父文件夹名称正在附加到所有文件中
请帮助我了解是否需要对代码结构或 CFT 进行任何更改,以便在 Lambda 中不附加父文件夹名称
【问题讨论】:
-
你是如何创建
code.zip的? -
@jellycsc code.zip 是使用 power shell 'Compress-Archive code code.zip' 创建的,并且也在 Windows 中正常创建,即右键单击 Compressed
标签: python-3.x amazon-web-services aws-lambda amazon-cloudformation aws-codepipeline