Update all preinstalled packages on cloud9

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.

Uninstall CLI version 1 on linux2 ec2

sudo pip uninstall -y awscli

Install the AWS CLI 2.x by running the following command

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

reload the profile

. ~/.bash_profile

Confirm you have a newer version for AWS CLI

aws --version

Update the SAM CLI

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

Confirm you have a newer version for SAM CLI

sam --version