published on Wednesday, Mar 11, 2026 by Pulumi
published on Wednesday, Mar 11, 2026 by Pulumi
Provides details about an AWS Lambda Layer Version. Use this data source to retrieve information about a specific layer version or find the latest version compatible with your runtime and architecture requirements.
Example Usage
Get Latest Layer Version
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.lambda.getLayerVersion({
layerName: "my-shared-utilities",
});
// Use the layer in a Lambda function
const exampleFunction = new aws.lambda.Function("example", {
code: new pulumi.asset.FileArchive("function.zip"),
name: "example_function",
role: lambdaRole.arn,
handler: "index.handler",
runtime: aws.lambda.Runtime.NodeJS20dX,
layers: [example.then(example => example.arn)],
});
import pulumi
import pulumi_aws as aws
example = aws.lambda.get_layer_version(layer_name="my-shared-utilities")
# Use the layer in a Lambda function
example_function = aws.lambda_.Function("example",
code=pulumi.FileArchive("function.zip"),
name="example_function",
role=lambda_role["arn"],
handler="index.handler",
runtime=aws.lambda_.Runtime.NODE_JS20D_X,
layers=[example.arn])
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/lambda"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := lambda.LookupLayerVersion(ctx, &lambda.LookupLayerVersionArgs{
LayerName: pulumi.StringRef("my-shared-utilities"),
}, nil)
if err != nil {
return err
}
// Use the layer in a Lambda function
_, err = lambda.NewFunction(ctx, "example", &lambda.FunctionArgs{
Code: pulumi.NewFileArchive("function.zip"),
Name: pulumi.String("example_function"),
Role: pulumi.Any(lambdaRole.Arn),
Handler: pulumi.String("index.handler"),
Runtime: pulumi.String(lambda.RuntimeNodeJS20dX),
Layers: pulumi.StringArray{
pulumi.String(example.Arn),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.Lambda.GetLayerVersion.Invoke(new()
{
LayerName = "my-shared-utilities",
});
// Use the layer in a Lambda function
var exampleFunction = new Aws.Lambda.Function("example", new()
{
Code = new FileArchive("function.zip"),
Name = "example_function",
Role = lambdaRole.Arn,
Handler = "index.handler",
Runtime = Aws.Lambda.Runtime.NodeJS20dX,
Layers = new[]
{
example.Apply(getLayerVersionResult => getLayerVersionResult.Arn),
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lambda.LambdaFunctions;
import com.pulumi.aws.lambda.inputs.GetLayerVersionArgs;
import com.pulumi.aws.lambda.Function;
import com.pulumi.aws.lambda.FunctionArgs;
import com.pulumi.asset.FileArchive;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = LambdaFunctions.getLayerVersion(GetLayerVersionArgs.builder()
.layerName("my-shared-utilities")
.build());
// Use the layer in a Lambda function
var exampleFunction = new Function("exampleFunction", FunctionArgs.builder()
.code(new FileArchive("function.zip"))
.name("example_function")
.role(lambdaRole.arn())
.handler("index.handler")
.runtime("nodejs20.x")
.layers(example.arn())
.build());
}
}
resources:
# Use the layer in a Lambda function
exampleFunction:
type: aws:lambda:Function
name: example
properties:
code:
fn::FileArchive: function.zip
name: example_function
role: ${lambdaRole.arn}
handler: index.handler
runtime: nodejs20.x
layers:
- ${example.arn}
variables:
example:
fn::invoke:
function: aws:lambda:getLayerVersion
arguments:
layerName: my-shared-utilities
Get Specific Layer Version
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.lambda.getLayerVersion({
layerName: "production-utilities",
version: 5,
});
export const layerInfo = {
arn: example.then(example => example.arn),
version: example.then(example => example.version),
description: example.then(example => example.description),
};
import pulumi
import pulumi_aws as aws
example = aws.lambda.get_layer_version(layer_name="production-utilities",
version=5)
pulumi.export("layerInfo", {
"arn": example.arn,
"version": example.version,
"description": example.description,
})
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/lambda"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := lambda.LookupLayerVersion(ctx, &lambda.LookupLayerVersionArgs{
LayerName: pulumi.StringRef("production-utilities"),
Version: pulumi.IntRef(5),
}, nil)
if err != nil {
return err
}
ctx.Export("layerInfo", pulumi.Map{
"arn": example.Arn,
"version": example.Version,
"description": example.Description,
})
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.Lambda.GetLayerVersion.Invoke(new()
{
LayerName = "production-utilities",
Version = 5,
});
return new Dictionary<string, object?>
{
["layerInfo"] =
{
{ "arn", example.Apply(getLayerVersionResult => getLayerVersionResult.Arn) },
{ "version", example.Apply(getLayerVersionResult => getLayerVersionResult.Version) },
{ "description", example.Apply(getLayerVersionResult => getLayerVersionResult.Description) },
},
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lambda.LambdaFunctions;
import com.pulumi.aws.lambda.inputs.GetLayerVersionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = LambdaFunctions.getLayerVersion(GetLayerVersionArgs.builder()
.layerName("production-utilities")
.version(5)
.build());
ctx.export("layerInfo", Map.ofEntries(
Map.entry("arn", example.arn()),
Map.entry("version", example.version()),
Map.entry("description", example.description())
));
}
}
variables:
example:
fn::invoke:
function: aws:lambda:getLayerVersion
arguments:
layerName: production-utilities
version: 5
outputs:
layerInfo:
arn: ${example.arn}
version: ${example.version}
description: ${example.description}
Get Latest Compatible Layer Version
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// Find latest layer version compatible with Python 3.12
const pythonLayer = aws.lambda.getLayerVersion({
layerName: "python-dependencies",
compatibleRuntime: "python3.12",
});
// Find latest layer version compatible with ARM64 architecture
const armLayer = aws.lambda.getLayerVersion({
layerName: "optimized-libraries",
compatibleArchitecture: "arm64",
});
// Use both layers in a function
const example = new aws.lambda.Function("example", {
code: new pulumi.asset.FileArchive("function.zip"),
name: "multi_layer_function",
role: lambdaRole.arn,
handler: "app.handler",
runtime: aws.lambda.Runtime.Python3d12,
architectures: ["arm64"],
layers: [
pythonLayer.then(pythonLayer => pythonLayer.arn),
armLayer.then(armLayer => armLayer.arn),
],
});
import pulumi
import pulumi_aws as aws
# Find latest layer version compatible with Python 3.12
python_layer = aws.lambda.get_layer_version(layer_name="python-dependencies",
compatible_runtime="python3.12")
# Find latest layer version compatible with ARM64 architecture
arm_layer = aws.lambda.get_layer_version(layer_name="optimized-libraries",
compatible_architecture="arm64")
# Use both layers in a function
example = aws.lambda_.Function("example",
code=pulumi.FileArchive("function.zip"),
name="multi_layer_function",
role=lambda_role["arn"],
handler="app.handler",
runtime=aws.lambda_.Runtime.PYTHON3D12,
architectures=["arm64"],
layers=[
python_layer.arn,
arm_layer.arn,
])
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/lambda"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Find latest layer version compatible with Python 3.12
pythonLayer, err := lambda.LookupLayerVersion(ctx, &lambda.LookupLayerVersionArgs{
LayerName: pulumi.StringRef("python-dependencies"),
CompatibleRuntime: pulumi.StringRef("python3.12"),
}, nil)
if err != nil {
return err
}
// Find latest layer version compatible with ARM64 architecture
armLayer, err := lambda.LookupLayerVersion(ctx, &lambda.LookupLayerVersionArgs{
LayerName: pulumi.StringRef("optimized-libraries"),
CompatibleArchitecture: pulumi.StringRef("arm64"),
}, nil)
if err != nil {
return err
}
// Use both layers in a function
_, err = lambda.NewFunction(ctx, "example", &lambda.FunctionArgs{
Code: pulumi.NewFileArchive("function.zip"),
Name: pulumi.String("multi_layer_function"),
Role: pulumi.Any(lambdaRole.Arn),
Handler: pulumi.String("app.handler"),
Runtime: pulumi.String(lambda.RuntimePython3d12),
Architectures: pulumi.StringArray{
pulumi.String("arm64"),
},
Layers: pulumi.StringArray{
pulumi.String(pythonLayer.Arn),
pulumi.String(armLayer.Arn),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
// Find latest layer version compatible with Python 3.12
var pythonLayer = Aws.Lambda.GetLayerVersion.Invoke(new()
{
LayerName = "python-dependencies",
CompatibleRuntime = "python3.12",
});
// Find latest layer version compatible with ARM64 architecture
var armLayer = Aws.Lambda.GetLayerVersion.Invoke(new()
{
LayerName = "optimized-libraries",
CompatibleArchitecture = "arm64",
});
// Use both layers in a function
var example = new Aws.Lambda.Function("example", new()
{
Code = new FileArchive("function.zip"),
Name = "multi_layer_function",
Role = lambdaRole.Arn,
Handler = "app.handler",
Runtime = Aws.Lambda.Runtime.Python3d12,
Architectures = new[]
{
"arm64",
},
Layers = new[]
{
pythonLayer.Apply(getLayerVersionResult => getLayerVersionResult.Arn),
armLayer.Apply(getLayerVersionResult => getLayerVersionResult.Arn),
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lambda.LambdaFunctions;
import com.pulumi.aws.lambda.inputs.GetLayerVersionArgs;
import com.pulumi.aws.lambda.Function;
import com.pulumi.aws.lambda.FunctionArgs;
import com.pulumi.asset.FileArchive;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
// Find latest layer version compatible with Python 3.12
final var pythonLayer = LambdaFunctions.getLayerVersion(GetLayerVersionArgs.builder()
.layerName("python-dependencies")
.compatibleRuntime("python3.12")
.build());
// Find latest layer version compatible with ARM64 architecture
final var armLayer = LambdaFunctions.getLayerVersion(GetLayerVersionArgs.builder()
.layerName("optimized-libraries")
.compatibleArchitecture("arm64")
.build());
// Use both layers in a function
var example = new Function("example", FunctionArgs.builder()
.code(new FileArchive("function.zip"))
.name("multi_layer_function")
.role(lambdaRole.arn())
.handler("app.handler")
.runtime("python3.12")
.architectures("arm64")
.layers(
pythonLayer.arn(),
armLayer.arn())
.build());
}
}
resources:
# Use both layers in a function
example:
type: aws:lambda:Function
properties:
code:
fn::FileArchive: function.zip
name: multi_layer_function
role: ${lambdaRole.arn}
handler: app.handler
runtime: python3.12
architectures:
- arm64
layers:
- ${pythonLayer.arn}
- ${armLayer.arn}
variables:
# Find latest layer version compatible with Python 3.12
pythonLayer:
fn::invoke:
function: aws:lambda:getLayerVersion
arguments:
layerName: python-dependencies
compatibleRuntime: python3.12
# Find latest layer version compatible with ARM64 architecture
armLayer:
fn::invoke:
function: aws:lambda:getLayerVersion
arguments:
layerName: optimized-libraries
compatibleArchitecture: arm64
Compare Layer Versions
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// Get latest version
const latest = aws.lambda.getLayerVersion({
layerName: "shared-layer",
});
// Get specific version for comparison
const stable = aws.lambda.getLayerVersion({
layerName: "shared-layer",
version: 3,
});
const useLatestLayer = latest.then(latest => latest.version > 5);
const selectedLayer = useLatestLayer ? latest.then(latest => latest.arn) : stable.then(stable => stable.arn);
export const selectedLayerVersion = useLatestLayer ? latest.then(latest => latest.version) : stable.then(stable => stable.version);
import pulumi
import pulumi_aws as aws
# Get latest version
latest = aws.lambda.get_layer_version(layer_name="shared-layer")
# Get specific version for comparison
stable = aws.lambda.get_layer_version(layer_name="shared-layer",
version=3)
use_latest_layer = latest.version > 5
selected_layer = latest.arn if use_latest_layer else stable.arn
pulumi.export("selectedLayerVersion", latest.version if use_latest_layer else stable.version)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/lambda"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Get latest version
latest, err := lambda.LookupLayerVersion(ctx, &lambda.LookupLayerVersionArgs{
LayerName: pulumi.StringRef("shared-layer"),
}, nil)
if err != nil {
return err
}
// Get specific version for comparison
stable, err := lambda.LookupLayerVersion(ctx, &lambda.LookupLayerVersionArgs{
LayerName: pulumi.StringRef("shared-layer"),
Version: pulumi.IntRef(3),
}, nil)
if err != nil {
return err
}
useLatestLayer := latest.Version > 5
var tmp0 *string
if useLatestLayer {
tmp0 = latest.Arn
} else {
tmp0 = stable.Arn
}
_ := tmp0
var tmp1 *int
if useLatestLayer {
tmp1 = latest.Version
} else {
tmp1 = stable.Version
}
ctx.Export("selectedLayerVersion", tmp1)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
// Get latest version
var latest = Aws.Lambda.GetLayerVersion.Invoke(new()
{
LayerName = "shared-layer",
});
// Get specific version for comparison
var stable = Aws.Lambda.GetLayerVersion.Invoke(new()
{
LayerName = "shared-layer",
Version = 3,
});
var useLatestLayer = latest.Apply(getLayerVersionResult => getLayerVersionResult.Version) > 5;
var selectedLayer = useLatestLayer ? latest.Apply(getLayerVersionResult => getLayerVersionResult.Arn) : stable.Apply(getLayerVersionResult => getLayerVersionResult.Arn);
return new Dictionary<string, object?>
{
["selectedLayerVersion"] = useLatestLayer ? latest.Apply(getLayerVersionResult => getLayerVersionResult.Version) : stable.Apply(getLayerVersionResult => getLayerVersionResult.Version),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lambda.LambdaFunctions;
import com.pulumi.aws.lambda.inputs.GetLayerVersionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
// Get latest version
final var latest = LambdaFunctions.getLayerVersion(GetLayerVersionArgs.builder()
.layerName("shared-layer")
.build());
// Get specific version for comparison
final var stable = LambdaFunctions.getLayerVersion(GetLayerVersionArgs.builder()
.layerName("shared-layer")
.version(3)
.build());
final var useLatestLayer = latest.version() > 5;
final var selectedLayer = useLatestLayer ? latest.arn() : stable.arn();
ctx.export("selectedLayerVersion", useLatestLayer ? latest.version() : stable.version());
}
}
Example coming soon!
Cross-Account Layer Access
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// Reference a layer from another AWS account using full ARN with version
const sharedLayer = aws.lambda.getLayerVersion({
layerVersionArn: "arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities:5",
});
// Use in your Lambda function
const example = new aws.lambda.Function("example", {
code: new pulumi.asset.FileArchive("function.zip"),
name: "cross_account_example",
role: lambdaRole.arn,
handler: "index.handler",
runtime: aws.lambda.Runtime.NodeJS20dX,
layers: [sharedLayer.then(sharedLayer => sharedLayer.arn)],
});
import pulumi
import pulumi_aws as aws
# Reference a layer from another AWS account using full ARN with version
shared_layer = aws.lambda.get_layer_version(layer_version_arn="arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities:5")
# Use in your Lambda function
example = aws.lambda_.Function("example",
code=pulumi.FileArchive("function.zip"),
name="cross_account_example",
role=lambda_role["arn"],
handler="index.handler",
runtime=aws.lambda_.Runtime.NODE_JS20D_X,
layers=[shared_layer.arn])
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/lambda"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Reference a layer from another AWS account using full ARN with version
sharedLayer, err := lambda.LookupLayerVersion(ctx, &lambda.LookupLayerVersionArgs{
LayerVersionArn: pulumi.StringRef("arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities:5"),
}, nil)
if err != nil {
return err
}
// Use in your Lambda function
_, err = lambda.NewFunction(ctx, "example", &lambda.FunctionArgs{
Code: pulumi.NewFileArchive("function.zip"),
Name: pulumi.String("cross_account_example"),
Role: pulumi.Any(lambdaRole.Arn),
Handler: pulumi.String("index.handler"),
Runtime: pulumi.String(lambda.RuntimeNodeJS20dX),
Layers: pulumi.StringArray{
pulumi.String(sharedLayer.Arn),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
// Reference a layer from another AWS account using full ARN with version
var sharedLayer = Aws.Lambda.GetLayerVersion.Invoke(new()
{
LayerVersionArn = "arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities:5",
});
// Use in your Lambda function
var example = new Aws.Lambda.Function("example", new()
{
Code = new FileArchive("function.zip"),
Name = "cross_account_example",
Role = lambdaRole.Arn,
Handler = "index.handler",
Runtime = Aws.Lambda.Runtime.NodeJS20dX,
Layers = new[]
{
sharedLayer.Apply(getLayerVersionResult => getLayerVersionResult.Arn),
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lambda.LambdaFunctions;
import com.pulumi.aws.lambda.inputs.GetLayerVersionArgs;
import com.pulumi.aws.lambda.Function;
import com.pulumi.aws.lambda.FunctionArgs;
import com.pulumi.asset.FileArchive;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
// Reference a layer from another AWS account using full ARN with version
final var sharedLayer = LambdaFunctions.getLayerVersion(GetLayerVersionArgs.builder()
.layerVersionArn("arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities:5")
.build());
// Use in your Lambda function
var example = new Function("example", FunctionArgs.builder()
.code(new FileArchive("function.zip"))
.name("cross_account_example")
.role(lambdaRole.arn())
.handler("index.handler")
.runtime("nodejs20.x")
.layers(sharedLayer.arn())
.build());
}
}
resources:
# Use in your Lambda function
example:
type: aws:lambda:Function
properties:
code:
fn::FileArchive: function.zip
name: cross_account_example
role: ${lambdaRole.arn}
handler: index.handler
runtime: nodejs20.x
layers:
- ${sharedLayer.arn}
variables:
# Reference a layer from another AWS account using full ARN with version
sharedLayer:
fn::invoke:
function: aws:lambda:getLayerVersion
arguments:
layerVersionArn: arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities:5
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// Reference a layer ARN without version (requires ListLayerVersions permission)
const latestShared = aws.lambda.getLayerVersion({
layerVersionArn: "arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities",
});
import pulumi
import pulumi_aws as aws
# Reference a layer ARN without version (requires ListLayerVersions permission)
latest_shared = aws.lambda.get_layer_version(layer_version_arn="arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities")
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/lambda"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Reference a layer ARN without version (requires ListLayerVersions permission)
_, err := lambda.LookupLayerVersion(ctx, &lambda.LookupLayerVersionArgs{
LayerVersionArn: pulumi.StringRef("arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities"),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
// Reference a layer ARN without version (requires ListLayerVersions permission)
var latestShared = Aws.Lambda.GetLayerVersion.Invoke(new()
{
LayerVersionArn = "arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lambda.LambdaFunctions;
import com.pulumi.aws.lambda.inputs.GetLayerVersionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
// Reference a layer ARN without version (requires ListLayerVersions permission)
final var latestShared = LambdaFunctions.getLayerVersion(GetLayerVersionArgs.builder()
.layerVersionArn("arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities")
.build());
}
}
variables:
# Reference a layer ARN without version (requires ListLayerVersions permission)
latestShared:
fn::invoke:
function: aws:lambda:getLayerVersion
arguments:
layerVersionArn: arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities
Using getLayerVersion
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getLayerVersion(args: GetLayerVersionArgs, opts?: InvokeOptions): Promise<GetLayerVersionResult>
function getLayerVersionOutput(args: GetLayerVersionOutputArgs, opts?: InvokeOptions): Output<GetLayerVersionResult>def get_layer_version(compatible_architecture: Optional[str] = None,
compatible_runtime: Optional[str] = None,
layer_name: Optional[str] = None,
layer_version_arn: Optional[str] = None,
region: Optional[str] = None,
version: Optional[int] = None,
opts: Optional[InvokeOptions] = None) -> GetLayerVersionResult
def get_layer_version_output(compatible_architecture: Optional[pulumi.Input[str]] = None,
compatible_runtime: Optional[pulumi.Input[str]] = None,
layer_name: Optional[pulumi.Input[str]] = None,
layer_version_arn: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
version: Optional[pulumi.Input[int]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetLayerVersionResult]func LookupLayerVersion(ctx *Context, args *LookupLayerVersionArgs, opts ...InvokeOption) (*LookupLayerVersionResult, error)
func LookupLayerVersionOutput(ctx *Context, args *LookupLayerVersionOutputArgs, opts ...InvokeOption) LookupLayerVersionResultOutput> Note: This function is named LookupLayerVersion in the Go SDK.
public static class GetLayerVersion
{
public static Task<GetLayerVersionResult> InvokeAsync(GetLayerVersionArgs args, InvokeOptions? opts = null)
public static Output<GetLayerVersionResult> Invoke(GetLayerVersionInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetLayerVersionResult> getLayerVersion(GetLayerVersionArgs args, InvokeOptions options)
public static Output<GetLayerVersionResult> getLayerVersion(GetLayerVersionArgs args, InvokeOptions options)
fn::invoke:
function: aws:lambda/getLayerVersion:getLayerVersion
arguments:
# arguments dictionaryThe following arguments are supported:
- Compatible
Architecture string - Specific architecture the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided architecture will be used. - Compatible
Runtime string - Specific runtime the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided runtime will be used. - Layer
Name string - Name of the Lambda layer.
- Layer
Version stringArn ARN of the Lambda layer version. Can be a full ARN with version (e.g.,
arn:aws:lambda:region:account:layer:name:1) or without version (e.g.,arn:aws:lambda:region:account:layer:name). When the version is omitted, the latest version will be retrieved (requireslambda:ListLayerVersionspermission). Use the full ARN with version for cross-account layers where you don't have list permissions.The following are optional when using
layer_name:- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Version int
- Specific layer version. Conflicts with
compatible_runtime,compatible_architecture, andlayer_version_arn. If omitted, the latest available layer version will be used.
- Compatible
Architecture string - Specific architecture the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided architecture will be used. - Compatible
Runtime string - Specific runtime the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided runtime will be used. - Layer
Name string - Name of the Lambda layer.
- Layer
Version stringArn ARN of the Lambda layer version. Can be a full ARN with version (e.g.,
arn:aws:lambda:region:account:layer:name:1) or without version (e.g.,arn:aws:lambda:region:account:layer:name). When the version is omitted, the latest version will be retrieved (requireslambda:ListLayerVersionspermission). Use the full ARN with version for cross-account layers where you don't have list permissions.The following are optional when using
layer_name:- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Version int
- Specific layer version. Conflicts with
compatible_runtime,compatible_architecture, andlayer_version_arn. If omitted, the latest available layer version will be used.
- compatible
Architecture String - Specific architecture the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided architecture will be used. - compatible
Runtime String - Specific runtime the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided runtime will be used. - layer
Name String - Name of the Lambda layer.
- layer
Version StringArn ARN of the Lambda layer version. Can be a full ARN with version (e.g.,
arn:aws:lambda:region:account:layer:name:1) or without version (e.g.,arn:aws:lambda:region:account:layer:name). When the version is omitted, the latest version will be retrieved (requireslambda:ListLayerVersionspermission). Use the full ARN with version for cross-account layers where you don't have list permissions.The following are optional when using
layer_name:- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- version Integer
- Specific layer version. Conflicts with
compatible_runtime,compatible_architecture, andlayer_version_arn. If omitted, the latest available layer version will be used.
- compatible
Architecture string - Specific architecture the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided architecture will be used. - compatible
Runtime string - Specific runtime the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided runtime will be used. - layer
Name string - Name of the Lambda layer.
- layer
Version stringArn ARN of the Lambda layer version. Can be a full ARN with version (e.g.,
arn:aws:lambda:region:account:layer:name:1) or without version (e.g.,arn:aws:lambda:region:account:layer:name). When the version is omitted, the latest version will be retrieved (requireslambda:ListLayerVersionspermission). Use the full ARN with version for cross-account layers where you don't have list permissions.The following are optional when using
layer_name:- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- version number
- Specific layer version. Conflicts with
compatible_runtime,compatible_architecture, andlayer_version_arn. If omitted, the latest available layer version will be used.
- compatible_
architecture str - Specific architecture the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided architecture will be used. - compatible_
runtime str - Specific runtime the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided runtime will be used. - layer_
name str - Name of the Lambda layer.
- layer_
version_ strarn ARN of the Lambda layer version. Can be a full ARN with version (e.g.,
arn:aws:lambda:region:account:layer:name:1) or without version (e.g.,arn:aws:lambda:region:account:layer:name). When the version is omitted, the latest version will be retrieved (requireslambda:ListLayerVersionspermission). Use the full ARN with version for cross-account layers where you don't have list permissions.The following are optional when using
layer_name:- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- version int
- Specific layer version. Conflicts with
compatible_runtime,compatible_architecture, andlayer_version_arn. If omitted, the latest available layer version will be used.
- compatible
Architecture String - Specific architecture the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided architecture will be used. - compatible
Runtime String - Specific runtime the layer version must support. Conflicts with
versionandlayer_version_arn. If specified, the latest available layer version supporting the provided runtime will be used. - layer
Name String - Name of the Lambda layer.
- layer
Version StringArn ARN of the Lambda layer version. Can be a full ARN with version (e.g.,
arn:aws:lambda:region:account:layer:name:1) or without version (e.g.,arn:aws:lambda:region:account:layer:name). When the version is omitted, the latest version will be retrieved (requireslambda:ListLayerVersionspermission). Use the full ARN with version for cross-account layers where you don't have list permissions.The following are optional when using
layer_name:- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- version Number
- Specific layer version. Conflicts with
compatible_runtime,compatible_architecture, andlayer_version_arn. If omitted, the latest available layer version will be used.
getLayerVersion Result
The following output properties are available:
- Arn string
- ARN of the Lambda Layer with version.
- Code
Sha256 string - Base64-encoded representation of raw SHA-256 sum of the zip file.
- Compatible
Architectures List<string> - List of Architectures the specific Lambda Layer version is compatible with.
- Compatible
Runtimes List<string> - List of Runtimes the specific Lambda Layer version is compatible with.
- Created
Date string - Date this resource was created.
- Description string
- Description of the specific Lambda Layer version.
- Id string
- The provider-assigned unique ID for this managed resource.
- Layer
Arn string - ARN of the Lambda Layer without version.
- Layer
Name string - Layer
Version stringArn - License
Info string - License info associated with the specific Lambda Layer version.
- Region string
- Signing
Job stringArn - ARN of a signing job.
- Signing
Profile stringVersion Arn - ARN for a signing profile version.
- Source
Code stringHash - (Deprecated use
code_sha256instead) Base64-encoded representation of raw SHA-256 sum of the zip file. - Source
Code intSize - Size in bytes of the function .zip file.
- Version int
- Compatible
Architecture string - Compatible
Runtime string
- Arn string
- ARN of the Lambda Layer with version.
- Code
Sha256 string - Base64-encoded representation of raw SHA-256 sum of the zip file.
- Compatible
Architectures []string - List of Architectures the specific Lambda Layer version is compatible with.
- Compatible
Runtimes []string - List of Runtimes the specific Lambda Layer version is compatible with.
- Created
Date string - Date this resource was created.
- Description string
- Description of the specific Lambda Layer version.
- Id string
- The provider-assigned unique ID for this managed resource.
- Layer
Arn string - ARN of the Lambda Layer without version.
- Layer
Name string - Layer
Version stringArn - License
Info string - License info associated with the specific Lambda Layer version.
- Region string
- Signing
Job stringArn - ARN of a signing job.
- Signing
Profile stringVersion Arn - ARN for a signing profile version.
- Source
Code stringHash - (Deprecated use
code_sha256instead) Base64-encoded representation of raw SHA-256 sum of the zip file. - Source
Code intSize - Size in bytes of the function .zip file.
- Version int
- Compatible
Architecture string - Compatible
Runtime string
- arn String
- ARN of the Lambda Layer with version.
- code
Sha256 String - Base64-encoded representation of raw SHA-256 sum of the zip file.
- compatible
Architectures List<String> - List of Architectures the specific Lambda Layer version is compatible with.
- compatible
Runtimes List<String> - List of Runtimes the specific Lambda Layer version is compatible with.
- created
Date String - Date this resource was created.
- description String
- Description of the specific Lambda Layer version.
- id String
- The provider-assigned unique ID for this managed resource.
- layer
Arn String - ARN of the Lambda Layer without version.
- layer
Name String - layer
Version StringArn - license
Info String - License info associated with the specific Lambda Layer version.
- region String
- signing
Job StringArn - ARN of a signing job.
- signing
Profile StringVersion Arn - ARN for a signing profile version.
- source
Code StringHash - (Deprecated use
code_sha256instead) Base64-encoded representation of raw SHA-256 sum of the zip file. - source
Code IntegerSize - Size in bytes of the function .zip file.
- version Integer
- compatible
Architecture String - compatible
Runtime String
- arn string
- ARN of the Lambda Layer with version.
- code
Sha256 string - Base64-encoded representation of raw SHA-256 sum of the zip file.
- compatible
Architectures string[] - List of Architectures the specific Lambda Layer version is compatible with.
- compatible
Runtimes string[] - List of Runtimes the specific Lambda Layer version is compatible with.
- created
Date string - Date this resource was created.
- description string
- Description of the specific Lambda Layer version.
- id string
- The provider-assigned unique ID for this managed resource.
- layer
Arn string - ARN of the Lambda Layer without version.
- layer
Name string - layer
Version stringArn - license
Info string - License info associated with the specific Lambda Layer version.
- region string
- signing
Job stringArn - ARN of a signing job.
- signing
Profile stringVersion Arn - ARN for a signing profile version.
- source
Code stringHash - (Deprecated use
code_sha256instead) Base64-encoded representation of raw SHA-256 sum of the zip file. - source
Code numberSize - Size in bytes of the function .zip file.
- version number
- compatible
Architecture string - compatible
Runtime string
- arn str
- ARN of the Lambda Layer with version.
- code_
sha256 str - Base64-encoded representation of raw SHA-256 sum of the zip file.
- compatible_
architectures Sequence[str] - List of Architectures the specific Lambda Layer version is compatible with.
- compatible_
runtimes Sequence[str] - List of Runtimes the specific Lambda Layer version is compatible with.
- created_
date str - Date this resource was created.
- description str
- Description of the specific Lambda Layer version.
- id str
- The provider-assigned unique ID for this managed resource.
- layer_
arn str - ARN of the Lambda Layer without version.
- layer_
name str - layer_
version_ strarn - license_
info str - License info associated with the specific Lambda Layer version.
- region str
- signing_
job_ strarn - ARN of a signing job.
- signing_
profile_ strversion_ arn - ARN for a signing profile version.
- source_
code_ strhash - (Deprecated use
code_sha256instead) Base64-encoded representation of raw SHA-256 sum of the zip file. - source_
code_ intsize - Size in bytes of the function .zip file.
- version int
- compatible_
architecture str - compatible_
runtime str
- arn String
- ARN of the Lambda Layer with version.
- code
Sha256 String - Base64-encoded representation of raw SHA-256 sum of the zip file.
- compatible
Architectures List<String> - List of Architectures the specific Lambda Layer version is compatible with.
- compatible
Runtimes List<String> - List of Runtimes the specific Lambda Layer version is compatible with.
- created
Date String - Date this resource was created.
- description String
- Description of the specific Lambda Layer version.
- id String
- The provider-assigned unique ID for this managed resource.
- layer
Arn String - ARN of the Lambda Layer without version.
- layer
Name String - layer
Version StringArn - license
Info String - License info associated with the specific Lambda Layer version.
- region String
- signing
Job StringArn - ARN of a signing job.
- signing
Profile StringVersion Arn - ARN for a signing profile version.
- source
Code StringHash - (Deprecated use
code_sha256instead) Base64-encoded representation of raw SHA-256 sum of the zip file. - source
Code NumberSize - Size in bytes of the function .zip file.
- version Number
- compatible
Architecture String - compatible
Runtime String
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
published on Wednesday, Mar 11, 2026 by Pulumi
