How to Upgrade AWS CLI and Migrate to Newer Amazon Linux Version on Legacy Systems


8 views

When working with older Amazon Linux AMI releases (like 2010.11.2), you'll encounter several challenges:

  • The default package repositories may no longer receive updates
  • Yum repositories might be deprecated or archived
  • Core dependencies may be too old for modern AWS CLI versions

We'll handle this in two distinct phases:

Phase 1: Updating AWS CLI Independently

Instead of relying on system packages, we'll install the AWS CLI using the bundled installer:

# Remove old versions if exists
sudo yum remove awscli -y

# Download the latest AWS CLI bundle
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip

# Install without system dependencies
sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update

Verify the installation:

aws --version

Phase 2: Migrating to a Supported Amazon Linux Version

For long-term maintainability, consider upgrading your entire system:

Option A: In-Place Upgrade (If Possible)

# First identify available upgrade paths
sudo yum clean all
sudo yum --releasever=latest update

Option B: Fresh Installation (Recommended)

For production systems, a fresh installation of Amazon Linux 2 is more reliable:

  1. Launch new EC2 instance with Amazon Linux 2 AMI
  2. Migrate configuration files and data
  3. Test thoroughly before decommissioning old instance

SSL Certificate Problems: Older systems may fail to download packages due to expired root certificates. Fix with:

sudo yum install -y ca-certificates

Python Compatibility: If AWS CLI requires Python 3 but your system only has Python 2:

sudo yum install -y python3
python3 -m pip install --upgrade awscli
  • Set up regular update checks with cron: 0 0 * * * /usr/local/bin/aws --version
  • Consider using AWS Systems Manager for patch management
  • Document all manual modifications to the base system

If you're running an older Amazon Linux AMI (like release 2010.11.2), you might encounter outdated AWS CLI tools that can't be updated through standard yum commands. This happens because:

  • The default repositories for older AMIs no longer receive updates
  • AWS CLI v1 (bundled with older AMIs) is now in maintenance mode

The most reliable method is to install AWS CLI v2 directly from AWS:

# Remove old CLI if present
sudo yum remove awscli -y

# Download and install AWS CLI v2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

# Verify installation
aws --version

For a complete system upgrade, consider migrating to Amazon Linux 2:

# First, create an AMI of your current instance
# Then launch a new instance with Amazon Linux 2 AMI

# For a direct migration (not recommended for production):
sudo yum install -y amazon-linux-extras
sudo amazon-linux-extras install epel -y
sudo yum update -y

If you prefer to keep the old system but need updated CLI tools:

# Install Python and pip if not present
sudo yum install -y python3 pip

# Install/upgrade AWS CLI
pip3 install --upgrade awscli

# Add to PATH if needed
echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc
source ~/.bashrc

After any upgrade method, verify with:

aws --version
aws configure list

Remember that newer AWS CLI versions might require updated IAM permissions or support different features than your old version.