Skip to content

Commit 85b5f7a

Browse files
authored
feat(aws-kinesisstreams-kinesisfirehose-s3): added loggingBucketProps and logS3AccessLogs (#493)
* added loggingBucketProps and logS3AccessLogs * redeploy stack for cfn nag suppress
1 parent 0af95f5 commit 85b5f7a

13 files changed

+651
-107
lines changed

source/patterns/@aws-solutions-constructs/aws-kinesisstreams-kinesisfirehose-s3/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ _Parameters_
5353
|kinesisFirehoseProps?|[`kinesisfirehose.CfnDeliveryStreamProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kinesisfirehose.CfnDeliveryStreamProps.html)\|`any`|Optional user provided props to override the default props for Kinesis Firehose Delivery Stream.|
5454
|kinesisStreamProps?|[`kinesis.StreamProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-kinesis.StreamProps.html)|Optional user-provided props to override the default props for the Kinesis stream.|
5555
|logGroupProps?|[`logs.LogGroupProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroupProps.html)|Optional user provided props to override the default props for for the CloudWatchLogs LogGroup.|
56+
|loggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.BucketProps.html)|Optional user provided props to override the default props for the S3 Logging Bucket.|
57+
|logS3AccessLogs?| boolean|Whether to turn on Access Logging for the S3 bucket. Creates an S3 bucket with associated storage costs for the logs. Enabling Access Logging is a best practice. default - true|
5658

5759
## Pattern Properties
5860

@@ -66,6 +68,7 @@ _Parameters_
6668
|kinesisStreamRole|[`iam.Role`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.Role.html)|Returns an instance of the iam.Role created by the construct for Kinesis stream|
6769
|s3Bucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.Bucket.html)|Returns an instance of s3.Bucket created by the construct|
6870
|s3LoggingBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.Bucket.html)|Returns an instance of s3.Bucket created by the construct as the logging bucket for the primary bucket|
71+
|s3BucketInterface|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Returns an instance of s3.IBucket created by the construct|
6972

7073
## Default settings
7174

source/patterns/@aws-solutions-constructs/aws-kinesisstreams-kinesisfirehose-s3/lib/index.ts

+18-5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,19 @@ export interface KinesisStreamsToKinesisFirehoseToS3Props {
7676
* @default - Default props are used
7777
*/
7878
readonly logGroupProps?: logs.LogGroupProps;
79+
/**
80+
* Optional user provided props to override the default props for the S3 Logging Bucket.
81+
*
82+
* @default - Default props are used
83+
*/
84+
readonly loggingBucketProps?: s3.BucketProps;
85+
/**
86+
* Whether to turn on Access Logs for the S3 bucket with the associated storage costs.
87+
* Enabling Access Logging is a best practice.
88+
*
89+
* @default - true
90+
*/
91+
readonly logS3AccessLogs?: boolean;
7992
}
8093

8194
export class KinesisStreamsToKinesisFirehoseToS3 extends Construct {
@@ -87,6 +100,7 @@ export class KinesisStreamsToKinesisFirehoseToS3 extends Construct {
87100
public readonly kinesisStreamRole: iam.Role;
88101
public readonly s3Bucket?: s3.Bucket;
89102
public readonly s3LoggingBucket?: s3.Bucket;
103+
public readonly s3BucketInterface: s3.IBucket;
90104

91105
/**
92106
* @summary Constructs a new instance of the KinesisStreamsToKinesisFirehoseToS3 class.
@@ -100,10 +114,6 @@ export class KinesisStreamsToKinesisFirehoseToS3 extends Construct {
100114
super(scope, id);
101115
defaults.CheckProps(props);
102116

103-
if (props.existingBucketObj && props.bucketProps) {
104-
throw new Error('Cannot specify both bucket properties and an existing bucket');
105-
}
106-
107117
// Setup the Kinesis Stream
108118
this.kinesisStream = defaults.buildKinesisStream(this, {
109119
existingStreamObj: props.existingStreamObj,
@@ -151,14 +161,17 @@ export class KinesisStreamsToKinesisFirehoseToS3 extends Construct {
151161
existingBucketObj: props.existingBucketObj,
152162
existingLoggingBucketObj: props.existingLoggingBucketObj,
153163
bucketProps: props.bucketProps,
154-
logGroupProps: props.logGroupProps
164+
logGroupProps: props.logGroupProps,
165+
loggingBucketProps: props.loggingBucketProps,
166+
logS3AccessLogs: props.logS3AccessLogs
155167
});
156168

157169
this.kinesisFirehose = kdfToS3Construct.kinesisFirehose;
158170
this.kinesisFirehoseRole = kdfToS3Construct.kinesisFirehoseRole;
159171
this.kinesisFirehoseLogGroup = kdfToS3Construct.kinesisFirehoseLogGroup;
160172
this.s3Bucket = kdfToS3Construct.s3Bucket;
161173
this.s3LoggingBucket = kdfToS3Construct.s3LoggingBucket;
174+
this.s3BucketInterface = kdfToS3Construct.s3BucketInterface;
162175

163176
if (props.createCloudWatchAlarms === undefined || props.createCloudWatchAlarms) {
164177
// Deploy best practices CW Alarms for Kinesis Stream

0 commit comments

Comments
 (0)