Collects endpoint, region, credentials and default bucket. Anything not given as an argument comes from an option, then from the environment, then from the default:
Usage
s3_config(
endpoint = NULL,
region = NULL,
access_key = NULL,
secret_key = NULL,
session_token = NULL,
bucket = NULL,
timeout = NULL,
max_tries = NULL,
multipart_threshold = NULL,
part_size = NULL
)Arguments
- endpoint
scheme://host[:port], no path. Missing endpoint is an error when a request is made, not here.- region
Signing region;
us-east-1is what most self-hosted stores (MinIO, Garage, Ceph) expect.- access_key, secret_key
Credentials. Missing credentials are an error when a request is made, not here.
- session_token
Session token of temporary credentials.
- bucket
Bucket used when a key is not an
s3://bucket/keyURL.- timeout
Time limit of one call, in seconds.
- max_tries
Attempts per call (the first one included).
- multipart_threshold
Bodies larger than this many bytes are uploaded in parts (
write_s3(),upload_s3()).- part_size
Size of each part, in bytes (at least 5 MiB).
Details
| Setting | Option | Environment | Default |
endpoint | s3pe.endpoint | S3PE_ENDPOINT, AWS_ENDPOINT_URL | required |
region | s3pe.region | AWS_REGION, AWS_DEFAULT_REGION | us-east-1 |
access_key | AWS_ACCESS_KEY_ID | required | |
secret_key | AWS_SECRET_ACCESS_KEY | required | |
session_token | AWS_SESSION_TOKEN | none | |
bucket | s3pe.bucket | S3PE_BUCKET | none |
timeout | s3pe.timeout | 300 s | |
max_tries | s3pe.max_tries | 3 | |
multipart_threshold | s3pe.multipart_threshold | S3PE_MULTIPART_THRESHOLD | 64 MiB |
part_size | s3pe.part_size | S3PE_PART_SIZE | 16 MiB (at least 5 MiB) |
Keep credentials in ~/.Renviron (R reads it at start-up), never in
scripts. The endpoint has no default: set it once per machine
(S3PE_ENDPOINT) or per session (use_endpoint()). URLs are always
path-style (endpoint/bucket/key), which every S3-compatible store
accepts.
Examples
if (FALSE) { # interactive()
s3_config()
cfg <- s3_config(endpoint = "https://s3.example.org", bucket = "my-bucket")
list_s3("data/", config = cfg)
}