pub struct AmazonS3Builder { /* private fields */ }
Expand description

Configure a connection to Amazon S3 using the specified credentials in the specified Amazon region and bucket.

Example

let s3 = AmazonS3Builder::new()
 .with_region(REGION)
 .with_bucket_name(BUCKET_NAME)
 .with_access_key_id(ACCESS_KEY_ID)
 .with_secret_access_key(SECRET_KEY)
 .build();

Implementations

Create a new AmazonS3Builder with default values.

Fill the AmazonS3Builder with regular AWS environment variables

Variables extracted from environment:

  • AWS_ACCESS_KEY_ID -> access_key_id
  • AWS_SECRET_ACCESS_KEY -> secret_access_key
  • AWS_DEFAULT_REGION -> region
  • AWS_ENDPOINT -> endpoint
  • AWS_SESSION_TOKEN -> token
Example
use object_store::aws::AmazonS3Builder;

let s3 = AmazonS3Builder::from_env()
    .with_bucket_name("foo")
    .build();

Set the AWS Access Key (required)

Set the AWS Secret Access Key (required)

Set the region (e.g. us-east-1) (required)

Set the bucket_name (required)

Sets the endpoint for communicating with AWS S3. Default value is based on region.

For example, this might be set to "http://localhost:4566: for testing against a localstack instance.

Set the token to use for requests (passed to underlying provider)

Sets what protocol is allowed. If allow_http is :

  • false (default): Only HTTPS are allowed
  • true: HTTP and HTTPS are allowed

Set the retry configuration

By default instance credentials will only be fetched over IMDSv2, as AWS recommends against having IMDSv1 enabled on EC2 instances as it is vulnerable to SSRF attack

However, certain deployment environments, such as those running old versions of kube2iam, may not support IMDSv2. This option will enable automatic fallback to using IMDSv1 if the token endpoint returns a 403 error indicating that IMDSv2 is not supported.

This option has no effect if not using instance credentials

Create a AmazonS3 instance from the provided values, consuming self.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more