capabilities.work

Find a Compatible Layer Version to Attach

A 3-step recipe with AWS Lambda. We can help you get access.

Recipe · 3 steps

Find a Compatible Layer Version to Attach

Resolve a compatible layer to a specific version ARN a function can reference.

  1. List the account's layers narrowed to those compatible with the target runtime and architecture, showing the latest version of each. Filtering here rather than after the fact avoids surfacing layers the function could never load.
  2. List the versions of the chosen layer. Deleted versions are not returned, so anything listed here can still be attached to a function.
  3. Read the specific layer version to obtain the LayerVersionArn a function's configuration must reference, along with the code size and licence terms worth reviewing before depending on it.
What you'll need to have ready
  • layerName: The name or ARN of the layer to resolve to a version ARN.
  • versionNumber: The version number of the layer to resolve.
  • compatibleRuntime: Only list layers and versions compatible with this runtime (e.g. nodejs20.x, python3.12). Lambda rejects attaching an incompatible layer.
  • compatibleArchitecture: Only list layers and versions compatible with this architecture (x86_64 or arm64).
  • maxItems: Maximum number of items returned per list call (1-10000).
For your developer

Arazzo workflow aws-lambda:layer-discovery, 3 operations: ListLayers → ListLayerVersions → GetLayerVersion. Specs on APIs.io.