Bring your own custom SageMaker image tutorial - Amazon SageMaker

Bring your own custom SageMaker image tutorial

In this tutorial, you create a custom SageMaker image and attach a version of the image to your domain for use in Amazon SageMaker Studio. The image version contains a selection of R packages, along with the AWS SDK for Python (Boto3) and the Amazon SageMaker Python SDK. After you complete this tutorial, you can select the version in Studio and use R to access the SDKs using the RStudio reticulate package. For more information on the reticulate package, see R Interface to Python. For a blog article similar to this tutorial, see Bringing your own R environment to Amazon SageMaker Studio.

Two methods are presented to attach the image version to your domain. In the first method, you create a new domain with the version attached. This method is simpler but you need to specify the Amazon Virtual Private Cloud (VPC) information and execution role that's required to create the domain.

If you have onboarded to Studio, you can use the second method to attach the image version to your current domain. In this case, you don't need to specify the VPC information and execution role. After you attach the version, you must delete all the apps in your domain and reopen Studio.

You can't run this tutorial from Studio for the following reasons:

  • Docker isn't available inside Studio.

  • You can't create or update a domain within Studio.

Prerequisites

  • The Docker application. For information about setting up Docker, see Orientation and setup.

  • A local copy of the Dockerfile for creating a Studio compatible R image from the SageMaker Studio custom image samples repository.

    Note

    Building the R image from the Dockerfile installs dependencies that may be licensed under copyleft licenses such as GPLv3. You should review the license terms and make sure they are acceptable for your use case before proceeding and building this image.

  • Permissions to access the Amazon Elastic Container Registry (Amazon ECR) service. For more information, see Amazon ECR Managed Policies.

  • An AWS Identity and Access Management execution role that has the AmazonSageMakerFullAccess policy attached. If you have onboarded to Amazon SageMaker Studio, you can get the role from the Studio Summary section of the SageMaker Studio control panel.