How do I create a lambda function with an existing...
# general
h
How do I create a lambda function with an existing zip archive? I tried something like this
Copy code
let lambda = new aws.lambda.Function("test-lambda", {
    runtime: aws.lambda.Go1dxRuntime,
    code: new pulumi.asset.FileAsset("/tmp/artifacts/aws_lambda.zip"),
    timeout: 300,
    handler: "server",
    role: role.arn,
    environment: {
        variables: {
            "FOO": "bar"
        }
    },
});
but I'm getting an error
error: expected an asset, but filename is not an asset
w
I think
pulumi.asset.FileArchive
should work here - but not at my laptop to verify.
h
I thought file archive took files and turned them into a zip file.
But in my case I already have a zip file.
er wait, no that does take a path
oh AssetArchive is what bundles them I guess
w
Yes - that’s right. You can use
AssetArchive
to create a zip on the fly from other assets. But ‘FileArchive` should work for cases where you already have the archive.
h
cool, thanks