Skip to content

feat: add support for setting S3 storage class on initial object write#1241

Merged
shibd merged 9 commits intostreamnative:masterfrom
mattsre:feat/s3-storage-classes
Mar 4, 2026
Merged

feat: add support for setting S3 storage class on initial object write#1241
shibd merged 9 commits intostreamnative:masterfrom
mattsre:feat/s3-storage-classes

Conversation

@mattsre
Copy link
Copy Markdown
Contributor

@mattsre mattsre commented Feb 6, 2026

Motivation

The connector currently only writes to the STANDARD S3 storage class. If we want to reduce costs by using archival storage classes like Glacier, we must setup a lifecycle policy to transition objects on some schedule to our desired storage class. Transitioning objects has an associated cost, and we pay extra to keep objects in the STANDARD storage class until they can be transitioned to our desired storage class.

I'd like to reduce costs and simplify operations by having the Pulsar S3 connector simply write the object to the desired storage class when the object is initially written.

Modifications

I've added an s3StorageClass parameter to the Sink config which allows setting the storage class which will be used when making the PutObject API call to S3.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • Added unit tests for validating the provided s3StorageClass parameter

Documentation

  • doc

I've updated documentation to include the new s3StorageClass parameter

@mattsre mattsre requested a review from a team as a code owner February 6, 2026 17:09
@github-actions github-actions Bot added the doc This pr contains a document label Feb 6, 2026
@david-streamlio
Copy link
Copy Markdown

david-streamlio commented Feb 6, 2026

Thanks for this improvement!

I see that you have added unit tests for the configuration validation, which is great, but would it be possible to add some integration tests to this, e.g. using the TestContainers framework, etc?

FWIW, I have attached an AI-generated integration test that you can use as a template for the test.

s3-integration.zip

@mattsre
Copy link
Copy Markdown
Contributor Author

mattsre commented Feb 12, 2026

@david-streamlio I've added some integration tests here for verifying the storage class behavior. I haven't written much Java so there was a fair bit of AI help getting these together. Let me know if any changes are required or there's any test cases you'd like to see added!

Comment thread pom.xml Outdated
Comment thread pom.xml
lhotari
lhotari previously approved these changes Feb 25, 2026
Copy link
Copy Markdown
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

lhotari
lhotari previously approved these changes Feb 25, 2026
Copy link
Copy Markdown

@david-streamlio david-streamlio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shibd shibd merged commit ef9c88b into streamnative:master Mar 4, 2026
1 check passed
shibd pushed a commit to shibd/pulsar-io-cloud-storage that referenced this pull request Mar 9, 2026
streamnative#1241)

* feat: allow setting S3 storage class on PutObject requests

* pass through storage class as string, update S3 docs

* add integration tests for setting s3 storage class

* Use testcontainers 1.21.4 and testcontainers-bom

* Use recent junit-jupiter version

* Remove separate maven config for integration tests

* Upgrade some maven plugins to ensure proper support for junit-jupiter

* Fix build output in GitHub Actions workflow

* Fix running junit4 tests

---------

Co-authored-by: Lari Hotari <lhotari@users.noreply.github.com>
(cherry picked from commit ef9c88b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc This pr contains a document

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants