SAMやserverless frameworkではやったことあったけどcdkでは初めてなのでメモ
const regionalUserApiLambda = new lambda.Function(this, 'RegionalUserApi', {
functionName: resources.userApi.lambdaName,
runtime: lambda.Runtime.GO_1_X,
handler: 'main',
memorySize: 128,
timeout : Duration.seconds(10),
code: lambda.Code.fromBucket(resourceBucketRef , resources.userApi.lambdaS3Key)
});
const api = new apigateway.RestApi(this, "RegionalUserApiGateway", {
restApiName: "RegionalUserApiGateway",
description: "regional user api"
});
api.root.addMethod(`ANY` , new apigateway.LambdaIntegration(regionalUserApiLambda))
const anyProxy = api.root.addResource("{proxy+}");
anyProxy.addMethod(`ANY` , new apigateway.LambdaIntegration(regionalUserApiLambda))