PlatformDeliveryStream
Amazon Data Firehose delivery stream that lands records in S3 (or any Firehose destination).
Defaults
- Destination: a
PlatformBucketnamed{name}-deliverywith GZIP compression, 5 minute / 64 MiB buffering anddata/yyyy/MM/dd/anderrors/<type>/yyyy/MM/dd/prefixes - Error logging to a platform log group
/aws/kinesisfirehose/<stream>with the environment retention - Direct PUT source; pass
source: streamto read from aPlatformStream - AWS owned key for buffered data;
encryptionKeyswitches to a customer managed key for the stream and the default bucket (ignored for the stream when a Kinesis source is set)
Options
destination: either anIDestinationfromaws-cdk-lib/aws-kinesisfirehose(HTTP endpoint, custom) or S3 options (bucket,dataOutputPrefix,compression,bufferingInterval,processors, ...)source:IStream
Alarms
alarms.deliveryFailures():DeliveryToS3.Successbelow 1 for three periods (high)alarms.deliveryFreshness(): records older than 15 minutes before delivery (medium)
Example
ts
const clicks = new PlatformStream(this, "Clicks");
const archive = new PlatformDeliveryStream(this, "ClicksArchive", {
source: clicks,
destination: { dataOutputPrefix: "clicks/!{timestamp:yyyy/MM/dd}/" },
});
archive.alarms.deliveryFailures();
// Direct PUT from a function
const audit = new PlatformDeliveryStream(this, "Audit");
audit.grantPutRecords(apiHandler);
apiHandler.addEnvironment("AUDIT_STREAM_NAME", audit.deliveryStreamName);Use CloudWatch Logs subscription filters with a delivery stream to forward logs to S3 or an external endpoint without a third-party agent.