Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
218 commits
Select commit Hold shift + click to select a range
8401fb4
feat(aws-kinesisfirehose): DeliveryStream API and basic S3 destination
madeline-k Jul 14, 2021
dca12f2
fix typo in aws-kinesisfirehose-destinations README
madeline-k Jul 14, 2021
6fceebf
remove unnecessary deps
madeline-k Jul 14, 2021
58b3fe1
feat(aws-kinesisfirehose): specific metrics functions for DeliveryStream
madeline-k Jul 14, 2021
55cb8d6
feat(aws-kinesisfirehose): Add support for server-side encryption on …
madeline-k Jul 14, 2021
cfc1427
feat(aws-kinesisfirehose): support for compression on S3 delivery str…
madeline-k Jul 14, 2021
b5b48ed
feat(aws-kinesisfirehose-destinations): support prefixes for S3 desti…
madeline-k Jul 14, 2021
7892f58
Merge branch 'master' into madeline-k/feat/kinesisfirehose-deliveryst…
madeline-k Jul 14, 2021
be0bf89
feat(aws-kinesisfirehose): add support for BufferingHints
madeline-k Jul 14, 2021
c764118
feat(aws-kinesisfirehose): support for S3 destination encryption on D…
madeline-k Jul 14, 2021
78e6a9c
remove awslint exception for IConnectable.connections
madeline-k Jul 15, 2021
5f7a15c
Change name of S3 destination to S3Bucket
madeline-k Jul 15, 2021
efe2fe0
add Role to DestinationBindOptions, update S3 to S3Bucket in tests
madeline-k Jul 15, 2021
4308f44
remove helper function to enforce ExtendedS3DestinationConfigurationP…
madeline-k Jul 15, 2021
172ab43
remove lambda dependency
madeline-k Jul 15, 2021
c0d85f5
update README
madeline-k Jul 15, 2021
3d34c46
remove tagsand ITaggable interface
madeline-k Jul 15, 2021
5ceff5c
use splitArn instead of parseArn
madeline-k Jul 15, 2021
ce4dde1
update error message for bad input ARN
madeline-k Jul 15, 2021
0ed658f
add ArnFormat to formatArn() call
madeline-k Jul 15, 2021
1925560
update error message in tests for bad input ARN
madeline-k Jul 15, 2021
e46c595
pass deliveryStreamName as physicalName through to super constructor
madeline-k Jul 15, 2021
d1463a2
move validation to beginning of constructor
madeline-k Jul 15, 2021
1623199
simplify createLoggingOptions
madeline-k Jul 15, 2021
16a54e5
remove awslint exclude
madeline-k Jul 15, 2021
b011392
feat(aws-kinesisfirehose): specific metrics functions for DeliveryStr…
madeline-k Jul 16, 2021
56aa16a
change name of s3 destination props to S3BucketProps
BenChaimberg Jul 17, 2021
f70fc31
remove basic s3 integration test
BenChaimberg Jul 17, 2021
73f1777
rename integration tests
BenChaimberg Jul 17, 2021
314c4ca
de-exports DeliveryStreamBase
BenChaimberg Jul 17, 2021
64131d1
leverage construct tree to store LogGroup and prevent creating it mul…
madeline-k Jul 17, 2021
4cfc76a
Merge branch 'madeline-k/feat/kinesisfirehose-deliverystream' into ma…
madeline-k Jul 17, 2021
6c78eeb
Revert "feat(aws-kinesisfirehose): specific metrics functions for Del…
madeline-k Jul 17, 2021
ccd9333
cleanup s3 destination unit tests to do less hardcoding
BenChaimberg Jul 17, 2021
99a4167
Merge branch 'madeline-k/feat/kinesisfirehose-deliverystream' into ma…
madeline-k Jul 17, 2021
c77437a
feat(aws-kinesisfirehose): specific metrics functions for DeliveryStream
madeline-k Jul 14, 2021
e37d8ea
make snippets compile and enforce strict compilation
BenChaimberg Jul 17, 2021
cd1618b
remove IDeliveryStream from DestinationBindOptions, only service role…
BenChaimberg Jul 17, 2021
bfe6dd4
remove explicit dependency delivery stream -> service role
BenChaimberg Jul 17, 2021
dcd088d
Revert "remove explicit dependency delivery stream -> service role"
BenChaimberg Jul 17, 2021
0a7e010
destination has separate role
BenChaimberg Jul 17, 2021
c99c242
update @types/jest dependency to match all other modules
madeline-k Jul 19, 2021
157d3ca
loose snippet compilation to avoid cyclic dependency
BenChaimberg Jul 19, 2021
49c184d
Merge remote-tracking branch 'origin/master' into madeline-k/feat/kin…
BenChaimberg Jul 19, 2021
db9ea21
update README
madeline-k Jul 19, 2021
49a839e
Use L1 types in DestinationConfig returned from bind()
madeline-k Jul 19, 2021
c846f4d
Merge branch 'madeline-k/feat/kinesisfirehose-deliverystream' into ma…
madeline-k Jul 19, 2021
ff3fb60
Merge branch 'madeline-k/feat/kinesisfirehose-metrics' into madeline-…
madeline-k Jul 19, 2021
a2c85bd
remove DestinationBase, move createLoggingOptions and DestinationProps
BenChaimberg Jul 19, 2021
569ca01
don't pass role into bind()
madeline-k Jul 19, 2021
af2cb02
Merge branch 'madeline-k/feat/kinesisfirehose-deliverystream' into ma…
madeline-k Jul 19, 2021
b392d12
Merge branch 'madeline-k/feat/kinesisfirehose-metrics' into madeline-…
madeline-k Jul 19, 2021
5ee24d4
remove Node.addDependency's to avoid circular dependency
madeline-k Jul 20, 2021
c425f78
move integ test verification to core module instead of destinations m…
madeline-k Jul 20, 2021
469bf47
update tests and remove addDependency
madeline-k Jul 20, 2021
2514430
Merge branch 'madeline-k/feat/kinesisfirehose-sse' into madeline-k/fe…
madeline-k Jul 20, 2021
97fb6bc
fix build errors from merge
madeline-k Jul 20, 2021
42abd26
udpate implementation after merge
madeline-k Jul 20, 2021
db31e5a
Merge branch 'madeline-k/feat/kinesisfirehose-compression' into madel…
madeline-k Jul 20, 2021
5389186
update integ expected.json
madeline-k Jul 20, 2021
1ae1be4
Merge branch 'madeline-k/feat/kinesisfirehose-prefixes' into madeline…
madeline-k Jul 20, 2021
1f9c228
update unit tests after merge
madeline-k Jul 20, 2021
75f1b56
run integ tests and update expected.json
madeline-k Jul 20, 2021
0eb56d3
Merge branch 'madeline-k/feat/kinesisfirehose-buffering' into madelin…
madeline-k Jul 20, 2021
e3a9ec7
Delete integ.s3-all-properties.expected.json
madeline-k Jul 20, 2021
0883ade
re-run integ tests and update expected.json
madeline-k Jul 20, 2021
37ece90
Merge branch 'madeline-k/feat/kinesisfirehose-prefixes' into madeline…
madeline-k Jul 20, 2021
867b33e
Merge branch 'madeline-k/feat/kinesisfirehose-buffering' into madelin…
madeline-k Jul 20, 2021
a307108
feat(kinesisfirehose): destinations can provide resources to be depen…
BenChaimberg Jul 20, 2021
04d5ae7
remove unused custom-resources dependency
BenChaimberg Jul 20, 2021
93cc0e5
rewrite providing IAM role section (include separate destination role…
BenChaimberg Jul 21, 2021
3aa77bd
add more IAM role detail
BenChaimberg Jul 21, 2021
7883929
snapshot spacing
BenChaimberg Jul 21, 2021
1c65da6
Merge remote-tracking branch 'origin/master' into madeline-k/feat/kin…
BenChaimberg Jul 21, 2021
45fec81
make s3 destination props readonly
BenChaimberg Jul 21, 2021
28c120f
line length linting
BenChaimberg Jul 21, 2021
005402c
do not re-use log group if log group provided in props
BenChaimberg Jul 21, 2021
0f9d42d
rename DestinationProps -> CommonDestinationProps
BenChaimberg Jul 21, 2021
ed02d9f
move logging tests to S3 bucket destination
BenChaimberg Jul 21, 2021
83323ac
Merge branch 'madeline-k/feat/kinesisfirehose-deliverystream' into ma…
madeline-k Jul 21, 2021
9a31251
Merge branch 'madeline-k/feat/kinesisfirehose-metrics' into madeline-…
madeline-k Jul 21, 2021
142e096
re-run integration tests and update snapshot
madeline-k Jul 21, 2021
d075e18
Merge branch 'madeline-k/feat/kinesisfirehose-sse' into madeline-k/fe…
madeline-k Jul 21, 2021
645d59b
Merge branch 'madeline-k/feat/kinesisfirehose-compression' into madel…
madeline-k Jul 21, 2021
9a7fad1
Merge branch 'madeline-k/feat/kinesisfirehose-prefixes' into madeline…
madeline-k Jul 21, 2021
2cbe865
Merge branch 'madeline-k/feat/kinesisfirehose-buffering' into madelin…
madeline-k Jul 21, 2021
9cddb50
feat(aws-kinesisfirehose): support for Lambda data processors
madeline-k Jul 21, 2021
a1e5c52
update README to use correct S3Bucket class name
madeline-k Jul 21, 2021
ff92e3e
Merge branch 'madeline-k/feat/kinesisfirehose-compression' into madel…
madeline-k Jul 21, 2021
6ea22a2
update README to use correct S3Bucket class name
madeline-k Jul 21, 2021
324f78c
Merge branch 'madeline-k/feat/kinesisfirehose-prefixes' into madeline…
madeline-k Jul 21, 2021
95aa481
update README to use correct S3Bucket class name
madeline-k Jul 21, 2021
96909d1
Merge branch 'madeline-k/feat/kinesisfirehose-buffering' into madelin…
madeline-k Jul 21, 2021
c39bb5a
update README to use correct S3Bucket class name
madeline-k Jul 21, 2021
ccd8097
Merge branch 'madeline-k/feat/kinesisfirehose-encryption-dest' into m…
madeline-k Jul 21, 2021
d541b9a
refactor unit tests
madeline-k Jul 21, 2021
00aa894
feat(aws-kinesisfirehose): Add support for backing up source records …
madeline-k Jul 22, 2021
aa857cd
add missing 'Bucket' to README
madeline-k Jul 22, 2021
c6a8553
Merge branch 'master' into madeline-k/feat/kinesisfirehose-deliveryst…
madeline-k Jul 22, 2021
e717474
Merge branch 'madeline-k/feat/kinesisfirehose-deliverystream' into ma…
madeline-k Jul 22, 2021
4b1f5fe
Merge branch 'madeline-k/feat/kinesisfirehose-metrics' into madeline-…
madeline-k Jul 22, 2021
7071ba9
Merge branch 'madeline-k/feat/kinesisfirehose-sse' into madeline-k/fe…
madeline-k Jul 22, 2021
f1ecc73
Merge branch 'madeline-k/feat/kinesisfirehose-compression' into madel…
madeline-k Jul 22, 2021
7dce50f
Merge branch 'madeline-k/feat/kinesisfirehose-prefixes' into madeline…
madeline-k Jul 22, 2021
29ea6f5
Merge branch 'madeline-k/feat/kinesisfirehose-buffering' into madelin…
madeline-k Jul 22, 2021
583b2fe
Merge branch 'madeline-k/feat/kinesisfirehose-encryption-dest' into m…
madeline-k Jul 22, 2021
b95455e
Merge branch 'madeline-k/feat/kinesisfirehose-dataprocessors' into ma…
madeline-k Jul 22, 2021
2bcc663
Merge branch 'master' of github.com:aws/aws-cdk into madeline-k/feat/…
BenChaimberg Jul 22, 2021
98d6371
use new lazy mappings for CIDR blocks
BenChaimberg Jul 22, 2021
e006441
update S3 -> S3Bucket class name in default.ts-fixture
madeline-k Jul 22, 2021
814c61e
remove example that won't translate to other languages
madeline-k Jul 22, 2021
6bc7b60
Merge branch 'madeline-k/feat/kinesisfirehose-dataprocessors' into ma…
madeline-k Jul 22, 2021
52d78d4
Merge branch 'madeline-k/feat/kinesisfirehose-deliverystream' into ma…
madeline-k Jul 22, 2021
86c7cb7
Apply suggestions from code review
madeline-k Jul 22, 2021
f8b03c4
remove private index.ts
madeline-k Jul 22, 2021
8c2903e
hardcode logical IDs in unit tests
madeline-k Jul 22, 2021
2b3b2cf
Merge branch 'madeline-k/feat/kinesisfirehose-deliverystream' into ma…
madeline-k Jul 22, 2021
b7b897d
Merge branch 'madeline-k/feat/kinesisfirehose-metrics' into madeline-…
madeline-k Jul 22, 2021
5aab535
Merge branch 'madeline-k/feat/kinesisfirehose-sse' into madeline-k/fe…
madeline-k Jul 22, 2021
8c0cfe3
Merge branch 'madeline-k/feat/kinesisfirehose-compression' into madel…
madeline-k Jul 22, 2021
d916736
Merge branch 'madeline-k/feat/kinesisfirehose-prefixes' into madeline…
madeline-k Jul 22, 2021
71b4239
Merge branch 'madeline-k/feat/kinesisfirehose-buffering' into madelin…
madeline-k Jul 22, 2021
569743b
Merge branch 'madeline-k/feat/kinesisfirehose-encryption-dest' into m…
madeline-k Jul 22, 2021
65bc7c5
Merge branch 'madeline-k/feat/kinesisfirehose-dataprocessors' into ma…
madeline-k Jul 22, 2021
8045edc
update tests
madeline-k Jul 22, 2021
4827969
Merge branch 'madeline-k/feat/kinesisfirehose-dataprocessors' into ma…
madeline-k Jul 22, 2021
ddcbd31
fix typo
madeline-k Jul 22, 2021
7792efa
add unit tests
madeline-k Jul 23, 2021
407ca46
Merge branch 'madeline-k/feat/kinesisfirehose-buffering' into madelin…
madeline-k Jul 23, 2021
93071c5
unit tests
madeline-k Jul 23, 2021
0417b29
Merge branch 'madeline-k/feat/kinesisfirehose-encryption-dest' into m…
madeline-k Jul 23, 2021
ab33d0f
Merge branch 'master' into madeline-k/feat/kinesisfirehose-metrics
madeline-k Jul 23, 2021
0e63e66
Merge branch 'madeline-k/feat/kinesisfirehose-metrics' into madeline-…
madeline-k Jul 23, 2021
df298b0
Merge branch 'madeline-k/feat/kinesisfirehose-sse' into madeline-k/fe…
madeline-k Jul 23, 2021
7d5956d
Merge branch 'madeline-k/feat/kinesisfirehose-compression' into madel…
madeline-k Jul 23, 2021
09bfa3a
Merge branch 'madeline-k/feat/kinesisfirehose-prefixes' into madeline…
madeline-k Jul 23, 2021
31a5c51
Merge branch 'madeline-k/feat/kinesisfirehose-buffering' into madelin…
madeline-k Jul 23, 2021
89e6f8e
Merge branch 'madeline-k/feat/kinesisfirehose-encryption-dest' into m…
madeline-k Jul 23, 2021
f19704b
Merge branch 'madeline-k/feat/kinesisfirehose-dataprocessors' into ma…
madeline-k Jul 23, 2021
12211e3
Update packages/@aws-cdk/aws-kinesisfirehose/README.md
madeline-k Jul 23, 2021
124c354
remove unused dev dependencies
madeline-k Jul 26, 2021
43f2ecf
Update packages/@aws-cdk/aws-kinesisfirehose/test/delivery-stream.tes…
madeline-k Jul 26, 2021
3325990
Update packages/@aws-cdk/aws-kinesisfirehose/test/delivery-stream.tes…
madeline-k Jul 26, 2021
34e29b4
Update packages/@aws-cdk/aws-kinesisfirehose-destinations/lib/private…
madeline-k Jul 26, 2021
8ac8ea3
Merge branch 'master' into madeline-k/feat/kinesisfirehose-metrics
madeline-k Jul 27, 2021
950724e
make constructor props available as a readonly property on the DataPr…
madeline-k Jul 27, 2021
8bc6c88
README formatting
BenChaimberg Jul 28, 2021
1aa653e
deduplicate delivery stream creation in metrics tests
BenChaimberg Jul 28, 2021
9ee3651
Merge remote-tracking branch 'origin/madeline-k/feat/kinesisfirehose-…
BenChaimberg Jul 28, 2021
44d3805
README formatting
BenChaimberg Jul 28, 2021
6207614
docstring clarification of defaults
BenChaimberg Jul 28, 2021
5c790a6
add comment detailing why explicit dependency on key grant is not added
BenChaimberg Jul 28, 2021
61391a4
Merge branch 'madeline-k/feat/kinesisfirehose-sse' into madeline-k/fe…
BenChaimberg Jul 28, 2021
c30312d
remove Compression.UNCOMPRESSED, add Compression.of, make constructor…
BenChaimberg Jul 28, 2021
380ad3d
Merge branch 'madeline-k/feat/kinesisfirehose-compression' into madel…
BenChaimberg Jul 28, 2021
9fe4d6a
rename prefix -> dataOutputPrefix
BenChaimberg Jul 28, 2021
bd114cb
Merge branch 'madeline-k/feat/kinesisfirehose-prefixes' into madeline…
BenChaimberg Jul 28, 2021
41e01e9
don't force users to provide buffering values when we have defaults
BenChaimberg Jul 28, 2021
f388b3c
Merge branch 'madeline-k/feat/kinesisfirehose-buffering' into madelin…
BenChaimberg Jul 28, 2021
d54389d
remove duplicated test
BenChaimberg Jul 28, 2021
8dbb5ae
typo and unnecessary truthy testing
BenChaimberg Jul 28, 2021
24f53cf
apply Adam's feedback
madeline-k Jul 28, 2021
c471df4
move processor.ts to firehose module
madeline-k Jul 28, 2021
fb0c21a
separate LambdaFunctionProcessor to its own file
madeline-k Jul 28, 2021
7419fa0
Merge branch 'madeline-k/feat/kinesisfirehose-encryption-dest' into m…
madeline-k Jul 28, 2021
2663007
fix trailing comma in package.json after merge
madeline-k Jul 28, 2021
a3dde9d
Merge branch 'madeline-k/feat/kinesisfirehose-dataprocessors' into ma…
madeline-k Jul 28, 2021
eaaf8f0
Merge branch 'madeline-k/feat/kinesisfirehose-backup' of github.com:a…
madeline-k Jul 28, 2021
57e37a9
remove BackupMode.DISABLED, rename DestinationBackupOutput to Destina…
madeline-k Jul 28, 2021
dcb21ba
rename DestinationLoggingOutput to DestinationLoggingConfig
madeline-k Jul 28, 2021
5f4577a
Merge branch 'master' into madeline-k/feat/kinesisfirehose-metrics
madeline-k Jul 28, 2021
6ac183e
Merge branch 'madeline-k/feat/kinesisfirehose-metrics' into madeline-…
madeline-k Jul 28, 2021
387fbef
Merge branch 'madeline-k/feat/kinesisfirehose-sse' into madeline-k/fe…
madeline-k Jul 28, 2021
46d48d3
Merge branch 'madeline-k/feat/kinesisfirehose-compression' into madel…
madeline-k Jul 28, 2021
b223955
Merge branch 'madeline-k/feat/kinesisfirehose-prefixes' into madeline…
madeline-k Jul 28, 2021
97e03d7
Merge branch 'madeline-k/feat/kinesisfirehose-buffering' into madelin…
madeline-k Jul 28, 2021
bf1452f
Merge branch 'madeline-k/feat/kinesisfirehose-encryption-dest' into m…
madeline-k Jul 28, 2021
f5702aa
Merge branch 'madeline-k/feat/kinesisfirehose-dataprocessors' into ma…
madeline-k Jul 28, 2021
1a525bf
add missing newlines to end of files
madeline-k Jul 28, 2021
865a9aa
move backupMode validation to constructor
madeline-k Jul 28, 2021
9793012
only add BufferingHints to template if user defined them
madeline-k Jul 28, 2021
397c56f
add verification that either both or neither of bufferringInterval an…
madeline-k Jul 28, 2021
2772b1f
remove direct import of S3Bucket
madeline-k Jul 28, 2021
81672d5
allow user to specify only one of bufferingInterval and bufferingSize
madeline-k Jul 28, 2021
a33eff2
refactor backup props existence checking logic
madeline-k Jul 28, 2021
ba08799
Apply suggestions from code review
madeline-k Jul 28, 2021
2748ea9
inline processorIdentifier
madeline-k Jul 28, 2021
ca59756
refactor so that processor.bind() can return the constructor props i.…
madeline-k Jul 28, 2021
9f9c7f8
Merge branch 'master' into madeline-k/feat/kinesisfirehose-compression
madeline-k Jul 28, 2021
0754886
Revert "refactor so that processor.bind() can return the constructor …
madeline-k Jul 28, 2021
84e6773
remove ProcessorProperty creation logic to separate function
madeline-k Jul 28, 2021
385a49c
refactor createProcessingConfig
madeline-k Jul 28, 2021
e6b6e6c
refactor API to only accept one processor instead of an array
madeline-k Jul 28, 2021
61ccc68
udpate README
madeline-k Jul 28, 2021
e8f116c
add lit suffix to integ test
madeline-k Jul 28, 2021
bcb6b37
add lit suffix to integration test reference in README
madeline-k Jul 28, 2021
2b31c9f
some renaming
madeline-k Jul 28, 2021
1351caf
remove redundant 'backup' in some property names
madeline-k Jul 28, 2021
98f91f0
Apply suggestions from code review
madeline-k Jul 28, 2021
d47d4b7
Update packages/@aws-cdk/aws-kinesisfirehose/README.md
madeline-k Jul 28, 2021
e0f7901
Merge branch 'madeline-k/feat/kinesisfirehose-compression' into madel…
madeline-k Jul 28, 2021
e6ffd73
Merge branch 'madeline-k/feat/kinesisfirehose-prefixes' into madeline…
madeline-k Jul 28, 2021
bbc3700
Merge branch 'madeline-k/feat/kinesisfirehose-buffering' into madelin…
madeline-k Jul 28, 2021
5fdb4b7
Merge branch 'madeline-k/feat/kinesisfirehose-encryption-dest' into m…
madeline-k Jul 28, 2021
01d2ed8
Merge branch 'madeline-k/feat/kinesisfirehose-dataprocessors' into ma…
madeline-k Jul 28, 2021
1e9da98
fix file reference to integration test in README
madeline-k Jul 28, 2021
d2af3de
Merge branch 'madeline-k/feat/kinesisfirehose-dataprocessors' into ma…
madeline-k Jul 28, 2021
263738d
update README
madeline-k Jul 28, 2021
07d96c1
don't add unnecessary fields to the template if backup is disabled
madeline-k Jul 28, 2021
e36969d
don't add encryptionconfiguration to template unless it is needed
madeline-k Jul 28, 2021
bf6f4bc
Merge branch 'master' into madeline-k/feat/kinesisfirehose-encryption…
madeline-k Jul 29, 2021
6f599a5
Merge branch 'madeline-k/feat/kinesisfirehose-encryption-dest' into m…
madeline-k Jul 29, 2021
0eca26d
Merge branch 'madeline-k/feat/kinesisfirehose-dataprocessors' into ma…
madeline-k Jul 29, 2021
22ef045
fix unit tests after merge
madeline-k Jul 29, 2021
d1a6905
Remove outdated buffering docs
BenChaimberg Jul 29, 2021
8efe8d9
Merge remote-tracking branch 'origin/master' into madeline-k/feat/kin…
BenChaimberg Jul 29, 2021
7914cb8
Merge branch 'master' into madeline-k/feat/kinesisfirehose-backup
madeline-k Jul 30, 2021
36dc4b8
Merge branch 'master' into madeline-k/feat/kinesisfirehose-backup
mergify[bot] Jul 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 122 additions & 2 deletions packages/@aws-cdk/aws-kinesisfirehose-destinations/lib/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as iam from '@aws-cdk/aws-iam';
import * as firehose from '@aws-cdk/aws-kinesisfirehose';
import * as kms from '@aws-cdk/aws-kms';
import * as logs from '@aws-cdk/aws-logs';
import * as s3 from '@aws-cdk/aws-s3';
import * as cdk from '@aws-cdk/core';

/**
* Possible compression options Kinesis Data Firehose can use to compress data on delivery.
Expand Down Expand Up @@ -40,9 +43,24 @@ export class Compression {
}

/**
* Generic properties for defining a delivery stream destination.
* Options for S3 record backup of a delivery stream.
*/
export enum BackupMode {
/**
* All records are backed up.
*/
ALL,

/**
* Only records that failed to deliver or transform are backed up.
*/
FAILED,
}

/**
* Logging related properties for a delivery stream destination.
*/
export interface CommonDestinationProps {
interface DestinationLoggingProps {
/**
* If true, log errors when data transformation or data delivery fails.
*
Expand All @@ -58,7 +76,102 @@ export interface CommonDestinationProps {
* @default - if `logging` is set to `true`, a log group will be created for you.
*/
readonly logGroup?: logs.ILogGroup;
}

/**
* Common properties for defining a backup, intermediary, or final S3 destination for a Kinesis Data Firehose delivery stream.
*/
export interface CommonDestinationS3Props {
/**
* The length of time that Firehose buffers incoming data before delivering
* it to the S3 bucket.
*
* Minimum: Duration.seconds(60)
* Maximum: Duration.seconds(900)
*
* @default Duration.seconds(300)
*/
readonly bufferingInterval?: cdk.Duration;

/**
* The size of the buffer that Kinesis Data Firehose uses for incoming data before
* delivering it to the S3 bucket.
*
* Minimum: Size.mebibytes(1)
* Maximum: Size.mebibytes(128)
*
* @default Size.mebibytes(5)
*/
readonly bufferingSize?: cdk.Size;

/**
* The type of compression that Kinesis Data Firehose uses to compress the data
* that it delivers to the Amazon S3 bucket.
*
* The compression formats SNAPPY or ZIP cannot be specified for Amazon Redshift
* destinations because they are not supported by the Amazon Redshift COPY operation
* that reads from the S3 bucket.
*
* @default - UNCOMPRESSED
*/
readonly compression?: Compression;

/**
* The AWS KMS key used to encrypt the data that it delivers to your Amazon S3 bucket.
*
* @default - Data is not encrypted.
*/
readonly encryptionKey?: kms.IKey;

/**
* A prefix that Kinesis Data Firehose evaluates and adds to failed records before writing them to S3.
*
* This prefix appears immediately following the bucket name.
* @see https://docs.aws.amazon.com/firehose/latest/dev/s3-prefixes.html
*
* @default "YYYY/MM/DD/HH"
*/
readonly errorOutputPrefix?: string;

/**
* A prefix that Kinesis Data Firehose evaluates and adds to records before writing them to S3.
*
* This prefix appears immediately following the bucket name.
* @see https://docs.aws.amazon.com/firehose/latest/dev/s3-prefixes.html
*
* @default "YYYY/MM/DD/HH"
*/
readonly dataOutputPrefix?: string;
}

/**
* Properties for defining an S3 backup destination.
*
* S3 backup is available for all destinations, regardless of whether the final destination is S3 or not.
*/
export interface DestinationS3BackupProps extends DestinationLoggingProps, CommonDestinationS3Props {
/**
* The S3 bucket that will store data and failed records.
*
* @default - If `backup` is set to `BackupMode.ALL` or `BackupMode.FAILED`, a bucket will be created for you.
*/
readonly bucket?: s3.IBucket;

/**
* Indicates the mode by which incoming records should be backed up to S3, if any.
*
* If `backupBucket ` is provided, this will be implicitly set to `BackupMode.ALL`.
*
* @default - If `backupBucket` is provided, the default will be `BackupMode.ALL`. Otherwise,
* source records are not backed up to S3.
*/
readonly mode?: BackupMode;
}

/**
* Generic properties for defining a delivery stream destination.
*/
export interface CommonDestinationProps extends DestinationLoggingProps {
/**
* The IAM role associated with this destination.
*
Expand All @@ -74,4 +187,11 @@ export interface CommonDestinationProps {
* @default - no data transformation will occur.
*/
readonly processor?: firehose.IDataProcessor;

/**
* The configuration for backing up source records to S3.
*
* @default - source records will not be backed up to S3.
*/
readonly s3Backup?: DestinationS3BackupProps;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import * as iam from '@aws-cdk/aws-iam';
import * as firehose from '@aws-cdk/aws-kinesisfirehose';
import * as kms from '@aws-cdk/aws-kms';
import * as logs from '@aws-cdk/aws-logs';
import * as s3 from '@aws-cdk/aws-s3';
import * as cdk from '@aws-cdk/core';
import { Construct, Node } from 'constructs';
import { DestinationS3BackupProps } from '../common';

export interface DestinationLoggingProps {
/**
Expand Down Expand Up @@ -35,19 +37,28 @@ export interface DestinationLoggingProps {
readonly streamId: string;
}

export interface DestinationLoggingOutput {
interface ConfigWithDependables {
/**
* Resources that were created by the sub-config creator that must be deployed before the delivery stream is deployed.
*/
readonly dependables: cdk.IDependable[];
}

export interface DestinationLoggingConfig extends ConfigWithDependables {
/**
* Logging options that will be injected into the destination configuration.
*/
readonly loggingOptions: firehose.CfnDeliveryStream.CloudWatchLoggingOptionsProperty;
}

export interface DestinationBackupConfig extends ConfigWithDependables {
/**
* Resources that were created by the sub-config creator that must be deployed before the delivery stream is deployed.
* S3 backup configuration that will be injected into the destination configuration.
*/
readonly dependables: cdk.IDependable[];
readonly backupConfig: firehose.CfnDeliveryStream.S3DestinationConfigurationProperty;
}

export function createLoggingOptions(scope: Construct, props: DestinationLoggingProps): DestinationLoggingOutput | undefined {
export function createLoggingOptions(scope: Construct, props: DestinationLoggingProps): DestinationLoggingConfig | undefined {
if (props.logging === false && props.logGroup) {
throw new Error('logging cannot be set to false when logGroup is provided');
}
Expand Down Expand Up @@ -130,3 +141,33 @@ function renderDataProcessor(
parameters,
};
}

export function createBackupConfig(scope: Construct, role: iam.IRole, props?: DestinationS3BackupProps): DestinationBackupConfig | undefined {
if (!props || (props.mode === undefined && !props.bucket)) {
return undefined;
}

const bucket = props.bucket ?? new s3.Bucket(scope, 'BackupBucket');
const bucketGrant = bucket.grantReadWrite(role);

const { loggingOptions, dependables: loggingDependables } = createLoggingOptions(scope, {
logging: props.logging,
logGroup: props.logGroup,
role,
streamId: 'S3Backup',
}) ?? {};

return {
backupConfig: {
bucketArn: bucket.bucketArn,
roleArn: role.roleArn,
prefix: props.dataOutputPrefix,
errorOutputPrefix: props.errorOutputPrefix,
bufferingHints: createBufferingHints(props.bufferingInterval, props.bufferingSize),
compressionFormat: props.compression?.value,
encryptionConfiguration: createEncryptionConfig(role, props.encryptionKey),
cloudWatchLoggingOptions: loggingOptions,
},
dependables: [bucketGrant, ...(loggingDependables ?? [])],
};
}
85 changes: 18 additions & 67 deletions packages/@aws-cdk/aws-kinesisfirehose-destinations/lib/s3-bucket.ts
Original file line number Diff line number Diff line change
@@ -1,83 +1,25 @@
import * as iam from '@aws-cdk/aws-iam';
import * as firehose from '@aws-cdk/aws-kinesisfirehose';
import * as kms from '@aws-cdk/aws-kms';
import * as s3 from '@aws-cdk/aws-s3';
import { Duration, Size } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { CommonDestinationProps, Compression } from './common';
import { createBufferingHints, createEncryptionConfig, createLoggingOptions, createProcessingConfig } from './private/helpers';
import { BackupMode, CommonDestinationProps, CommonDestinationS3Props } from './common';
import { createBackupConfig, createBufferingHints, createEncryptionConfig, createLoggingOptions, createProcessingConfig } from './private/helpers';

/**
* Props for defining an S3 destination of a Kinesis Data Firehose delivery stream.
*/
export interface S3BucketProps extends CommonDestinationProps {
/**
* The length of time that Firehose buffers incoming data before delivering
* it to the S3 bucket.
*
* Minimum: Duration.seconds(60)
* Maximum: Duration.seconds(900)
*
* @default Duration.seconds(300)
*/
readonly bufferingInterval?: Duration;

/**
* The size of the buffer that Kinesis Data Firehose uses for incoming data before
* delivering it to the S3 bucket.
*
* Minimum: Size.mebibytes(1)
* Maximum: Size.mebibytes(128)
*
* @default Size.mebibytes(5)
*/
readonly bufferingSize?: Size;

/**
* The type of compression that Kinesis Data Firehose uses to compress the data
* that it delivers to the Amazon S3 bucket.
*
* The compression formats SNAPPY or ZIP cannot be specified for Amazon Redshift
* destinations because they are not supported by the Amazon Redshift COPY operation
* that reads from the S3 bucket.
*
* @default - no compression is applied
*/
readonly compression?: Compression;

/**
* The AWS KMS key used to encrypt the data that it delivers to your Amazon S3 bucket.
*
* @default - Data is not encrypted.
*/
readonly encryptionKey?: kms.IKey;

/**
* A prefix that Kinesis Data Firehose evaluates and adds to failed records before writing them to S3.
*
* This prefix appears immediately following the bucket name.
* @see https://docs.aws.amazon.com/firehose/latest/dev/s3-prefixes.html
*
* @default "YYYY/MM/DD/HH"
*/
readonly errorOutputPrefix?: string;

/**
* A prefix that Kinesis Data Firehose evaluates and adds to records before writing them to S3.
*
* This prefix appears immediately following the bucket name.
* @see https://docs.aws.amazon.com/firehose/latest/dev/s3-prefixes.html
*
* @default "YYYY/MM/DD/HH"
*/
readonly dataOutputPrefix?: string;
export interface S3BucketProps extends CommonDestinationS3Props, CommonDestinationProps {
}

/**
* An S3 bucket destination for data from a Kinesis Data Firehose delivery stream.
*/
export class S3Bucket implements firehose.IDestination {
constructor(private readonly bucket: s3.IBucket, private readonly props: S3BucketProps = {}) { }
constructor(private readonly bucket: s3.IBucket, private readonly props: S3BucketProps = {}) {
if (this.props.s3Backup?.mode === BackupMode.FAILED) {
throw new Error('S3 destinations do not support BackupMode.FAILED');
}
}

bind(scope: Construct, _options: firehose.DestinationBindOptions): firehose.DestinationConfig {
const role = this.props.role ?? new iam.Role(scope, 'S3 Destination Role', {
Expand All @@ -93,19 +35,28 @@ export class S3Bucket implements firehose.IDestination {
streamId: 'S3Destination',
}) ?? {};

const { backupConfig, dependables: backupDependables } = createBackupConfig(scope, role, this.props.s3Backup) ?? {};
return {
extendedS3DestinationConfiguration: {
cloudWatchLoggingOptions: loggingOptions,
processingConfiguration: createProcessingConfig(scope, role, this.props.processor),
roleArn: role.roleArn,
s3BackupConfiguration: backupConfig,
s3BackupMode: this.getS3BackupMode(),
bufferingHints: createBufferingHints(this.props.bufferingInterval, this.props.bufferingSize),
bucketArn: this.bucket.bucketArn,
compressionFormat: this.props.compression?.value,
encryptionConfiguration: createEncryptionConfig(role, this.props.encryptionKey),
errorOutputPrefix: this.props.errorOutputPrefix,
prefix: this.props.dataOutputPrefix,
},
dependables: [bucketGrant, ...(loggingDependables ?? [])],
dependables: [bucketGrant, ...(loggingDependables ?? []), ...(backupDependables ?? [])],
};
}

private getS3BackupMode(): string | undefined {
return this.props.s3Backup?.bucket || this.props.s3Backup?.mode === BackupMode.ALL
? 'Enabled'
: undefined;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would probably return undefined here only if this.props. s3Backup was undefined. But that's a super minor nitpick.

}
}
Loading