Lambda instruction set architectures (ARM/x86) - Amazon Lambda
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Lambda instruction set architectures (ARM/x86)

The instruction set architecture of a Lambda function determines the type of computer processor that Lambda uses to run the function. Lambda provides a choice of instruction set architectures:

  • arm64 – 64-bit ARM architecture, for the Amazon Graviton2 processor.

  • x86_64 – 64-bit x86 architecture, for x86-based processors.

Note

The arm64 architecture is available in most Amazon Web Services Regions. For more information, see Amazon Lambda Pricing. In the memory prices table, choose the Arm Price tab, and then open the Region dropdown list to see which Amazon Web Services Regions support arm64 with Lambda.

For an example of how to create a function with arm64 architecture, see Amazon Lambda Functions Powered by Amazon Graviton2 Processor.

Advantages of using arm64 architecture

Lambda functions that use arm64 architecture (Amazon Graviton2 processor) can achieve significantly better price and performance than the equivalent function running on x86_64 architecture. Consider using arm64 for compute-intensive applications such as high-performance computing, video encoding, and simulation workloads.

The Graviton2 CPU uses the Neoverse N1 core and supports Armv8.2 (including CRC and crypto extensions) plus several other architectural extensions.

Graviton2 reduces memory read time by providing a larger L2 cache per vCPU, which improves the latency performance of web and mobile backends, microservices, and data processing systems. Graviton2 also provides improved encryption performance and supports instruction sets that improve the latency of CPU-based machine learning inference.

For more information about Amazon Graviton2, see Amazon Graviton Processor.

Requirements for migration to arm64 architecture

When you select a Lambda function to migrate to arm64 architecture, to ensure a smooth migration, make sure that your function meets the following requirements:

  • The function currently uses a Lambda Amazon Linux 2 runtime.

  • The deployment package contains only open-source components and source code that you control, so that you can make any necessary updates for the migration.

  • If the function code includes third-party dependencies, each library or package provides an arm64 version.

Function code compatibility with arm64 architecture

Your Lambda function code must be compatible with the instruction set architecture of the function. Before you migrate a function to arm64 architecture, note the following points about the current function code:

  • If you added your function code using the embedded code editor, your code probably runs on either architecture without modification.

  • If you uploaded your function code, you must upload new code that is compatible with your target architecture.

  • If your function uses layers, you must check each layer to ensure that it is compatible with the new architecture. If a layer is not compatible, edit the function to replace the current layer version with a compatible layer version.

  • If your function uses Lambda extensions, you must check each extension to ensure that it is compatible with the new architecture.

  • If your function uses a container image deployment package type, you must create a new container image that is compatible with the architecture of the function.

How to migrate to arm64 architecture

To migrate a Lambda function to the arm64 architecture, we recommend following these steps:

  1. Build the list of dependencies for your application or workload. Common dependencies include:

    • All the libraries and packages that the function uses.

    • The tools that you use to build, deploy, and test the function, such as compilers, test suites, continuous integration and continuous delivery (CI/CD) pipelines, provisioning tools, and scripts.

    • The Lambda extensions and third-party tools that you use to monitor the function in production.

  2. For each of the dependencies, check the version, and then check whether arm64 versions are available.

  3. Build an environment to migrate your application.

  4. Bootstrap the application.

  5. Test and debug the application.

  6. Test the performance of the arm64 function. Compare the performance with the x86_64 version.

  7. Update your infrastructure pipeline to support arm64 Lambda functions.

  8. Stage your deployment to production.

    For example, use alias routing configuration to split traffic between the x86 and arm64 versions of the function, and compare the performance and latency.

For more information about how to create a code environment for arm64 architecture, including language-specific information for Java, Go, .NET, and Python, see the Getting started with Amazon Graviton GitHub repository.

Configuring the instruction set architecture

You can configure the instruction set architecture for new and existing Lambda functions using the Lambda console, Amazon SDKs, Amazon Command Line Interface (Amazon CLI), or Amazon CloudFormation. Follow these steps to change the instruction set architecture for an existing Lambda function from the console.

  1. Open the Functions page of the Lambda console.

  2. Choose the name of the function that you want to configure the instruction set architecture for.

  3. On the main Code tab, for the Runtime settings section, choose Edit.

  4. Under Architecture, choose the instruction set architecture you want your function to use.

  5. Choose Save.

Note

All Amazon Linux 2 runtimes support both x86_64 and ARM CPU architectures.

Runtimes that do not use Amazon Linux 2, such as Go 1.x, do not support the arm64 architecture. To use arm64 architecture with Go 1.x, you can run your function in a provided.al2 runtime. For more information, see the deployment instructions for .zip packages and container images.