S3-Compatible Java Access
Harry
· 14 Sep 2026
· 1 views
Advertisement
Object Storage speaks S3
OCI exposes an S3-compatible endpoint, so the AWS SDK works against it with just an endpoint + customer secret key — portability that matters if you later move to AWS or run provider-agnostic code.
Generate keys + grab the endpoint
# Console: Identity & Security → Customer Secret Keys → Create
# Copy namespace + region, endpoint looks like:
# https://<namespace>.compat.objectstorage.<region>.oraclecloud.comJava (AWS SDK v2 pointed at OCI)
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.auth.credentials.*;
S3Client s3 = S3Client.builder()
.endpointOverride(URI.create(
"https://<namespace>.compat.objectstorage.ap-mumbai-1.oraclecloud.com"))
.region(Region.AP_MUMBAI_1)
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create(accessKey, secretKey)))
.build();
s3.putObject(PutObjectRequest.builder()
.bucket("groovygrails-books").key("backups/2026-09-14.sql.gz").build(),
RequestBody.fromFile(Paths.get("/backups/2026-09-14.sql.gz")));That is identical to AWS — only the endpointOverride changes. The next tutorial covers the real AWS S3 with its own SDK — same shapes, different bucket names.