```const assumeRole = aws.iam.getPolicyDocument({ ...
# general
m
Copy code
const assumeRole = aws.iam.getPolicyDocument({
    statements: [{
        effect: "Allow",
        principals: [{
            type: "Service",
            identifiers: ["<http://lambda.amazonaws.com|lambda.amazonaws.com>"],
        }],
        actions: ["sts:AssumeRole"],
    }],
});
const iamForLambda = new aws.iam.Role("iam_for_lambda", {
    name: "iam_for_lambda",
    assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
});
const testLambda = new aws.lambda.Function("test_lambda", {
    code: new pulumi.asset.FileArchive("./lambda/index.js"),
    name: "lambda_function_name",
    role: iamForLambda.arn,
    handler: "index.test",
    runtime: "nodejs18.x",
    ephemeralStorage: {
        size: 10240,
    },
});

// Create an API endpoint
const endpoint = new apigateway.RestAPI("hello-world", {
    routes: [{
        path: "/{route+}",
        method: "GET",
        //@ts-expect-error
        eventHandler: testLambda.handler,
    }],
});