8 AWS S3 Configuration
8.1 Destinations
You can configure variable data storage classes to use AWS S3 for storage. See section 7.9 for more information on configuring a variable data storage class to use AWS S3.
8.2 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.
8.3 Configuration Examples
To interact with S3, you will typically configure either environment variables or a credentials file.
8.3.1 Environment Variables
Refer to AWS Environment Variables for more information on environment variables. Here are two examples:
8.3.1.1 Ubuntu 14 and Red Hat/CentOS 6
Edit the file /etc/init/rstudio-pm.override
; /etc/init/rstudio-pm.override
env AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
env AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
env AWS_DEFAULT_REGION=us-west-2
Restart the RStudio Package Manager service with sudo restart rstudio-pm
.
8.3.1.2 Ubuntu 16+, Red Hat/CentOS 7, openSUSE/SLES
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
Environment="AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE"
Environment="AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
Environment="AWS_DEFAULT_REGION=us-west-2"
Reload the systemd
process and restart the RStudio Package Manager service with:
sudo systemctl daemon-reload
sudo systemctl start rstudio-pm
8.3.2 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
[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
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 istrue
, 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
[default]
region=us-west-2
After creating the credentials
and/or config
files, restart the RStudio Package
Manager service.
8.3.3 RStudio Package Manager Configuration
See section 7.9 for examples of configuring RStudio Package Manager to use S3.
See section A.17 for more details on the S3 storage configuration settings available to RStudio Package Manager.
See section A.15 for details on configuring a variable data storage class to use S3.