Skip to content

Commit 76c0aa9

Browse files
authored
feat(aws-iot-kinesisfirehose-s3): added custom loggingBucketProps (#480)
* added custom logging bucket props to kinesisfirehose-s3 * added custom logging bucket props to iot-kinesisfirehose-s3 * added log bucket condition in input validation * Added logS3AccessLogs for enabling/disabling s3 logs * added cfn suppress rule for no logging * fix lint issue * redeploy stack for cfn nag suppress changes * added logS3AccessLogs flag for iot-kinesisfirehose-s3 * added s3BucketInterface to index and README
1 parent 6fab3e5 commit 76c0aa9

File tree

9 files changed

+1070
-10
lines changed

9 files changed

+1070
-10
lines changed

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

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ _Parameters_
6565
|existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Existing instance of S3 Bucket object, providing both this and `bucketProps` will cause an error.|
6666
|bucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.BucketProps.html)|User provided props to override the default props for the S3 Bucket. If this is provided, then also providing bucketProps is an error. |
6767
|logGroupProps?|[`logs.LogGroupProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroupProps.html)|User provided props to override the default props for for the CloudWatchLogs LogGroup.|
68+
|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.|
69+
|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|
6870

6971
## Pattern Properties
7072

@@ -77,6 +79,7 @@ _Parameters_
7779
|iotActionsRole|[`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 IoT Rule|
7880
|kinesisFirehoseRole|[`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 Data Firehose delivery stream|
7981
|kinesisFirehoseLogGroup|[`logs.LogGroup`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroup.html)|Returns an instance of the LogGroup created by the construct for Kinesis Data Firehose delivery stream|
82+
|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|
8083

8184
## Default settings
8285

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

+21-8
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,32 @@ export interface IotToKinesisFirehoseToS3Props {
4343
*
4444
* @default - None
4545
*/
46-
readonly existingBucketObj?: s3.IBucket,
46+
readonly existingBucketObj?: s3.IBucket;
4747
/**
4848
* User provided props to override the default props for the S3 Bucket.
4949
*
5050
* @default - Default props are used
5151
*/
52-
readonly bucketProps?: s3.BucketProps,
52+
readonly bucketProps?: s3.BucketProps;
5353
/**
5454
* User provided props to override the default props for the CloudWatchLogs LogGroup.
5555
*
5656
* @default - Default props are used
5757
*/
58-
readonly logGroupProps?: logs.LogGroupProps
58+
readonly logGroupProps?: logs.LogGroupProps;
59+
/**
60+
* Optional user provided props to override the default props for the S3 Logging Bucket.
61+
*
62+
* @default - Default props are used
63+
*/
64+
readonly loggingBucketProps?: s3.BucketProps;
65+
/**
66+
* Whether to turn on Access Logs for the S3 bucket with the associated storage costs.
67+
* Enabling Access Logging is a best practice.
68+
*
69+
* @default - true
70+
*/
71+
readonly logS3AccessLogs?: boolean;
5972
}
6073

6174
export class IotToKinesisFirehoseToS3 extends Construct {
@@ -66,6 +79,7 @@ export class IotToKinesisFirehoseToS3 extends Construct {
6679
public readonly s3Bucket?: s3.Bucket;
6780
public readonly s3LoggingBucket?: s3.Bucket;
6881
public readonly iotActionsRole: iam.Role;
82+
public readonly s3BucketInterface: s3.IBucket;
6983

7084
/**
7185
* @summary Constructs a new instance of the IotToKinesisFirehoseToS3 class.
@@ -79,18 +93,17 @@ export class IotToKinesisFirehoseToS3 extends Construct {
7993
super(scope, id);
8094
defaults.CheckProps(props);
8195

82-
if (props.existingBucketObj && props.bucketProps) {
83-
throw new Error('Cannot specify both bucket properties and an existing bucket');
84-
}
85-
8696
const firehoseToS3 = new KinesisFirehoseToS3(this, 'KinesisFirehoseToS3', {
8797
kinesisFirehoseProps: props.kinesisFirehoseProps,
8898
existingBucketObj: props.existingBucketObj,
8999
bucketProps: props.bucketProps,
90-
logGroupProps: props.logGroupProps
100+
logGroupProps: props.logGroupProps,
101+
loggingBucketProps: props.loggingBucketProps,
102+
logS3AccessLogs: props.logS3AccessLogs
91103
});
92104
this.kinesisFirehose = firehoseToS3.kinesisFirehose;
93105
this.s3Bucket = firehoseToS3.s3Bucket;
106+
this.s3BucketInterface = firehoseToS3.s3BucketInterface;
94107

95108
// Setup the IAM Role for IoT Actions
96109
this.iotActionsRole = new iam.Role(this, 'IotActionsRole', {

0 commit comments

Comments
 (0)