Skip to main content

Layer

Provides an Lambda Layer

Examples#

Create a Layer for a Function#

const lambdaPolicy = require("./lambdaPolicy.json");
const lambdaAssumePolicy = require("./lambdaAssumePolicy.json");
const iamPolicy = provider.IAM.makePolicy({
name: "lambda-policy",
properties: () => lambdaPolicy,
});
const iamRole = provider.IAM.makeRole({
name: "lambda-role",
dependencies: { policies: [iamPolicy] },
properties: () => lambdaAssumePolicy,
});
const layer = provider.Lambda.makeLayer({
name: "lambda-layer",
dependencies: { role: iamRole },
properties: () => ({
CompatibleRuntimes: ["nodejs"],
Description: "My Layer",
}),
});
const lambda = provider.Lambda.makeFunction({
name: "lambda-hello-world",
dependencies: { role: iamRole, layers: [layer] },
properties: () => ({
PackageType: "Zip",
Handler: "helloworld.handler",
Runtime: "nodejs14.x",
}),
});

Source Code Examples#

Properties#

Dependencies#

UsedBy#

List#

The list of functions can be displayed and filtered with the type Layer:

gc list -t Layer