AWS Cloud9 comes with SAM CLI installed. Let’s verify it, and upgrade it as needed.
sam --version
. You will most likely see something like 1.31.0./bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/ec2-user/.linuxbrew/bin/brew shellenv)"' >> /home/ec2-user/.bash_profile
eval "$(/home/ec2-user/.linuxbrew/bin/brew shellenv)"
brew tap aws/tap
brew install aws-sam-cli
sam --version