AWS Lambda Custom Runtime for executing arm64 binaries

I’m configuring an AWS Lambda with a custom runtime using the Serverless framework, and I’ve run into this error:

Architecture config by default on Lambda is showing x86_64::

If I trying to create with arm64 instead it gives:

An error occurred: HelloLambdaFunction - Resource handler returned message: "Runtime provided does not support the following architectures [arm64]. Please select different architectures from [x86_64] or select a different runtime

This is slightly obscure and it a result of the ‘provided’ runtime coming in 2 flavors, Amazon Linux 1 (provided) and Amazon Linux 2 (provided.al2), and only provided.al2 supports arm64.

If you change your serverless.yaml to include the provided.al2 runtime, then it deploys as expected.

This just means replacing this:

provider:
  name: aws
  runtime: provided

with:

provider:
  name: aws
  runtime: provided.al2

Note now how the runtime shows Amazon Linux 2 and arm64: