An AWS Cloud9 instance comes with a few preinstalled items, when you start a new one you might want to update some items to the lates version. For instance in february 2023 the AWS CLI was installed with version 1.19.112 you might wat to migrate that to version 2. AWS SAM is installed with version 1.59 and you migt want this to be updated also to the lates version.
sudo pip uninstall -y awscli
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
. ~/.bash_profile
aws --version
wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip
unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
sudo ./sam-installation/install --update
sam --version