Getting Started
This is an implementation of an Amazon AWS S3 FileSystem
provider using JSR-203 (a.k.a. NIO2) for Java 8.
Amazon Simple Storage Service provides a fully redundant data storage infrastructure for storing and retrieving any amount of data, at any time.
NIO2 is the new file management API, introduced in Java version 7.
This project provides a complete API implementation, for managing files and folders directly in Amazon S3.
Compatibility¶
We aim to support only the latest LTS versions. At the moment this includes:
- JDK 8
- JDK 11
- JDK 17
- JDK 21
Please note that although we support JDK 8 we have plans to drop it in one of our next major release.
Documentation¶
You can check out our documentation here.
Installation¶
<dependency>
<groupId>org.carlspring.cloud.aws</groupId>
<artifactId>s3fs-nio</artifactId>
<version>1.0.6</version>
</dependency>
implementation("org.carlspring.cloud.aws:s3fs-nio:1.0.6")
implementation 'org.carlspring.cloud.aws:s3fs-nio:1.0.6'
libraryDependencies += "org.carlspring.cloud.aws" % "s3fs-nio" % "1.0.6"
Quick start¶
Amazon S3 Setup¶
- Open S3 Console and add a bucket
- Open IAM and go to
Add User
- Set
Access Type
toProgrammatic Access
or you will get403 Forbidden
errors. - Select
Attach an existing policies directly
- Select
AmazonS3FullAccess
policy andCreate user
(if you prefer more fine-grained access click here) - Copy
Access key ID
andSecret access key
- you will need them later!
Example¶
Create/load a properties file in your project which defines the following properties:
s3fs.bucket.name=/your-bucket-name-for-test
# http://docs.aws.amazon.com/general/latest/gr/rande.html
s3fs.access.key=access-key-for-test
s3fs.secret.key=secret-key-for-test
# check software.amazon.awssdk.regions.Region for quick list
s3fs.region=eu-central-1
s3fs.protocol=https
These properties can also be exported as environment variables. A complete list is available in the Configuration Options
FileSystems.newFileSystem(URI.create("s3:///"),
new HashMap<>(),
Thread.currentThread().getContextClassLoader());