gpt4 book ai didi

java - 如何自动将 jar 从 s3 部署到 aws lambda?

转载 作者:行者123 更新时间:2023-11-29 04:13:05 29 4
gpt4 key购买 nike

每当 s3 bucket 中的 jar 版本发生任何变化时,我想自动将 jar 部署到 aws-lamda

例如:有一个 S3 bucketlambdadeploytest 和一个 Lamda 函数名称 autoDeployTest。我在 lambdadeploytest 中存储了一个对象 test.jar

每当我上传对象test.jar时,test.jar就会自动部署autoDeployTest lambda 函数。

最佳答案

您可以使用 lambda 函数来实现...
在高层次上,步骤是

  • 创建一个 lambda 函数,它将下载 test.jar 并使用该 jar 创建/更新 autoDeployTest lambda 函数。

  • 将新的 lambda 函数配置为在 S3 上修改 test.jar 时触发

  • 配置新的 lambda 函数,使其具有读取 S3 存储桶和在 Lambda 上部署代码的权限。

可以关注this tutorial创建一个将由 S3 事件触发的 lambda 函数。 This is the Lambda API您的 lambda 函数可以调用以更新 autodeployTest 代码。

伪代码是这样的:

read JSON event object to get the bucket name and object name (bucket_name, test.jar)

download a copy of the object (test.jar) to the lambda container

(do additional check on the jar file if required)

call Lambda's UpdateFunctionCode to update autoDeployTest function code with the jar.

关于java - 如何自动将 jar 从 s3 部署到 aws lambda?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53911788/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com