You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DESIGN_GUIDELINES.md
+32-31
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ To make a Construct as flexible as possible, it should perform a single architec
22
22
23
23
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.
24
24
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.
26
26
27
27
**The client should have the option (but not requirement) to provide any props used within the construct**
28
28
@@ -81,15 +81,15 @@ Existing Inconsistencies would not be published, that’s for our internal use
81
81
82
82
83
83
## API Gateway
84
-
**Required Attributes on Props**
84
+
**Required Attributes on Props**
85
85
86
86
| Name | Type | Notes |
87
87
| --- | --- | --- |
88
88
| apiGatewayProps | api.RestApiProps | aws-cloudfront-apigateway is an exception (covered below) ||
89
89
| allow*Name*Operation/*name*OperationTemplate || Required in pairs for integration with DDB and SQS |
90
90
| logGroupProps? | logs.LogGroupProps ||
91
91
92
-
**Required Construct Properties**
92
+
**Required Construct Properties**
93
93
94
94
| Name | Type | Notes |
95
95
| --- | --- | --- |
@@ -99,22 +99,22 @@ Existing Inconsistencies would not be published, that’s for our internal use
@@ -178,69 +178,70 @@ Existing Inconsistencies would not be published, that’s for our internal use
178
178
| kinesisFirehoseLogGroup | logs.LogGroup ||
179
179
180
180
## IoT
181
-
**Required Attributes on Props**
181
+
**Required Attributes on Props**
182
182
183
183
| Name | Type | Notes |
184
184
| --- | --- | --- |
185
185
| iotEndpoint | string | When IoT is *downstream* (e.g. – aws-apigateway-iot) |
186
186
| iotTopicRuleProps | iot.CfnTopicRuleProps | When iot is *upstream* (eg – aws-iot-lambda) |
187
187
188
-
**Required Construct Properties**
188
+
**Required Construct Properties**
189
189
190
190
| Name | Type | Notes |
191
191
| --- | --- | --- |
192
192
| iotActionsRole | iam.Role | For upstream IoT|
193
193
| iotTopicRule | iot.CfnTopicRule | When iot is upstream |
194
194
195
195
## Kinesis Streams
196
-
**Required Attributes on Props**
196
+
**Required Attributes on Props**
197
197
198
198
| Name | Type | Notes |
199
199
| --- | --- | --- |
200
200
| existingStreamObj? | kinesis.Stream ||
201
201
| kinesisStreamProps? | kinesis.StreamProps ||
202
202
|createCloudWatchAlarms|`boolean`||
203
203
204
-
**Required Construct Properties**
204
+
**Required Construct Properties**
205
205
206
206
| Name | Type | Notes |
207
207
| --- | --- | --- |
208
208
| kinesisStream | kinesis.Stream ||
209
209
| kinesisStreamRole | iam.Role | Only when Kinesis is upstream (because then the role is important to the construct) |
210
210
211
211
## Lambda
212
-
**Required Attributes on Props**
212
+
**Required Attributes on Props**
213
213
214
214
| Name | Type | Notes |
215
215
| --- | --- | --- |
216
216
| existingLambdaObj? | lambda.Function ||
217
217
| lambdaFunctionProps? | lambda.FunctionProps ||
218
218
219
-
**Required Construct Properties**
219
+
**Required Construct Properties**
220
220
221
221
| Name | Type | Notes |
222
222
| --- | --- | --- |
223
223
| lambdaFunction | lambda.Function ||
224
224
225
225
## S3
226
-
**Required Attributes on Props**
226
+
**Required Attributes on Props**
227
227
228
228
| Name | Type | Notes |
229
229
| --- | --- | --- |
230
230
| existingBucketObj? | s3.Bucket | Either this or bucketProps must be provided |
231
231
| 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 |
232
233
| s3EventTypes? | s3.EventType | Only required when construct responds to S3 events |
233
234
| s3EventFilters? | s3.NotificationKeyFilter |Only required when construct responds to S3 events |
234
235
235
-
**Required Construct Properties**
236
+
**Required Construct Properties**
236
237
237
238
| Name | Type | Notes |
238
239
| --- | --- | --- |
239
240
| s3Bucket | s3.Bucket ||
240
241
| s3LoggingBucket | s3.Bucket ||
241
242
242
243
## SNS
243
-
**Required Attributes on Props**
244
+
**Required Attributes on Props**
244
245
245
246
| Name | Type | Notes |
246
247
| --- | --- | --- |
@@ -250,15 +251,15 @@ Existing Inconsistencies would not be published, that’s for our internal use
250
251
| encryptionKey? | kms.Key |
251
252
| encryptionKeyProps? | kms.KeyProps |
252
253
253
-
**Required Construct Properties**
254
+
**Required Construct Properties**
254
255
255
256
| Name | Type | Notes |
256
257
| --- | --- | --- |
257
258
| snsTopic | sns.Topic ||
258
259
| encryptionKey | kms.Key | Only required when AWS service is writing to the SNS topic (similar to SQS) |
259
260
260
261
## SQS
261
-
**Required Attributes on Props**
262
+
**Required Attributes on Props**
262
263
263
264
| Name | Type | Notes |
264
265
| --- | --- | --- |
@@ -270,7 +271,7 @@ Existing Inconsistencies would not be published, that’s for our internal use
270
271
| enableQueuePurging | boolean | This is only on 2 constructs, docs talk about a Lambda function role|
271
272
| 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. |
272
273
273
-
**Required Construct Properties**
274
+
**Required Construct Properties**
274
275
275
276
| Name | Type | Notes |
276
277
| --- | --- | --- |
@@ -279,14 +280,14 @@ Existing Inconsistencies would not be published, that’s for our internal use
279
280
| encryptionKey | kms.Key | Only for service to SQS constructs that require a non-default CMK. |
280
281
281
282
## Step Functions
282
-
**Required Attributes on Props**
283
+
**Required Attributes on Props**
283
284
284
285
| Name | Type | Notes |
285
286
| --- | --- | --- |
286
287
| stateMachineProps | sfn.StateMachineProps ||
287
288
| createCloudWatchAlarms | boolean ||
288
289
289
-
**Required Construct Properties**
290
+
**Required Construct Properties**
290
291
291
292
| Name | Type | Notes |
292
293
| --- | --- | --- |
@@ -295,29 +296,29 @@ Existing Inconsistencies would not be published, that’s for our internal use
|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.|
54
54
|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|
55
55
|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.|
56
57
57
58
## Pattern Properties
58
59
@@ -76,7 +77,7 @@ Out of the box implementation of the Construct without any override will set the
76
77
### Amazon S3 Bucket
77
78
* Configure Access logging for S3 Bucket
78
79
* 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
80
81
* Turn on the versioning for S3 Bucket
81
82
* Don't allow public access for S3 Bucket
82
83
* Retain the S3 Bucket when deleting the CloudFormation stack
0 commit comments