Upgrading the Python requests module on Amazon Linux instances that use a proxy server - AWS Systems Manager

Upgrading the Python requests module on Amazon Linux instances that use a proxy server

To patch an instance that is using a proxy and that was created from an Amazon Linux AMI, Patch Manager, a capability of AWS Systems Manager, requires a recent version of the Python requests module to be installed on the instance. We recommend always upgrading to the most recently released version.

To ensure the latest version of the Python requests module is installed, follow these steps:

  1. Sign in to the Amazon Linux instance, or use the AWS Systems Manager document (SSM document) AWS-RunShellScript in Run Command, a capability of AWS Systems Manager, and run the following command on the instance.

    pip list | grep requests
    • If the module is installed, the request returns the version number in a response similar to the following.

      requests (1.2.3)
    • If the module isn't installed, run the following command to install it.

      pip install requests
    • If pip itself isn't installed, run the following command to install it.

      sudo yum install -y python-pip
  2. If the module is installed, but the version listed is earlier than 2.18.4 (such as 1.2.3 shown in the previous step), run the following command to upgrade to the latest version of the Python requests module.

    pip install requests --upgrade