Skip to content

AWS S3 Configuration#


You can configure variable data storage classes to use AWS S3 for storage. See the section on Data Destinations for more information on configuring a variable data storage class to use AWS S3.

AWS Documentation#

RStudio Package Manager's AWS S3 support utilizes the AWS S3 SDK, which documents configuration and credential standards for interacting with S3 services.

See the AWS CLI Configuration for detailed documentation on configuring your environment for interaction with AWS.

Below are some configuration examples.

Configuration Examples#

To interact with S3, you will typically configure either environment variables or a credentials file.

Environment Variables#

Refer to AWS Environment Variables for more information on environment variables.

Here is an example:

Create and edit a new file at /etc/systemd/system/rstudio-pm.service.d/aws.conf

; /etc/systemd/system/rstudio-pm.service.d/aws.conf


Reload the systemd process and restart the RStudio Package Manager service with:


sudo systemctl daemon-reload
sudo systemctl start rstudio-pm

S3 Permissions#

The credentials RStudio Package Manager uses for S3 storage must have the following permissions for the bucket:

  • s3:GetObject
  • s3:ListBucket
  • s3:PutObject
  • s3:DeleteObject
  • s3:AbortMultipartUpload

Credentials and Config Files#

Refer to AWS Configuration and Credential Files for more information on configuration files.

Alternatively, you can configure RStudio Package Manager to use AWS S3 services by creating credential and configuration files in the service account's home directory. Since the rstudio-pm service account does not have a home directory by default, you will first need to create it.


sudo mkdir /home/rstudio-pm
sudo chown rstudio-pm:rstudio-pm /home/rstudio-pm

Next, create a credentials file to contain your AWS credentials

; /home/rstudio-pm/.aws/credentials


If you wish to configure your AWS region without an environment variable, you can use a config file. By default, RStudio Package Manager will only read the ~/.aws/credentials file. To also read the ~/.aws/config file, you must configure one of the following:

  • Set an environment variable: AWS_SDK_LOAD_CONFIG=1, or
  • Set the S3Storage.EnableSharedConfig = true configuration value.

When the AWS_SDK_LOAD_CONFIG environment variable is true or the S3Storage.EnableSharedConfig setting is true, both the shared config file (~/.aws/config) and the shared credentials file (~/.aws/credentials) will be loaded. Values in the shared credentials file take priority when there are duplicated values.

Create a shared config file:

; /home/rstudio-pm/.aws/config


After creating the credentials and/or config files, restart the RStudio Package Manager service.


As a best practice, AWS recommends that you specify credentials in the following order:

  1. Use IAM roles for Amazon EC2 (if your application is running on an Amazon EC2 instance). IAM roles provide temporary security credentials to your instance to make AWS calls. IAM roles provide an easy way to distribute and manage credentials on multiple Amazon EC2 instances.
  2. Use a shared credentials file. This credentials file is the same one used by other SDKs and the AWS CLI. If you’re already using a shared credentials file, you can also use it for this purpose.
  3. Use environment variables. Setting environment variables is useful if you’re doing development work on a machine other than an Amazon EC2 instance.

If you select IAM roles for Amazon EC2 instances, RSPM will automatically use the instance’s credentials.

RStudio Package Manager Configuration#

See the section on Data Destinations for examples of configuring RStudio Package Manager to use S3.

See the S3 Storage Configuration section in the appendix for more details on the S3 storage configuration settings available to RStudio Package Manager.

See the Storage Configuration section in the appendix for details on configuring a variable data storage class to use S3.