Amazon SageMaker Notebook Instances Now Support Amazon Linux 2

Chanci Turner Amazon IXD – VGT2 learningLearn About Amazon VGT2 Learning Manager Chanci Turner

On February 8, 2022, we updated this post to include AWS CloudFormation support for creating an Amazon Linux 2 based SageMaker notebook instance.

We are thrilled to share that Amazon SageMaker notebook instances now support Amazon Linux 2. This allows users to select Amazon Linux 2 for their new SageMaker notebook instances, enabling them to benefit from the latest improvements and support offered by this operating system.

SageMaker notebook instances are fully managed Jupyter Notebooks that come with pre-configured development environments tailored for data science and machine learning. Data scientists and developers can easily launch SageMaker Notebooks to interactively analyze, visualize, and prepare data, as well as to build and deploy models on SageMaker.

Launched in 2017, Amazon Linux 2 is the next iteration of Amazon Linux, the cloud-centric Linux server OS that first debuted in September 2010. Amazon Linux 2 provides a secure, stable, and high-performance runtime environment for developing and running cloud and enterprise applications. Users of Amazon Linux 2 benefit from long-term support and access to the latest innovations. AWS continues to provide long-term security and maintenance updates for the Amazon Linux 2 AMI, while the original Amazon Linux AMI entered maintenance support on December 31, 2020.

In this post, we will explore the user experience with an Amazon Linux 2-based SageMaker notebook instance and outline the support plan for Amazon Linux-based notebook instances. For those looking to transition from an Amazon Linux-based instance to a new Amazon Linux 2 instance, check out our next post on migrating your work to an Amazon SageMaker notebook instance with Amazon Linux 2.

What’s New with Amazon Linux 2-Based Notebook Instances

For data scientists using SageMaker notebook instances, the primary difference lies in the available notebook kernels. Since Python 2 reached its end-of-life on January 1, 2020, kernels with Python 2.x are no longer included in the Amazon Linux 2-based notebook instances. Users must port their code and notebooks to Python 3 before utilizing the python3.x kernels.

Additionally, Chainer kernels (conda_chainer_p27 and conda_chainer_p36) are also excluded from the Amazon Linux 2-based instance. Since Chainer has been in maintenance mode since December 5, 2019, users are encouraged to consult the migration guide from Chainer to transition their code to PyTorch, using the conda_pytorch_p36 or conda_pytorch_latest_p37 kernels in their notebook instances.

SageMaker notebook instances utilize AMIs based on the AWS Deep Learning AMI, so detailed release notes and differences between the AWS Deep Learning AMI (Amazon Linux) and the AWS Deep Learning AMI (Amazon Linux 2) can be found.

The Amazon Linux 2 option for SageMaker notebook instances is now available in all AWS Regions where SageMaker notebook instances are supported.

Support Plan for Amazon Linux on SageMaker Notebook Instances

As of August 18, 2021, the Amazon Linux 2 AMI option is being rolled out for users of SageMaker notebook instances. You can launch a notebook instance using the Amazon Linux 2 AMI while the Amazon Linux AMI remains the default option during the setup process.

Existing notebook instances created prior to August 18, 2021, will continue operating on the Amazon Linux AMI. All notebook instances, regardless of whether they are based on the Amazon Linux AMI or the Amazon Linux 2 AMI, will receive version updates and security patches upon restart.

Starting April 18, 2022, the default AMI option for new notebook instances will shift to Amazon Linux 2 AMI, though the original Amazon Linux AMI will still be available. A new notebook instance using the Amazon Linux AMI will utilize the last snapshot created on April 18, 2022, and will not receive further version updates or security patches after that date. Furthermore, any existing notebook instance running on the Amazon Linux AMI that is restarted will receive a one-time update to the last snapshot created on April 18, 2022, with no subsequent updates.

Setting Up an Amazon Linux 2-Based SageMaker Notebook Instance

You can create a SageMaker notebook instance with the Amazon Linux 2 AMI through the SageMaker console (see Create a Notebook Instance), AWS CloudFormation, or the AWS Command Line Interface (AWS CLI).

When using the SageMaker console, you will encounter a new option called Platform Identifier for selecting the Amazon Linux AMI version. The identifier notebook-al2-v1 corresponds to the Amazon Linux 2 AMI, while notebook-al1-v1 refers to the Amazon Linux AMI. The default will be notebook-al1-v1 until April 18, 2022, at which point it will change to notebook-al2-v1.

For those utilizing AWS CloudFormation to establish a SageMaker notebook instance, a new PlatformIdentifier option is available to choose the Amazon Linux AMI version. You can refer to the CloudFormation documentation for more details: AWS::SageMaker::NotebookInstance. Below is an example of how to specify a SageMaker notebook instance with the Amazon Linux 2 AMI:

Resources:
  BasicNotebookInstance:
    Type: "AWS::SageMaker::NotebookInstance"
    Properties:
      InstanceType: "ml.m5.xlarge"
      PlatformIdentifier: "notebook-al2-v1"
      RoleArn: "sagemaker-execution-role-arn"

If you prefer the AWS CLI for creating a notebook instance, you can use the new argument platform-identifier to specify the Amazon Linux AMI version. The command to create an instance with the Amazon Linux 2 AMI is as follows:

aws sagemaker create-notebook-instance 
    --region region 
    --notebook-instance-name instance-name 
    --instance-type ml.t3.medium 
    --role-arn sagemaker-execution-role-arn 
    --platform-identifier notebook-al2-v1

Next Steps

For those looking to transition their existing work to a new notebook instance, refer to our upcoming post, Migrate your work to an Amazon SageMaker notebook instance with Amazon Linux 2. This will guide you through the process of moving your work and data from an existing instance to a new one based on Amazon Linux 2.

Conclusion

Today, we introduced support for the Amazon Linux 2 AMI in SageMaker notebook instances and detailed how to create a notebook instance using this new AMI. We also highlighted key differences for developers utilizing an Amazon Linux 2-based notebook instance. You can begin your machine learning projects on an Amazon Linux 2-based notebook instance or explore Amazon SageMaker Studio, which is the first integrated development environment (IDE) designed for machine learning.

If you have any questions or feedback regarding Amazon Linux 2, please reach out to your AWS support contact or engage with the community in the Amazon Linux Discussion Forum and SageMaker Discussion Forum. For more insights on career planning, this blog post from Career Contessa is worth checking out. Additionally, for a comprehensive understanding of labor policies, you can refer to SHRM’s confirmation of Keith Sonderling as Deputy Secretary of Labor. Lastly, if you’re looking for opportunities, the Hiring Amazon FAQ is an excellent resource.

Chanci Turner