sparse-intern-71089
04/21/2023, 9:40 AMbrave-planet-10645
04/21/2023, 9:45 AMCallbackFunctionbrave-planet-10645
04/21/2023, 9:47 AMlambda.Functionhelpful-winter-64866
04/21/2023, 9:50 AMlambda.Functionbrave-planet-10645
04/21/2023, 9:51 AMpulumi uphelpful-winter-64866
04/21/2023, 9:52 AMdry-pilot-49577
04/21/2023, 11:22 PMimport * as awsnative from "@pulumi/aws-native";
export const lambdaStore = new awsnative.s3.Bucket("lambda_artifacts", {
  // note: do not rename a bucket
  // <https://github.com/pulumi/pulumi-aws-native/issues/584>
  bucketName: "s3.lambda.artifacts",
  accessControl: "Private",
  versioningConfiguration: {
    status: "Enabled",
  },
  lifecycleConfiguration: {
    rules: [
      {
        id: "keepLastX",
        status: "Enabled",
        noncurrentVersionExpiration: {
          // keep last 10, even if a service isn't touched for a while
          newerNoncurrentVersions: 10,
          // keep anything from last 30 days
          noncurrentDays: 30,
        },
      },
    ],
  },
});import * as pulumi from "@pulumi/pulumi";
import * as awsnative from "@pulumi/aws-native";
import * as aws from "@pulumi/aws";
import { lambdaStore } from "../../services/s3.js";
const LAMBDA_NAME = "graphql-prov";
const file = new aws.s3.BucketObjectv2(LAMBDA_NAME, {
  bucket: lambdaStore.id,
  key: `${LAMBDA_NAME}.zip`,
  source: new pulumi.asset.FileArchive(
    "./artifacts/lambdas/graphql-public.zip"
  ),
});
export const fn = new awsnative.lambda.Function(LAMBDA_NAME, {
  role: role.arn,
  memorySize: 128,
  architectures: ["arm64"],
  runtime: "nodejs16.x",
  handler: "index.handler",
  code: {
    s3Bucket: lambdaStore.id,
    s3Key: file.key,
    s3ObjectVersion: file.versionId,
  },
});