# AWS SAM CLI

## About this Install Guide

| Reading time:   | 15 min       |
|------------------|--------------|
| Last updated:    | 4 Aug 2026   |
| Author:          | Jason Andrews, Arm [GitHub](https://github.com/jasonrandrews), [LinkedIn](https://linkedin.com/in/jason-andrews-7b05a8) |
| Official docs:   | [View](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) |

This guide shows you how to install and use the tool with the most common configuration. For advanced options and complete reference information, see the official documentation. Some install guides also include optional next steps to help you explore related workflows or integrations.

The Amazon Web Services (AWS) Serverless Application Model (SAM) CLI is an open-source command-line tool that you can use to build, test, and deploy serverless applications. The SAM CLI provides a Lambda-like execution environment that lets you locally build, test, and debug applications defined by AWS SAM templates. It is available for a variety of operating systems and Linux distributions, and supports the Arm architecture.

## How do I prepare to install the AWS SAM CLI on Ubuntu?

Follow the instructions below to install and try the latest version of the AWS SAM CLI for Ubuntu on Arm.

Confirm you are using an Arm machine by running:

```bash
uname -m
```

The output should be:

```
__output__ aarch64
```

If you see a different result, you are not using an Arm-based computer running 64-bit Linux.

Running the AWS SAM CLI requires Docker. Refer to the [Docker](https://www.arm.com/install-guides/docker/) Install Guide for installation instructions. Confirm Docker is running before installing the SAM CLI.

Python and Python pip are also required to run the SAM CLI example.

To install, run the following command:

```bash
sudo apt install python-is-python3 python3-pip -y
```

## How do I download and install the AWS SAM CLI?

There are two options to install the SAM CLI, you can select your preferred method:

- From a zip file.
- Using the Python `pip` command.

### How do I download and install from a zip file?

Use `wget`:

```bash
wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-arm64.zip
unzip aws-sam-cli-linux-arm64.zip -d sam-install
sudo ./sam-install/install
```

### How do I install the AWS SAM CLI using Python pip?

```bash
sudo apt install python3-venv -y
python -m venv .venv
source .venv/bin/activate
pip install aws-sam-cli
```

### How can I confirm that the AWS SAM CLI was installed correctly?

```bash
sam --version
```

The version should be printed on screen:

```
__output__ SAM CLI, version 1.165.0
```

## How do I create an example application with the AWS SAM CLI?

You can use the AWS SAM CLI to build and deploy a simple “Hello World” serverless application that includes the line `uname -m` to check the platform it is running on, by following these steps.

1. Create the project

Use the code below, adjusting the runtime argument if you have a different version of Python:

```bash
sam init --runtime python3.12 --architecture arm64 --dependency-manager pip --app-template hello-world --name uname-app --no-interactive
```

2. Change to the new directory:

```bash
cd uname-app
```

3. Modify the `hello_world/app.py` file to include the command `uname -m`.

Use a text editor to replace the contents of the `hello_world/app.py` file with the code below:

```python
import json
import os

def lambda_handler(event, context):
    """Sample pure Lambda function

    Parameters
    ----------
    event: dict, required
        API Gateway Lambda Proxy Input Format

        Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format

    context: object, required
        Lambda Context runtime methods and attributes

        Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html

    Returns
    ------
    API Gateway Lambda Proxy Output Format: dict

        Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html
    """

    ret = os.popen('uname -m').read()

    return {
        "statusCode": 200,
        "body": json.dumps({
            "message": ret,
            # "location": ip.text.replace("\n", "")
        }),
    }
```

4. Build the application:

```bash
sam build
```

5. Test the deployed application:

```bash
sam local invoke "HelloWorldFunction" -e events/event.json
```

The output below shows the results from the command `uname -m` and the value of `aarch64` confirms an Arm Linux computer:

```
__output__ Invoking app.lambda_handler (python3.12)
__output__ Local image was not found.
__output__ Removing rapid images for repo public.ecr.aws/sam/emulation-python3.12
__output__ Building image........................................................................................................................
__output__ Using local image: public.ecr.aws/lambda/python:3.12-rapid-arm64.
__output__ 
__output__ Mounting /home/ubuntu/uname-app/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated, inside runtime container
__output__ START RequestId: 7221da4d-346d-4e2e-831e-dcde1cb47b5b Version: $LATEST
__output__ END RequestId: 513dbd6f-7fc0-4212-ae13-a9a4ce2f21f4
__output__ REPORT RequestId: 513dbd6f-7fc0-4212-ae13-a9a4ce2f21f4	Init Duration: 0.26 ms	Duration: 84.22 ms	Billed Duration: 85 ms	Memory Size: 128 MB	Max Memory Used: 128 MB
__output__ {"statusCode": 200, "body": "{\"message\": \"aarch64\\n\"}"}
```

You are ready to use the AWS SAM CLI to build more complex functions and deploy them into AWS. Make sure to select `arm64` as the architecture for your Lambda functions.
