This is just a quick review of the steps required to install the latest AWS CLI version with python pip and the Red Hat Software Collections Library (RHSCL). I have left the discussion on the decision to use the RHSCL to the Red Hat Developers blog on the topic. This is a guide on using the tools provided by Amazon Web Services at the command line without making modifications to the base operating system.
When you read the documentation for the AWSCLI installation, it's not clear that the use of python-pip on RHEL is not supported. The recommendation from the official Red Hat Knowledgebase is to use a virtualenv as follows:
WARNING: Using pip as root user can OVERWRITE your system python libraries, use a virtualenv as a normal user whenever possible to avoid issues when packages are upgraded using Red Hat provided RPM's. -- Red Hat KB#1519803
I saw this recently in a configuration a customer was using for disaster recovery. Use of pip to install the python urllib3 library caused a failure in cloud-init and the hardware address was not updated in the ifcfg-eth0 file on the creation of a new instance from an Amazon Machine Image (AMI, pronounced "ah-mee" in my house) . This was due to the urrlib3 library overwriting files associated with other Python RPM packages. So I went through the steps of setting up the AWSCLI on an instance using the RHSCL and I wanted to share this experience with you. I hope it helps you access the very latest AWS updates and features from your on-demand instances running RHEL 6 and RHEL 7. Next time I write it up, we'll use an RHSCL container on RHEL 8.1 with podman.
For RHEL on-demand with RHUI3, follow the following instructions
$ sudo yum --enablerepo rhui-REGION-rhel-server-rhscl install -y rh-python36 $ scl -l rh-python36 $ scl enable rh-python36 bash $ which python /opt/rh/rh-python36/root/usr/bin/python $ which pip /opt/rh/rh-python36/root/usr/bin/pip $ mkdir -p ~/.virtualenv/awscli $ virtualenv --prompt=[awscli] ~/.virtualenv/awscli $ source ~/.virtualenv/awscli/bin/activate $ pip install awscli $ which awscli ~/.virtualenv/awscli/bin/aws
At this point, you should be able to use the application directly like so:
$ ~/.virtualenv/awscli/bin/aws help