Python 2.7 was deprecated by the Python Software Foundation back on January 1, 2020 following a multi-year process of phasing it out. Because of this, AWS has deprecated support for Python 2.7, meaning versions the AWS CLI v1 released after the deprecation date no longer work with Python 2.7.
Note
Since the AWS CLI v2 bundles its own copy of Python, this transition only impacts users of the CLI v1. You can upgrade to the AWS CLI v2 to avoid these deprecations in the future.
Going forward, customers using the CLI v1 should transition to using Python 3, with Python 3.8 becoming the minimum by the end of the transition. The deprecation dates for the affected versions of Python are:
Python version | Deprecation date |
---|---|
Python 2.7 | 7/15/2021 |
Python 3.4 and 3.5 | 2/1/2021 |
Python 3.6 | 5/30/2022 |
Python 3.7 | 12/13/2023 |
The AWS Command Line Interface is built using the Python SDK, so it's affected by this transition. AWS CLI v2 isn't affected by this transition, since it bundles its own copy of Python 3. However, if you still use the AWS CLI v1, you need to decide whether to upgrade to Python 3 or transition to the AWS CLI v2.
Before starting this process, we highly recommend upgrading to AWS CLI v2. This will avoid the requirement for future upgrades and isolate your CLI usage from conflicts with other packages like boto3 and botocore.
First, let’s check if you need to upgrade to Python 3. If you have the AWS CLI installed, you can quickly check which version of Python it’s using with this command.
$ aws --version
aws-cli/1.18.191 Python/2.7.18 Darwin/19.6.0 botocore/1.19.31
If the second portion of the version string, starting with Python/ isn’t Python/3.8.x or higher, you should review the options below.
If you’re using the MSI installer, you can simply start using these Python 3 based installers [32 bit] [64 bit].
Otherwise, upgrading Python versions isn’t difficult.
- To begin, uninstall your existing copy of the AWS CLI. You can find instructions in the CLI v1 installation guide.
- Now we’ll install Python 3.8 or later. You can get Python from Python.org or using your local package manager. In this example, we’ll use a recent version, Python 3.8.7, to ensure the longest support window.
- Next, depending on your installation method, the new Python installation should be available at one of these locations. Use these commands to verify:
$ python --version
Python 3.8.7
$ python3 --version
Python 3.8.7
$ python3.8 --version
Python 3.8.7
- Here, we're using the python command from above to make sure we're installing with the right version. Use whichever alias provided the desired Python version.
$ python -m pip install awscli
Alternatively, if you're using the bundled installer you can use:
$ python awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
- If you wish, you may verify that the newly installed copy of the AWS CLI tool, aws, is using the correct version of Python. The aws --version command reports the aws tool's version number, followed by the version of Python it's running under, then the operating system version and the version of botocore. As long as the Python version is at least 3.8, you're ready to go:
$ aws --version
aws-cli/1.18.191 Python/3.8.7 Darwin/19.6.0 botocore/1.19.31
It may be possible that you're unable to upgrade to Python 3. Under these circumstances, you should be prepared for the deprecation date, in order to not be inconvenienced when the time arrives. If you're using a version of the AWS CLI v1 released prior to the deprecation date, it will continue to function after end of support. These versions however will no longer be receiving security or feature updates. If those are required, you will need to migrate to Python 3 to start receiving updates again.
If you install the AWS CLI using pip, as long as you use pip 10.0 and later, you will automatically install the last available version compatible with Python 2.7.
If you installed the AWS CLI v1 using the Windows MSI Installer for Python 3 [32 bit] [64 bit], you're not impacted by this transition. These installers stay up-to-date with each release.
If you're still using the AWS CLI v1 as installed using the Windows MSI Installer for Python 2, be aware that after the deprecation date, the download links for the latest version of the CLI v1 Windows MSI Installer will point to the Python 3 MSIs. Previous releases, including those for Python 2, will remain available at their version-specific URLs:
https://s3.amazonaws.com/aws-cli/AWSCLI32-{VERSION}.msi
https://s3.amazonaws.com/aws-cli/AWSCLI64-{VERSION}.msi
If you use the AWS CLI bundled installer to install the AWS CLI v1 and cannot upgrade,
you will need to ensure you’re downloading a Python 2 compatible version.
All versions released prior to the deprecation date should be compatible.
You can download a specific installer using the URL
https://s3.amazonaws.com/aws-cli/awscli-bundle-{VERSION}.zip
,
where "{VERSION}
" is the AWS CLI version you wish to install.
For example, you could choose version 1.18.200 using the following command:
curl https://s3.amazonaws.com/aws-cli/awscli-bundle-1.18.200.zip -o awscli-bundle.zip
Once you've downloaded the bundle, proceed with step 2 of the bundle-based installation instructions for your platform: