有人可以帮助我使用Python CDK代码部署Java Lambda的语法吗?下面是Iam用来部署python编写的Lambda的Python CDK代码片段。
handler = lmb.Function(self, 'Handler',
runtime=lmb.Runtime.PYTHON_3_7,
handler='handler.handler',
code=lmb.Code.from_asset(path.join(this_dir, 'lambda')))
下面是我的同事使用的Java CDK代码片段:
Function javafunc = new Function(this, CommonFunctions.getPropValues("HANDLER"),
FunctionProps.builder()
.runtime(Runtime.JAVA_8)
.handler(CommonFunctions.getPropValues("Java_LAMBDA"))
.code(Code.fromAsset(tmpBinDir + "/"+CommonFunctions.getPropValues("JAR_FILE_NAME")))
.timeout(Duration.seconds(300))
.memorySize(512)
.functionName(CommonFunctions.getPropValues("FUNCTION_NAME"))
.build());
我不知道Java,我需要使用Python CDK部署Java编译的Lambda jar。
发布于 2021-02-19 20:30:47
我们需要这些进口
from aws_cdk import (
core,
aws_lambda,
)
code:jar文件路径handler:mainClassName::methodName
aws_lambda.Function(
self, "MyLambda",
code=aws_lambda.Code.from_asset(path='javaProjects/path/to/jar/my-lambda-1.0.jar'),
handler='com.test.handler.StreamLambdaHandler::handleRequest',
runtime=aws_lambda.Runtime.JAVA_11,
environment={
'ENV_APPLICATION_NAME': 'anyValue')
},
memory_size=1024,
timeout=core.Duration.seconds(30)
)
https://stackoverflow.com/questions/66274589
复制相似问题