Feedback
Do you have a suggestion to improve this website or boto3?Give us feedback.
Python 2.7 was deprecated by thePython Software Foundationon January 1, 2020 following a multi-year process of phasing it out. Because of this, AWS hasdeprecated support for Python 2.7, which means that releases of Boto3 issued after the deprecationdate will no longer work on Python 2.7.
This affects both modules that comprise the AWS SDK for Python: Botocore (the underlying low-levelmodule) and Boto3 (which implements the API functionality and higher-level features).
Going forward, all projects using Boto3 need to transition to a supported version of Python 3. Boto3 andBotocore ended support for Python 2.7 on July 15, 2021.
Before you begin to update your project and environment, make sure you’ve installed or updated to asupported version of Python as described inupgrade to Python 3. You canget Python from thePSF web site or using your local packagemanager.
After you have installed Python 3, you can upgrade the SDK. To do so, you need to update the Boto3Python package. You can do this globally or within your virtual environment if you use one for yourproject.
Uninstall the currently installed copies of Boto3 and Botocore:
$ python -m pip uninstall boto3 botocore
Install the new version of Boto3. This will also install Botocore, which it requires:
$ python3 -m pip install boto3
(Optional) Verify that the SDK is using the correct version of Python:
$ python3 -c "import boto3, sys; print(f'{sys.version} \nboto3: {boto3.__version__}')"3.x.y (default, Jan 7 2021, 17:11:21)[GCC 7.3.1 20180712 (Red Hat 7.3.1-11)]boto3: 1.16.15
It may be that you’re unable to upgrade to Python 3, for example if you have a large project that’sheavily dependent on syntax or features that no longer work as desired in Python 3. It’s alsopossible that you need to postpone the Python transition while you finish updates to your code.
Under these circumstances, you should plan on pinning your project’s install of Boto3 to the lastrelease that supports the Python version you use, then not updating Boto3 further. You can then keepusing an existing installation of Boto3 on Python 2, even after its deprecation date, with theunderstanding that deprecated versions of Boto3 will not receive further feature or securityupdates.
If you installed Boto3 usingpip 10.0 or later, you’ll automatically stop receiving Boto3updates after the last Python 2 compatible version of the SDK is installed. If you’re using an olderversion ofpip, you need to pin your Boto3 install to no later than version 1.17.
If you installed Boto3 and Botocore from source or by any other method, be sure to download andinstall a version released prior to the Python 2.7 deprecation date.