我想在lambda函数中使用Boto3 put_bucket_encryption,但当前的Lambda execution enviornment是在botocore版本1.7.37,并且put_bucket_encryption是在botocore 1.7.41中引入的 .
所以我想打包我的本地版本的boto3 / botocore .
我使用serverless framework和serverless-python-requirements在lambda函数中包含了pip包,但它似乎不适用于boto3 / botocore .
该函数响应 CreateBucket
事件并尝试put_bucket_encryption,但失败了
'S3' object has no attribute 'put_bucket_encryption': AttributeError
如何强制我的lambda函数使用更新的botocore?
1 回答
能够用kichik的帮助解决
我错过的是serverless-python-requirements文档中关于omitting packages的部分 . 特别:
所以在我的
serverless.yml
中我补充道部署后,它使用的是我的打包版本的boto3 / botocore