[Solved] RHEL 7.6 Use yum Error: Could not contact any CDS load balancers

Problem description

The following error was encountered when executing yum update after booting an EC2 instance from MarketPlace with RHEL 7.6’s AMI:

[ec2-user@ip-172-31-43-28 ~]$ sudo yum update
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos


Could not contact any CDS load balancers: https://rhui3.cn-northwest-1.aws.ce.redhat.com/pulp/content/.

Cause of the problem
According to the official RHEL lifecycle statement: Red Hat Enterprise Linux Life Cycle RHEL 7.6 Extended Update Support Add-on all ended on May 31, 2021, while the RedHat official website states: RHUI 3 Takes Over in AWS, Bringing New DNS Data

Since RHEL 7.6 still uses the rh-amazon-rhui-client with version 2 by default, checking the repo configuration files starting with /etc/yum.repo.d/redhat-rhui, you can see that they all start with the address: https://rhui2-cds01.REGION.aws.ce.redhat.com.

After upgrading to RHUI 3 in July 2020, the hostname and IP address were changed, which means that the original repo cannot be used anymore.

With the transition to RHUI 3, new host names and IP addresses are used. If you have firewall rules, proxy settings etc. that worked with the original RHUI 2 host names or their original IP addresses, you are likely affected, and will need to change these rules or settings to allow the new host names or IP addresses.

Solution:

      1. Start a new instance using the last major release of RHEL 7, I’m using RHEL-7.9_HVM-20211005-x86_64-0-Hourly2-GP2 – ami-0196d703168979cc6
      1. SSH to this instance, use the following command to download the latest version of the rh-amazon-rhui-client.noarch package
sudo yum install --downloadonly --downloaddir=/home/ec2-user/ rh-amazon-rhui-client.noarch

Disconnect the SSH connection, use the SCP command on the local computer to download the installation package locally, and then transfer it to the problematic 7.6 instance


scp -i .\xxx.pem ec2-user@[RHEL 7.9的IP]:/home/ec2-user/rh-amazon-rhui-client-3.0.45-1.el7.noarch.rpm ./Desktop/

scp -i .\xxx.pem .\Desktop\rh-amazon-rhui-client-3.0.45-1.el7.noarch.rpm ec2-user@[RHEL 7.6的IP]:/home/ec2-user/

Connect SSH to the 7.6 instance and execute the following command to update RH Amazon rhui client

# Uninstall the old client and beta versions that came with 7.6
sudo yum remove -y rh-amazon-rhui-client rh-amazon-rhui-client-beta
# Manually install the downloaded new version of the rpm package
sudo rpm -ivh --nodeps ~/rh-amazon-rhui-client-3.0.45-1.el7.noarch.rpm
# Resolve the package dependencies by reinstalling them again via yum
sudo yum reinstall -y rh-amazon-rhui-client
# Refresh the cache and repo information
sudo yum clean all
sudo yum repolist
sudo yum list

Read More: