Skip to content

Commit 743c874

Browse files
authored
feat(aws-cloudfront-s3): added loggingBucketProps for cloudfront-s3 (#419)
* added loggingBucketProps for cloudfront-s3 * update design guidelines for s3 logging bucket prop * updated description in design guideline for S3
1 parent ed7bdfa commit 743c874

File tree

6 files changed

+590
-88
lines changed

6 files changed

+590
-88
lines changed

DESIGN_GUIDELINES.md

+32-31
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ To make a Construct as flexible as possible, it should perform a single architec
2222

2323
The construct should not create new classes or interfaces to describe services or resources. Although the new class may seem simpler now, as new capabilities are added to the construct the new class will acquire new properties – the ultimate result would be something equivalent to the CDK definition, but not compatible. The CDK definitions are well thought out and interact predictably with other CDK constructs, use them. If you want a client the ability to specify a few attributes of a ConstructProps without specifying every required value, then make the type of that attribute ConstructProps | any. This pattern exists several places in the Solutions Constructs library.
2424

25-
Another practice that this rule prohibits is putting specific attributes of sub resources in your Solutions Constructs Props object. For instance - if your VPC needs an Internet Gateway, then the client should send VPC Props that create the Internet Gateway, don't create a property at in your Construct Props object of InternetGateway: true.
25+
Another practice that this rule prohibits is putting specific attributes of sub resources in your Solutions Constructs Props object. For instance - if your VPC needs an Internet Gateway, then the client should send VPC Props that create the Internet Gateway, don't create a property at in your Construct Props object of InternetGateway: true.
2626

2727
**The client should have the option (but not requirement) to provide any props used within the construct**
2828

@@ -81,15 +81,15 @@ Existing Inconsistencies would not be published, that’s for our internal use
8181

8282

8383
## API Gateway
84-
**Required Attributes on Props**
84+
**Required Attributes on Props**
8585

8686
| Name | Type | Notes |
8787
| --- | --- | --- |
8888
| apiGatewayProps | api.RestApiProps | aws-cloudfront-apigateway is an exception (covered below) ||
8989
| allow*Name*Operation/*name*OperationTemplate | | Required in pairs for integration with DDB and SQS |
9090
| logGroupProps? | logs.LogGroupProps | |
9191

92-
**Required Construct Properties**
92+
**Required Construct Properties**
9393

9494
| Name | Type | Notes |
9595
| --- | --- | --- |
@@ -99,22 +99,22 @@ Existing Inconsistencies would not be published, that’s for our internal use
9999
| apiGatewayRole | iam.Role ||
100100

101101
## CloudFront
102-
**Required Attributes on Props**
102+
**Required Attributes on Props**
103103

104104
| Name | Type | Notes |
105105
| --- | --- | --- |
106106
| cloudFrontDistributionProps? | cloudfront.CloudFront.WebDistributionProps ||
107107
| insertHttpSecurityHeaders? | boolean ||
108108

109-
**Required Construct Properties**
109+
**Required Construct Properties**
110110

111111
| Name | Type | Notes |
112112
| --- | --- | --- |
113113
| cloudFrontLoggingBucket? s3.Bucket ||
114114
| cloudFrontWebDistribution cloudfront.CloudrontWebDistribution ||
115115

116116
## DynamoDB
117-
**Required Attributes on Props**
117+
**Required Attributes on Props**
118118

119119
| Name | Type | Notes |
120120
| --- | --- | --- |
@@ -123,38 +123,38 @@ Existing Inconsistencies would not be published, that’s for our internal use
123123
| tablePermissions? | string | Only where DynamoDB is a data store being accessed by the construct|
124124
| dynamoEventSourceProps? | aws-lambda-event-sources.DynamoEventSourceProps | Only where DynamoDB is invoking other services (dynamodb streams) |
125125

126-
**Required Construct Properties**
126+
**Required Construct Properties**
127127

128128
| Name | Type | Notes |
129129
| --- | --- | --- |
130130
| dynamoTable | dynamodb.Table ||
131131

132132
## ElasticSearch
133-
**Required Attributes on Props**
133+
**Required Attributes on Props**
134134

135135
| Name | Type | Notes |
136136
| --- | --- | --- |
137137
| esDomainProps? | elasticsearch.CfnDomainProps ||
138138
| domainName | string ||
139139

140140

141-
**Required Construct Properties**
141+
**Required Construct Properties**
142142

143143
| Name | Type | Notes |
144144
| --- | --- | --- |
145145
| elasticsearchDomain | elasticsearch.CfnDomain ||
146146
| elasticsearchDomainRole | iam.Role ||
147147

148148
## Eventbridge
149-
**Required Attributes on Props**
149+
**Required Attributes on Props**
150150

151151
| Name | Type | Notes |
152152
| --- | --- | --- |
153153
| eventRuleProps | events.RuleProps ||
154154
| existingEVentBusInterface? | events.IEventBus ||
155155
| eventBusProps? | events.EventBusProps ||
156156

157-
**Required Construct Properties**
157+
**Required Construct Properties**
158158

159159
| Name | Type | Notes |
160160
| --- | --- | --- |
@@ -163,13 +163,13 @@ Existing Inconsistencies would not be published, that’s for our internal use
163163

164164

165165
## Firehose
166-
**Required Attributes on Props**
166+
**Required Attributes on Props**
167167

168168
| Name | Type | Notes |
169169
| --- | --- | --- |
170170
| kinesisFirehoseProps? | aws-kinesisfirehose.CfnDeliveryStreamProps ||
171171

172-
**Required Construct Properties**
172+
**Required Construct Properties**
173173

174174
| Name | Type | Notes |
175175
| --- | --- | --- |
@@ -178,69 +178,70 @@ Existing Inconsistencies would not be published, that’s for our internal use
178178
| kinesisFirehoseLogGroup | logs.LogGroup ||
179179

180180
## IoT
181-
**Required Attributes on Props**
181+
**Required Attributes on Props**
182182

183183
| Name | Type | Notes |
184184
| --- | --- | --- |
185185
| iotEndpoint | string | When IoT is *downstream* (e.g. – aws-apigateway-iot) |
186186
| iotTopicRuleProps | iot.CfnTopicRuleProps | When iot is *upstream* (eg – aws-iot-lambda) |
187187

188-
**Required Construct Properties**
188+
**Required Construct Properties**
189189

190190
| Name | Type | Notes |
191191
| --- | --- | --- |
192192
| iotActionsRole | iam.Role | For upstream IoT|
193193
| iotTopicRule | iot.CfnTopicRule | When iot is upstream |
194194

195195
## Kinesis Streams
196-
**Required Attributes on Props**
196+
**Required Attributes on Props**
197197

198198
| Name | Type | Notes |
199199
| --- | --- | --- |
200200
| existingStreamObj? | kinesis.Stream | |
201201
| kinesisStreamProps? | kinesis.StreamProps ||
202202
|createCloudWatchAlarms|`boolean`| |
203203

204-
**Required Construct Properties**
204+
**Required Construct Properties**
205205

206206
| Name | Type | Notes |
207207
| --- | --- | --- |
208208
| kinesisStream | kinesis.Stream ||
209209
| kinesisStreamRole | iam.Role | Only when Kinesis is upstream (because then the role is important to the construct) |
210210

211211
## Lambda
212-
**Required Attributes on Props**
212+
**Required Attributes on Props**
213213

214214
| Name | Type | Notes |
215215
| --- | --- | --- |
216216
| existingLambdaObj? | lambda.Function ||
217217
| lambdaFunctionProps? | lambda.FunctionProps ||
218218

219-
**Required Construct Properties**
219+
**Required Construct Properties**
220220

221221
| Name | Type | Notes |
222222
| --- | --- | --- |
223223
| lambdaFunction | lambda.Function ||
224224

225225
## S3
226-
**Required Attributes on Props**
226+
**Required Attributes on Props**
227227

228228
| Name | Type | Notes |
229229
| --- | --- | --- |
230230
| existingBucketObj? | s3.Bucket | Either this or bucketProps must be provided |
231231
| bucketProps? | s3.BucketProps | |
232+
| loggingBucketProps? | s3.BucketProps | Creating an S3 Bucket will generate a Logging Bucket which users can provide props to override the default props |
232233
| s3EventTypes? | s3.EventType | Only required when construct responds to S3 events |
233234
| s3EventFilters? | s3.NotificationKeyFilter |Only required when construct responds to S3 events |
234235

235-
**Required Construct Properties**
236+
**Required Construct Properties**
236237

237238
| Name | Type | Notes |
238239
| --- | --- | --- |
239240
| s3Bucket | s3.Bucket ||
240241
| s3LoggingBucket | s3.Bucket ||
241242

242243
## SNS
243-
**Required Attributes on Props**
244+
**Required Attributes on Props**
244245

245246
| Name | Type | Notes |
246247
| --- | --- | --- |
@@ -250,15 +251,15 @@ Existing Inconsistencies would not be published, that’s for our internal use
250251
| encryptionKey? | kms.Key |
251252
| encryptionKeyProps? | kms.KeyProps |
252253

253-
**Required Construct Properties**
254+
**Required Construct Properties**
254255

255256
| Name | Type | Notes |
256257
| --- | --- | --- |
257258
| snsTopic | sns.Topic | |
258259
| encryptionKey | kms.Key | Only required when AWS service is writing to the SNS topic (similar to SQS) |
259260

260261
## SQS
261-
**Required Attributes on Props**
262+
**Required Attributes on Props**
262263

263264
| Name | Type | Notes |
264265
| --- | --- | --- |
@@ -270,7 +271,7 @@ Existing Inconsistencies would not be published, that’s for our internal use
270271
| enableQueuePurging | boolean | This is only on 2 constructs, docs talk about a Lambda function role|
271272
| encryptionKey? | kms.Key | Sending messages from an AWS service to an encrypted queue [requires a Customer Master key](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-key-management.html#compatibility-with-aws-services). Those constructs require these properties. |
272273

273-
**Required Construct Properties**
274+
**Required Construct Properties**
274275

275276
| Name | Type | Notes |
276277
| --- | --- | --- |
@@ -279,14 +280,14 @@ Existing Inconsistencies would not be published, that’s for our internal use
279280
| encryptionKey | kms.Key | Only for service to SQS constructs that require a non-default CMK. |
280281

281282
## Step Functions
282-
**Required Attributes on Props**
283+
**Required Attributes on Props**
283284

284285
| Name | Type | Notes |
285286
| --- | --- | --- |
286287
| stateMachineProps | sfn.StateMachineProps ||
287288
| createCloudWatchAlarms | boolean | |
288289

289-
**Required Construct Properties**
290+
**Required Construct Properties**
290291

291292
| Name | Type | Notes |
292293
| --- | --- | --- |
@@ -295,29 +296,29 @@ Existing Inconsistencies would not be published, that’s for our internal use
295296
| cloudwatchAlarms? | cloudwatch.Alarm[] ||
296297

297298
## VPC
298-
**Required Attributes on Props**
299+
**Required Attributes on Props**
299300

300301
| Name | Type | Notes |
301302
| --- | --- | --- |
302303
| existingVpc? | ec2.IVpc | |
303304
| deployVpc? | boolean| |
304305
| vpcProps? | ec2.VpcProps| |
305306

306-
**Required Construct Properties**
307+
**Required Construct Properties**
307308

308309
| Name | Type | Notes |
309310
| --- | --- | --- |
310311
| vpc? | ec2.IVpc | |
311312

312313
## WAF WebACL
313-
**Required Attributes on Props**
314+
**Required Attributes on Props**
314315

315316
| Name | Type | Notes |
316317
| --- | --- | --- |
317318
| existingWebaclObj? | wafv2.CfnWebACL ||
318319
| webaclProps? | wafv2.CfnWebACLProps ||
319320

320-
**Required Construct Properties**
321+
**Required Construct Properties**
321322

322323
| Name | Type | Notes |
323324
| --- | --- | --- |

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ _Parameters_
5050
| **Name** | **Type** | **Description** |
5151
|:-------------|:----------------|-----------------|
5252
|existingBucketInterface?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3.IBucket.html)|Existing instance of S3 Bucket object or interface. If this is provided, then also providing bucketProps will cause an error. |
53-
|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.|
53+
|bucketProps?|[`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 Bucket.|
5454
|cloudFrontDistributionProps?|[`cloudfront.DistributionProps`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudfront.DistributionProps.html)|Optional user provided props to override the default props for CloudFront Distribution|
5555
|insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
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.|
5657

5758
## Pattern Properties
5859

@@ -76,7 +77,7 @@ Out of the box implementation of the Construct without any override will set the
7677
### Amazon S3 Bucket
7778
* Configure Access logging for S3 Bucket
7879
* Enable server-side encryption for S3 Bucket using AWS managed KMS Key
79-
* Enforce encryption of data in transit
80+
* Enforce encryption of data in transit
8081
* Turn on the versioning for S3 Bucket
8182
* Don't allow public access for S3 Bucket
8283
* Retain the S3 Bucket when deleting the CloudFormation stack

0 commit comments

Comments
 (0)