fix(firehose): build S3 object keys with AWS prefix expressions and name suffix (#1858)

* fix(firehose): build S3 object keys with AWS prefix expressions and name suffix

Delivered objects now follow the AWS key format
<evaluated prefix><stream>-<version>-<yyyy-MM-dd-HH-mm-ss>-<uuid> observed on
real AWS: default prefix yyyy/MM/dd/HH/ when no Prefix is set, literal
concatenation of the time prefix for expression-free prefixes,
!{timestamp:<pattern>} and !{firehose:random-string} evaluation, no .json
extension, and CustomTimeZone support. The non-AWS {year}/{month}/{day}/{hour}
placeholders are gone.

See floci-io/floci#1857 for the behavior captured against a real AWS account.

* refactor(firehose): cache the default time-prefix DateTimeFormatter

---------

Co-authored-by: Mihai Blidaru <mihai.blidaru@lynxfctech.com>
This commit is contained in:
Mihai BlidaruandMihai Blidaru authored and GitHub committed 2026-08-11 21:40:24 -04:00
1 parent ea1231b8b4
commit a79e04e4ec
10 files changed
+535 -26

No files matched your search

@@ -67,9 +67,16 @@ class DataLakeTest {
.build())
.build());
// 3. Firehose Stream
// 3. Firehose Stream delivering under the Glue table location. The static
// prefix gets yyyy/MM/dd/HH/ appended like real Firehose, which stays
// inside the table location since Athena reads it recursively.
firehose.createDeliveryStream(software.amazon.awssdk.services.firehose.model.CreateDeliveryStreamRequest.builder()
.deliveryStreamName(STREAM_NAME)
.extendedS3DestinationConfiguration(software.amazon.awssdk.services.firehose.model.ExtendedS3DestinationConfiguration.builder()
.bucketARN("arn:aws:s3:::floci-firehose-results")
.roleARN("arn:aws:iam::000000000000:role/datalake-firehose-role")
.prefix(STREAM_NAME + "/")
.build())
.build());
}
@@ -198,6 +198,7 @@ class SesEventPublishingTest {
.s3DestinationConfiguration(S3DestinationConfiguration.builder()
.bucketARN("arn:aws:s3:::" + firehoseBucket)
.roleARN("arn:aws:iam::000000000000:role/sdk-evt-fh-role")
.prefix(firehoseStreamName + "/")
.build())
.build())
.deliveryStreamARN();