Unravel โบ Java concepts โบ Cloud and operations
Object storage SDKs (S3, Azure Blob, GCS)
Object storage (Amazon S3, Azure Blob Storage, Google Cloud Storage) keeps files as objects in buckets, addressed by a key.
Learn these first
At a glance
A huge coat check.
- 1You create a client once (S3Client.builder().region(Region.EU_WEST_1).build()) and reuse it: clients are thread safe and hold HTTP connections
- 2putObject(PutObjectRequest.builder().bucket(b).key(k).build(), RequestBody.fromFile(path)) uploads; getObject returns a stream you must read and closelistObjectsV2 returns pages of keys.
- 3Large files use multipart upload (the transfer manager does it automatically) so parts upload in parallel and a failed part is retried alone
- 4A presigned URL grants temporary access to one object without sharing credentials, so browsers upload and download directly instead of through your server
- There are no real folders
- Always close the response stream of getObject
- Every call is a signed HTTPS request (Signature V4: a hash of the request combined with a key derived from the secret and the date)
S3Client s3 = S3Client.builder().region(Region.EU_WEST_1).build();PutObjectRequest request = PutObjectRequest.builder() .bucket("acme-invoices") .key("invoices/2026/" + invoiceId + ".pdf") .contentType("application/pdf") .build();s3.putObject(request, RequestBody.fromFile(pdfPath));- line 1 uses S3Client, the core of Object storage SDKs (S3, Azure Blob, GCS)
- line 3 uses PutObjectRequest, the core of Object storage SDKs (S3, Azure Blob, GCS)
Read the full explanation (about 1 min)
Object storage (Amazon S3, Azure Blob Storage, Google Cloud Storage) keeps files as objects in buckets, addressed by a key. The SDK lets your code upload, download, list and sign access to them over HTTP.
A mental model
A huge coat check. You hand over an item and get a ticket (the key); you cannot edit the coat in place, only replace it with a new one or ask for it back.
How it works
You create a client once (S3Client.builder().region(Region.EU_WEST_1).build()) and reuse it: clients are thread safe and hold HTTP connections.
putObject(PutObjectRequest.builder().bucket(b).key(k).build(), RequestBody.fromFile(path)) uploads; getObject returns a stream you must read and close. listObjectsV2 returns pages of keys.
Large files use multipart upload (the transfer manager does it automatically) so parts upload in parallel and a failed part is retried alone.
A presigned URL grants temporary access to one object without sharing credentials, so browsers upload and download directly instead of through your server.
Going deeper
There are no real folders. A key such as invoices/2026/a.pdf is just a name; listing "a folder" is a prefix query. Renaming means copy then delete, and it is not atomic.
Always close the response stream of getObject. An unclosed stream holds a pooled HTTP connection and eventually starves the client.
Read-after-write is strongly consistent in S3 today, but overwriting keeps no history unless versioning is on. Set lifecycle rules for expiry and cheaper storage classes, or costs grow forever.
Under the hood
Every call is a signed HTTPS request (Signature V4: a hash of the request combined with a key derived from the secret and the date). The SDK retries throttling and 5xx errors with exponential backoff and jitter, and the async client uses non-blocking Netty I/O.
Common mistakes
- Creating a new client per request.
- Not closing the response stream.
- Loading big files into memory instead of streaming.
- Public buckets or long-lived presigned URLs.
How Unravel recognises it
When you paste code, Unravel looks for these signs of object storage sdks (s3, azure blob, gcs). Spotting them yourself is a good habit when you read unfamiliar code:
- Types:
S3ClientS3AsyncClientAmazonS3AmazonS3ClientBuilderS3PresignerPutObjectRequestGetObjectRequestDeleteObjectRequestListObjectsV2RequestTransferManagerS3TransferManagerS3TemplateS3ObjectBlobServiceClientand 9 more
Part of a learning path
- Cloud-native Java ยท previous: Cloud credentials and secrets management ยท next: DynamoDB access
Related concepts
Frequently asked questions
What is Object storage SDKs (S3, Azure Blob, GCS)?
Object storage (Amazon S3, Azure Blob Storage, Google Cloud Storage) keeps files as objects in buckets, addressed by a key. The SDK lets your code upload, download, list and sign access to them over HTTP.
What are the most common mistakes with Object storage SDKs (S3, Azure Blob, GCS)?
Creating a new client per request. Not closing the response stream. Loading big files into memory instead of streaming. Public buckets or long-lived presigned URLs.
How can I see Object storage SDKs (S3, Azure Blob, GCS) in real code?
Paste your own Java into Unravel and it will point out where object storage sdks (s3, azure blob, gcs) appears, explain how it works at the detail level you choose, and draw the flow of the code around it.