AWS SAM Guide

AWS Severless Application Model (SAM) Command Line Interface (CLI) - installation instructions.

Info

The primary cluster is hosted on AWS in Sydney, Australia.

The Amazon Developer Guide contains instructions for installing AWS SAM CLI on Windows, macOS, and Linux.

Manjaro users

Step 1

Check which version of Python you have installed on your local machine using python --version.

If you do not have python 3.9 installed, the sam build will fail. If you do have python 3.9 installed then move to Step 2.

Having python 3.10 installed globally here /usr/bin, makes sam build fail.

Therefore, rollback to python 3.9.10 using the following commands:

# Install pyenv so you are able to select the version of python you want to be installed.
sudo pacman -S pyenv
# Running the next command will give you a list of the available versions
pyenv install 3.9
# Install python 3.9.10 using
pyenv install 3.9.10

Now that python 3.9.10 is installed, we need to set its PATH.

# Open your .bashrc or .zshrc file (whichever you are using) and 
# add the following to the bottom of the page:
export PATH=$PATH:$HOME/.pyenv/versions/3.9.10/bin/

We have now informed AWS the location of python 3.9.10 on your machine and can now run sam build.

Step 2

Run the following command to install the SAM CLI.

pip3 install aws-sam-cli

Start using the AWS SAM CLI with these commands.

Installation steps for MacOS

This installation guide is written for MacOS Monterey 12.3 (21E230). Keep in mind that MacOS often makes sweeping changes per major version

Whilst it is optional, it is highly recommended that Docker Desktop is installed for using the AWS SAM CLI. This install guide will cover the installation of Docker Desktop. In the event you have already installed Docker Desktop, then skip to here

Installing Docker Desktop

Step 1 - Installing Homebrew

This guide will use Homebrew to install the required packages. In the event that you already have Homebrew on your system (Can be verified by running brew --version) then skip to Installing.

In order to install Homebrew run in a terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

After that, verify correct installation:

brew --version
Step 2 - Installing Docker

Run in a terminal after installing Homebrew:

brew install --cask mongodb-compass

Then, check the /Applications/ or the Launchpad for the MongoDB Compass App

Installing SAM CLI - MacOS

Run in a terminal after installing both Homebrew and Docker Desktop:

brew tap aws/tap
brew install aws-sam-cli

After this command has completed, verify that AWS SAM CLI is installed by running:

sam --version

VS Code Extension - AWS SAM CLI

AWS Toolkit VS Code extension can help deploy your application.