Configure RStudio on SageMaker

Workbench | Advanced

These steps provide a guide for configuring RStudio on SageMaker to use Posit Connect and Posit Package Manager.

RStudio on SageMaker is the implementation of Posit Workbench within a SageMaker Domain in which RStudio IDE sessions are made available to SageMaker users. You may see references to RStudio Workbench or RStudio Server Pro in AWS documentation. These are previous names for Posit Workbench, and are being phased out as product and company rebranding updates are made in AWS documentation.

RStudio running in SageMaker can be configured to use an existing installation of Connect and Package Manager running in Amazon Web Services (AWS).

For additional information on how to configure Connect and Package Manager in AWS, please refer to the Solutions architecture guides.

Note

This documentation only outlines the setup and configuration for RStudio. You need to make additional networking adjustments in AWS and then verify that the Connect and Package Manager servers are accessible from within the SageMaker domain.

Configuration paths

There are two ways to configure RStudio on SageMaker with Connect and Package Manager:

  • Option 1 (As an AWS administrator): configure Connect and Package Manager while enabling RStudio in a SageMaker domain.
  • Option 2 (As an RStudio user): configure Connect and Package Manager from within your RStudio session.

We cover both configuration paths below.

Before you begin

You need:

  • The URL for your Connect server.
  • The URL for the default Package Manager R package repository.
Obtaining the repository URL

The repository URL is located on the Setup tab of the Package Manager web interface.

Consider setting your repository to use precompiled Linux binaries for reduced dependency issues and faster install times. If you are not sure which distribution of Linux you are using you can find it by entering cat /etc/*-release in your terminal.

If your organization does not have a private Package Manager instance, you can still enjoy the benefits of precompiled binaries and repository snapshots with Public Package Manager.

Option 1: Configure Connect and Package Manager in a SageMaker domain

When creating a SageMaker domain with RStudio, you have the option to set a default Posit Connect server and Posit Package Manager repository for all users in your SageMaker domain.

During the SageMaker domain creation process, you can configure default Connect and Package Manager URLs for all user profiles. This is configured in the SageMaker domain wizard, Step 3: RStudio settings, detailed below.

  1. Navigate to the Amazon SageMaker console and then to the SageMaker Domain page.

  2. Supply the required configuration options for both Step 1 and Step 2 in the wizard.

  3. For the Step 3: RStudio settings:

    1. In the RStudio Connect - Server URL field, enter the Connect server URL.
    2. In the RStudio Package Manager - Server URL field, enter the CRAN or a Bioconductor repository URL.
    3. Click Next.
  4. To verify the default repository, in the R console, run options('repos').

    You should see a repository pointing to your Package Manager instance. The default Connect URL is automatically populated when you use the push button publishing option.

Option 2: Configure Connect and Package Manager in an RStudio session

Configure Package Manager

If you’ve successfully configured RStudio to work on SageMaker, you can use a package repository from Posit Package Manager.

To use the Posit Package Manager package repository, configure your RStudio session by completing the following steps:

  • First, you must configure the repository URL. We document two paths:

To manually configure the URL via the R session console:

  • From the RStudio IDE console, run options(repos = c("CRAN" = "<Package Manager URL>")).

To configure the URL via RStudio IDE UI

  1. From RStudio, in an R session, select Tools and click Global Options….

  2. From the Options window, select Packages and click Change….

  3. In the Custom URL field, type the URL for the selected repository and click OK.

  4. From the Options window, click OK. Now, the packages that you install in RStudio are sourced from the selected repository from your Package Manager server.

  5. To verify the default repository, do one of the following:

    • Run options('repos') in the R console or
    • Install a package and view where it is being pulled from.

For more information, see the Checking For Success section of the Posit Package Manager Admin Guide.

Configure Connect

If you’ve successfully configured RStudio to work on SageMaker, you can use Posit Connect for publishing.

To use Posit Connect for publishing, configure your RStudio session by completing the following steps:

  1. From RStudio, in an R session, select Tools and click Global Options….

  2. From the Options window, select Publishing and click Connect….

  3. From the Connect Account window, click Posit Connect.

  4. In the Enter the public URL of the RStudio Connect server text field, type your server public URL. For example, https://xxxx.rstudioconnect.com, and click Next.

    A new browser window opens and a login page displays. Once you log in, the Connect to R page displays.

  5. Click Connect.

    A confirmation message confirming a successful connection displays.

  6. Navigate back to your R session where a Verifying Account window displays.

  7. Click Connect Account. Under Publishing Accounts, your username and server URL display in the list.

  8. Click Apply.

  9. Click OK.

For more information, see the Connecting: RStudio IDE section of the Posit Connect User Guide.

Back to top