sparse-intern-71089
06/30/2023, 2:38 AMgentle-airline-14942
06/30/2023, 3:11 AMindex.ts(12,7): error TS2322: Type 'Function' is not assignable to type 'Input<Function>'.
elegant-gigabyte-8733
06/30/2023, 4:38 AMimport * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";
// Create an AWS resource (S3 Bucket)
const bucket = new aws.s3.Bucket("my-bucket");
// Create the ECR repository to hold our Docker image
const repository = new aws.ecr.Repository("myRepository");
// Create the Docker image
const image = aws.ecr.getRegistry().then(registry => {
const imageName = `${registry.registryId}.<http://dkr.ecr.region.amazonaws.com/${repository.name}`;|dkr.ecr.region.amazonaws.com/${repository.name}`;>
return new docker.Image("myImage", {
imageName: imageName,
build: "./appDir", // directory containing Dockerfile
});
});
// Assume that we have a role for the Lambda to assume
const lambdaRole = aws.iam.getRole({ name: "lambdaRole" });
// Create a Lambda function, using the Docker image
const lambdaFunction = new aws.lambda.Function("mylambda", {
packageType: "Image",
imageUri: image.imageName,
role: lambdaRole.arn
});
// Create a REST API that routes to our Lambda function
const api = new aws.apigatewayv2.Api("myapi", {
protocolType: "HTTP",
target: pulumi.interpolate`${lambdaFunction.arn}:$LATEST`,
});
// Export the ARN of the Lambda Function and the URL of the API Gateway
export const lambdaArn = lambdaFunction.arn;
export const url = api.apiEndpoint;
gentle-airline-14942
06/30/2023, 5:19 PMaws.lambda.FunctionUrl()
?gentle-airline-14942
06/30/2023, 5:20 PMgentle-airline-14942
06/30/2023, 5:26 PMgentle-airline-14942
06/30/2023, 7:30 PMconst lambda = new aws.lambda.Function('my-lambda', {
name: ...
publish: true,
packageType: 'Image',
imageUri: ...
})
// Create a REST API that routes to our Lambda function
const api = new apigatewayv2.Api('ai-lambda-gateway', {
protocolType: 'HTTP',
routeKey: 'POST /pdf/scrape',
target: pulumi.interpolate`${lambda.arn}:${lambda.version}`,
corsConfiguration: {
allowCredentials: false,
allowHeaders: ['*'],
allowMethods: ['POST'],
allowOrigins: ['*'],
},
});
new lambda.Permission('pdf-scraper-perm', {
action: 'lambda:InvokeFunction',
function: lambda,
principal: '<http://apigateway.amazonaws.com|apigateway.amazonaws.com>',
sourceArn: pulumi.interpolate`${api.executionArn}/*/*/pdf/scrape`,
qualifier: lambda.version,
});
gentle-airline-14942
06/30/2023, 8:55 PMelegant-gigabyte-8733
06/30/2023, 8:56 PMgentle-airline-14942
06/30/2023, 8:57 PMelegant-gigabyte-8733
06/30/2023, 8:57 PM