Adrián Mouly
11/26/2021, 4:44 AMDockerImageFunction
to an existing API GW v2 created with Api
construct.
Can I use the existing addRoutes
method from Api
or I have to level down to the CDK gw-integration construct?
I did the integration this way:
myApi.httpApi.addRoutes({
path: '/books',
methods: [HttpMethod.GET],
integration: new LambdaProxyIntegration({
handler: lambda,
}),
});
But maybe there is a cleaner way?George Evans
11/26/2021, 9:44 AMconst processFunc = new lambda.DockerImageFunction(this, "ProcessGifUrl", {
code: lambda.DockerImageCode.fromImageAsset("./", { file :"infrastructure/Dockerfile" }),
timeout: Duration.seconds(30),
memorySize: 1024,
environment: {
S3_ASSETS_BUCKET: bucket.s3Bucket.bucketName
}
});
const integration = new LambdaIntegration(processFunc);
const resource = api.restApi.root.addResource("process-gif", {
defaultMethodOptions: {
apiKeyRequired: true,
authorizationType: AuthorizationType.NONE,
}
});
resource.addMethod("POST", integration)
George Evans
11/26/2021, 9:45 AMAdrián Mouly
11/26/2021, 12:24 PMFrank
Frank