Python 2: 2020 End of Life (EOL) and What It Means For You, Plus Services Like AWS Lambda and Heroku
Tags: python, aws, serverless
Published: 2020-01-13 18:27:41

> **04/20/2020 UPDATE:** Python 2.7.18 has been released, and Python 2 has come to an end. Read more here:
>
> - [[RELEASE] Python 2.7.18, the end of an era](https://mail.python.org/archives/list/python-announce-list@python.org/thread/OFCIETIXLX34X7FVK5B5WPZH22HXV342/)
> - [Sunsetting Python 2](https://www.python.org/doc/sunset-python-2/)

I just wanted to drop a little post into the universe that support for Python 2.7.x has officially stopped, and is at End of Life (EOL). The last update, `2.7.18` will be released in April 2020, of which all code updates are frozen right now. This is it.

What does this mean for people running Python 2.7? What does this mean for hosted/serverless solutions, like AWS Lambda or Heroku?

This post should help.

### Python 2.x EOL Information

|Name|AWS Lambda Runtime Identifier|[PSF EOL](https://www.python.org/dev/peps/pep-0373/#maintenance-releases)|Last Update Available|[AWS Lambda Python 2.7 EOL](https://aws.amazon.com/blogs/compute/continued-support-for-python-2-7-on-aws-lambda/)|[Heroku Python 2.7 EOL](https://help.heroku.com/MP5YNXLN/python-2-7-faq)|[GCP App Engine Python 2.7 EOL](https://cloud.google.com/python/docs/python2-sunset/)|
|---|---|---|---|---|---|---|
|Python 2.7|`python2.7`|January 1, 2020|[April 20 2020](https://mail.python.org/archives/list/python-announce-list@python.org/thread/OFCIETIXLX34X7FVK5B5WPZH22HXV342/)|December 31, 2020|February 1, 2021|Unspecified Date|

## General Information About Python 2.7 EOL

From the Official Python release schedule page for 2.7:[^fn1]

> _Being the last of the 2.x series, 2.7 will receive bugfix support until 2020. Support officially stops January 1 2020, but the final release will occur after that date._
>
> _Planned future release dates:_
>
> - _2.7.18 code freeze January, 2020_
> - _2.7.18 release candidate early April, 2020_
> - _**2.7.18 mid-April, 2020**_

The last update, releasing in April, is now in code freeze. You can see the discussion around this here: [The CPython Developer's Guide - Update Python 2.7 EOL date](https://github.com/python/devguide/pull/344)

### Additional Resource Links

- [Python Docs: Porting Python 2 Code to Python 3](https://docs.python.org/3/howto/pyporting.html)
- [Visualized Python Release Cycle: 2.6 - 3.9](https://python-release-cycle.glitch.me/)
- [The ***Moving to require Python 3*** Statement](https://python3statement.org/) with all the projects that signed, saying:

  > _"...the following projects have pledged to **drop support for Python 2.7 no later than 2020,** coinciding with the Python development team’s timeline for dropping support for Python 2.7."_

## AWS Lambda Python 2.7 Runtime

AWS Lambda will actually continue to apply critical security patches until at least the end of 2020:

> _To allow you additional time to prepare, **AWS Lambda will continue to provide critical security patches for the Python 2.7 runtime until at least December 31, 2020.** Lambda’s scope of support includes the Python interpreter and standard library, but does not extend to third-party packages.[^fn2]_

### Simple Auditing of AWS Lambda Runtimes

For a simple place to start, when it comes to auditing what AWS Lambdas are using the `python2.7` runtime, we can run the following `awscli`[^fn3] command (using default `--region`, `--profile`, and `--output` config values):

```bash
# Add --region, --profile, and --output args if needed
aws lambda list-functions --query 'Functions[?Runtime==`python2.7`]'

# -OR-
# If wanting only the names of the functions
# Add --region, --profile, and --output args if needed
aws lambda list-functions --query 'Functions[?Runtime==`python2.7`].FunctionName'
```

Want an alternate take using PowerShell[^fn4] instead? Using the `AWSPowerShell`[^fn5] for Windows or `AWSPowerShell.NetCore`[^fn6] for Linux or Mac OS module:

```powershell
# Install-Module AWSPowerShell
# -OR-
# Install-Module AWSPowerShell.NetCore

# Add -Region and -ProfileName parameters if needed
(Get-LMFunctionList).where({$_.Runtime -eq 'python2.7'})
```

Ontop of this, AWS will make sure to notify customers as support gets closer to deprecation:

> _In most cases, the end-of-life date of a language version or operating system is known well in advance. If you have functions running on a runtime that will be deprecated in the next 60 days, Lambda notifies you by email that you should prepare by migrating your function to a supported runtime. In some cases, such as security issues that require a backwards-incompatible update, or software that doesn't support a long-term support (LTS) schedule, advance notice might not be possible._[^fn7]

## Heroku Python 2.7 Apps

Heroku gives the rundown in their Python 2.7 FAQ, providing information about how Python 2.7.17 apps will still run until April 2023 but will no longer fall under their support policy after February 1st, 2021:

> _You do not need to do anything to keep using Python 2. **Python 2.7.17 applications will continue to build and run on Heroku 18 for the lifetime of the stack, until April 2023.**_
>
> _However, Python 2.7 on Heroku will no longer receive security updates after January 1, 2020, as it has reached it’s community specified end of life date._
>
> _**Because of this, Heroku platform support for these applications will end as soon as February 1st, 2021. On that sunset date, these applications will continue to build and run, but they will no longer fall under our [Support Policy](https://www.heroku.com/policy/support).**_[^fn8]

## Discussion

Have any thoughts to add, or information to share? Jump into the conversation below! I'll try to keep this article updated with any new information that seems like it should be in here.

---

_Originally published at [https://icanteven.io](https://www.icanteven.io/blog/python2-eol/) on January 12th, 2020_

[^fn1]: [Python.Org: PEP 373 -- Python 2.7 Release Schedule](https://aws.amazon.com/blogs/compute/continued-support-for-python-2-7-on-aws-lambda/)

[^fn2]: [AWS Compute Blog: Continued support for Python 2.7 on AWS Lambda](https://aws.amazon.com/blogs/compute/continued-support-for-python-2-7-on-aws-lambda/)

[^fn3]: Need help with the AWS CLI before? Learn how to install and configure it here: [AWS Command Line Interface](https://aws.amazon.com/cli/)

[^fn4]: [PowerShell Core on GitHub](https://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up-linux-mac.html)

[^fn5]: Get AWSPowerShell For Windows: [Installing the AWS Tools for PowerShell on Windows](https://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up-windows.html)

[^fn6]: Get AWSPowerShell.NetCore for Linux and Mac OS: [Installing AWS Tools for PowerShell on Linux or macOS](https://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up-linux-mac.html)

[^fn7]: [AWS Lambda - Runtime Support Policy](https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html)

[^fn8]: [Heroku: Python 2.7 FAQ](https://help.heroku.com/MP5YNXLN/python-2-7-faq)