AWS S3
<dependency>
<groupId>org.eclipse.store</groupId>
<artifactId>afs-aws-s3</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
<version>2.26.14</version>
</dependency>
General Purpose Buckets
For general purpose buckets you can create a S3Connector handing over a S3Client. Please refer to the official AWS SDK Documentation for details.
S3Client client = S3Client.builder()
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create(ACCESS_KEY, SECRET_ACCESS_KEY)
))
.region(Region.EU_NORTH_1)
.build()
;
BlobStoreFileSystem fileSystem = BlobStoreFileSystem.New(
S3Connector.Caching(client)
);
EmbeddedStorage.start(fileSystem.ensureDirectoryPath("bucket-name", "folder", "subfolder"));
Configuration
When using external configuration, the properties can be set as follows.
# optional, enforces checks
storage-filesystem.target=aws.s3
storage-directory=bucket-name/folder/subfolder
storage-filesystem.aws.s3.credentials.type=static
storage-filesystem.aws.s3.credentials.access-key-id=my-access-key-id
storage-filesystem.aws.s3.credentials.secret-access-key=my-secret-access-key
storage-filesystem.aws.s3.region=us-east-1
Directory Buckets
If you want to use directory buckets just create a S3Connector with a different factory method. Additionally you have to specify the zonal endpoint.
S3Client client = S3Client.builder()
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create(ACCESS_KEY, SECRET_ACCESS_KEY)
))
.region(Region.EU_NORTH_1)
.endpointOverride(new URI("https://s3express-eun1-az1.eu-north-1.amazonaws.com"))
.build()
;
BlobStoreFileSystem fileSystem = BlobStoreFileSystem.New(
S3Connector.CachingDirectory(client)
);
EmbeddedStorage.start(fileSystem.ensureDirectoryPath("bucket-name", "folder", "subfolder"));
Configuration
When using external configuration, the properties can be set as follows.
storage-directory=bucket-name/folder/subfolder
storage-filesystem.aws.s3.directory-bucket=true
storage-filesystem.aws.s3.credentials.type=static
storage-filesystem.aws.s3.credentials.access-key-id=my-access-key-id
storage-filesystem.aws.s3.credentials.secret-access-key=my-secret-access-key
storage-filesystem.aws.s3.region=eu-north-1
storage-filesystem.aws.s3.endpoint-override=https://s3express-eun1-az1.eu-north-1.amazonaws.com
Supported properties
Property | Description | Type |
---|---|---|
endpoint-override |
The endpoint with which the SDK should communicate. |
String |
cache |
Defines if the S3Connector should use caching. |
Boolean |
directory-bucket |
Boolean |
|
region |
Configure the region with which the SDK should communicate. If this is not specified, the SDK will attempt to identify the endpoint automatically using the following logic:
|
String |
credentials.type |
The type of the credentials provider. Supported values are:
|
String |
credentials.access-key-id |
The access key id, used when "credentials.type" is "static". |
String |
credentials.secret-access-key |
The secret access key, used when "credentials.type" is "static". |
String |
Depending on the amount of data and transactions, charges may apply depending on service usage. Please check with your service provider for details. |