aws-solutions-constructs.aws-cloudfront-oai-s3 2.79.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (16) hide show
  1. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/LICENSE +73 -0
  2. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/MANIFEST.in +1 -0
  3. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/PKG-INFO +147 -0
  4. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/README.md +119 -0
  5. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/pyproject.toml +9 -0
  6. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/setup.cfg +4 -0
  7. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/setup.py +65 -0
  8. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/src/aws_solutions_constructs/aws_cloudfront_oai_s3/__init__.py +543 -0
  9. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/src/aws_solutions_constructs/aws_cloudfront_oai_s3/_jsii/__init__.py +47 -0
  10. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/src/aws_solutions_constructs/aws_cloudfront_oai_s3/_jsii/aws-cloudfront-oai-s3@2.79.0.jsii.tgz +0 -0
  11. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/src/aws_solutions_constructs/aws_cloudfront_oai_s3/py.typed +1 -0
  12. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/src/aws_solutions_constructs.aws_cloudfront_oai_s3.egg-info/PKG-INFO +147 -0
  13. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/src/aws_solutions_constructs.aws_cloudfront_oai_s3.egg-info/SOURCES.txt +14 -0
  14. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/src/aws_solutions_constructs.aws_cloudfront_oai_s3.egg-info/dependency_links.txt +1 -0
  15. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/src/aws_solutions_constructs.aws_cloudfront_oai_s3.egg-info/requires.txt +7 -0
  16. aws_solutions_constructs_aws_cloudfront_oai_s3-2.79.0/src/aws_solutions_constructs.aws_cloudfront_oai_s3.egg-info/top_level.txt +1 -0
@@ -0,0 +1,73 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+
37
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+
39
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
40
+
41
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
42
+
43
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
56
+
57
+ APPENDIX: How to apply the Apache License to your work.
58
+
59
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
60
+
61
+ Copyright [yyyy] [name of copyright owner]
62
+
63
+ Licensed under the Apache License, Version 2.0 (the "License");
64
+ you may not use this file except in compliance with the License.
65
+ You may obtain a copy of the License at
66
+
67
+ http://www.apache.org/licenses/LICENSE-2.0
68
+
69
+ Unless required by applicable law or agreed to in writing, software
70
+ distributed under the License is distributed on an "AS IS" BASIS,
71
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
72
+ See the License for the specific language governing permissions and
73
+ limitations under the License.
@@ -0,0 +1 @@
1
+ include pyproject.toml
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-cloudfront-oai-s3
3
+ Version: 2.79.0
4
+ Summary: CDK Constructs for AWS Cloudfront to AWS S3 integration.
5
+ Home-page: https://github.com/awslabs/aws-solutions-constructs.git
6
+ Author: Amazon Web Services
7
+ License: Apache-2.0
8
+ Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: JavaScript
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Typing :: Typed
17
+ Classifier: License :: OSI Approved
18
+ Requires-Python: ~=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: aws-cdk-lib<3.0.0,>=2.177.0
22
+ Requires-Dist: aws-solutions-constructs.core==2.79.0
23
+ Requires-Dist: aws-solutions-constructs.resources==2.79.0
24
+ Requires-Dist: constructs<11.0.0,>=10.0.0
25
+ Requires-Dist: jsii<2.0.0,>=1.109.0
26
+ Requires-Dist: publication>=0.0.3
27
+ Requires-Dist: typeguard<4.3.0,>=2.13.3
28
+
29
+ # aws-cloudfront-oai-s3 module
30
+
31
+ <!--BEGIN STABILITY BANNER-->---
32
+
33
+
34
+ ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
35
+
36
+ ---
37
+ <!--END STABILITY BANNER-->
38
+
39
+ | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
40
+ |:-------------|:-------------|
41
+
42
+ <div style="height:8px"></div>
43
+
44
+ | **Language** | **Package** |
45
+ |:-------------|-----------------|
46
+ |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_cloudfront_oai_s3`|
47
+ |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-cloudfront-oai-s3`|
48
+ |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.cloudfrontoais3`|
49
+
50
+ ## Overview
51
+
52
+ This AWS Solutions Construct provisions an Amazon CloudFront Distribution that serves objects from an AWS S3 Bucket via an Origin Access Identity (OAI).
53
+
54
+ IMPORTANT: The recommended architecture for this pattern is to use an Origin Access Control, which is available in aws-cloudfront-s3. This construct is provided to support China regions where Origin Access Controls are not available.
55
+
56
+ Here is a minimal deployable pattern definition:
57
+
58
+ Typescript
59
+
60
+ ```python
61
+ import { Construct } from 'constructs';
62
+ import { Stack, StackProps } from 'aws-cdk-lib';
63
+ import { CloudFrontToOaiToS3 } from '@aws-solutions-constructs/aws-cloudfront-oai-s3';
64
+
65
+ new CloudFrontToOaiToS3(this, 'test-cloudfront-oai-s3', {});
66
+ ```
67
+
68
+ Python
69
+
70
+ ```python
71
+ from aws_solutions_constructs.aws_cloudfront_oai_s3 import CloudFrontToOaiToS3
72
+ from aws_cdk import Stack
73
+ from constructs import Construct
74
+
75
+ CloudFrontToOaiToS3(self, 'test-cloudfront-oai-s3')
76
+ ```
77
+
78
+ Java
79
+
80
+ ```java
81
+ import software.constructs.Construct;
82
+
83
+ import software.amazon.awscdk.Stack;
84
+ import software.amazon.awscdk.StackProps;
85
+ import software.amazon.awsconstructs.services.cloudfrontoais3.*;
86
+
87
+ new CloudFrontToOaiToS3(this, "test-cloudfront-oai-s3", new CloudFrontToOaiToS3Props.Builder()
88
+ .build());
89
+ ```
90
+
91
+ ## Pattern Construct Props
92
+
93
+ | **Name** | **Type** | **Description** |
94
+ |:-------------|:----------------|-----------------|
95
+ |cloudFrontDistributionProps?|[`cloudfront.DistributionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.DistributionProps.html)|Optional user provided props to override the default props for CloudFront Distribution|
96
+ |insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
97
+ |responseHeadersPolicyProps? | [`cloudfront.ResponseHeadersPolicyProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.ResponseHeadersPolicyProps.html) | Optional user provided configuration that cloudfront applies to all http responses.|
98
+ |originPath?|`string`|Optional user provided props to provide an[originPath](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront_origins.S3OriginProps.html#originpath) that CloudFront appends to the origin domain name when CloudFront requests content from the origin. The string should start with a `/`, for example: `/production`. Default value is `'/'`|
99
+ |existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.IBucket.html)|Existing instance of S3 content bucket object or interface. If this is provided, then also providing bucketProps will cause an error. |
100
+ |bucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the S3 content bucket. Note - to log S3 access for this bucket to an existing S3 bucket, put the existing log bucket in bucketProps: `serverAccessLogsBucket`|
101
+ |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|
102
+ |loggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the S3 Logging Bucket.|
103
+ |cloudFrontLoggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the CloudFront Logging Bucket. Note: to use an existing bucketto hold CloudFront logs, pass the existing log bucket in |
104
+ |logCloudFrontAccessLog|`boolean`|Optional - Whether to maintain access logs for the CloudFront Logging bucket. Specifying false for this while providing info about the log bucket will cause an error. Default = true |
105
+ |cloudFrontLoggingBucketAccessLogBucketProps|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the CloudFront Log Bucket Access Log bucket. Providing both this and `existingcloudFrontLoggingBucketAccessLogBucket` will cause an error. To provide an existing bucket to accept these logs, pass the existing bucket in `cloudFrontLoggingBucketProps::serverAccessLogBucket`|
106
+
107
+ ## Pattern Properties
108
+
109
+ | **Name** | **Type** | **Description** |
110
+ |:-------------|:----------------|-----------------|
111
+ |cloudFrontWebDistribution|[`cloudfront.Distribution`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.Distribution.html)|Returns an instance of cloudfront.Distribution created by the construct.|
112
+ |cloudFrontFunction?|[`cloudfront.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.Function.html)|Returns an instance of the Cloudfront function created by the construct.|
113
+ |s3BucketInterface|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.IBucket.html)|Returns an instance of s3.IBucket created by the construct.|
114
+ |s3Bucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|Returns an instance of s3.Bucket created by the construct. IMPORTANT: If `existingBucketObj` was provided in Pattern Construct Props, this property will be `undefined`|
115
+ |s3LoggingBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|Returns an instance of s3.Bucket created by the construct as the logging bucket for the primary bucket.|
116
+ |cloudFrontLoggingBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|The S3 bucket created by the construct to hold CloudFront logs. Only populated if the construct creates the bucket (not if an existing bucket is passed in via DistributionProps)|
117
+ |cloudFrontLoggingBucketAccessLogBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|The S3 bucket containing the S3 access logs for the CloudFront log bucket. Only populated if the construct creates the bucket (not if the bucket is passed in via `cloudFrontLoggingBucketProps::serverAccessLogBucket`|
118
+
119
+ ## Default settings
120
+
121
+ Out of the box implementation of the Construct without any override will set the following defaults:
122
+
123
+ ### Amazon CloudFront
124
+
125
+ * Configure Access logging for CloudFront Distribution
126
+ * Enable automatic injection of best practice HTTP security headers in all responses from CloudFront Distribution
127
+ * CloudFront originPath set to `'/'`
128
+ * Create an Origin Access Identity to access S3 bucket
129
+
130
+ ### Amazon S3 Bucket
131
+
132
+ * Configure Access logging for S3 Bucket
133
+ * Enable server-side encryption for S3 Bucket using AWS managed KMS Key
134
+ * Enforce encryption of data in transit
135
+ * Turn on the versioning for S3 Bucket
136
+ * Block public access for S3 Bucket
137
+ * Retain the S3 Bucket when deleting the CloudFormation stack
138
+ * Applies Lifecycle rule to move noncurrent object versions to Glacier storage after 90 days
139
+
140
+ ## Architecture
141
+
142
+ ![Architecture Diagram](architecture.png)
143
+
144
+ ---
145
+
146
+
147
+ © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -0,0 +1,119 @@
1
+ # aws-cloudfront-oai-s3 module
2
+
3
+ <!--BEGIN STABILITY BANNER-->---
4
+
5
+
6
+ ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
7
+
8
+ ---
9
+ <!--END STABILITY BANNER-->
10
+
11
+ | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
12
+ |:-------------|:-------------|
13
+
14
+ <div style="height:8px"></div>
15
+
16
+ | **Language** | **Package** |
17
+ |:-------------|-----------------|
18
+ |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_cloudfront_oai_s3`|
19
+ |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-cloudfront-oai-s3`|
20
+ |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.cloudfrontoais3`|
21
+
22
+ ## Overview
23
+
24
+ This AWS Solutions Construct provisions an Amazon CloudFront Distribution that serves objects from an AWS S3 Bucket via an Origin Access Identity (OAI).
25
+
26
+ IMPORTANT: The recommended architecture for this pattern is to use an Origin Access Control, which is available in aws-cloudfront-s3. This construct is provided to support China regions where Origin Access Controls are not available.
27
+
28
+ Here is a minimal deployable pattern definition:
29
+
30
+ Typescript
31
+
32
+ ```python
33
+ import { Construct } from 'constructs';
34
+ import { Stack, StackProps } from 'aws-cdk-lib';
35
+ import { CloudFrontToOaiToS3 } from '@aws-solutions-constructs/aws-cloudfront-oai-s3';
36
+
37
+ new CloudFrontToOaiToS3(this, 'test-cloudfront-oai-s3', {});
38
+ ```
39
+
40
+ Python
41
+
42
+ ```python
43
+ from aws_solutions_constructs.aws_cloudfront_oai_s3 import CloudFrontToOaiToS3
44
+ from aws_cdk import Stack
45
+ from constructs import Construct
46
+
47
+ CloudFrontToOaiToS3(self, 'test-cloudfront-oai-s3')
48
+ ```
49
+
50
+ Java
51
+
52
+ ```java
53
+ import software.constructs.Construct;
54
+
55
+ import software.amazon.awscdk.Stack;
56
+ import software.amazon.awscdk.StackProps;
57
+ import software.amazon.awsconstructs.services.cloudfrontoais3.*;
58
+
59
+ new CloudFrontToOaiToS3(this, "test-cloudfront-oai-s3", new CloudFrontToOaiToS3Props.Builder()
60
+ .build());
61
+ ```
62
+
63
+ ## Pattern Construct Props
64
+
65
+ | **Name** | **Type** | **Description** |
66
+ |:-------------|:----------------|-----------------|
67
+ |cloudFrontDistributionProps?|[`cloudfront.DistributionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.DistributionProps.html)|Optional user provided props to override the default props for CloudFront Distribution|
68
+ |insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
69
+ |responseHeadersPolicyProps? | [`cloudfront.ResponseHeadersPolicyProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.ResponseHeadersPolicyProps.html) | Optional user provided configuration that cloudfront applies to all http responses.|
70
+ |originPath?|`string`|Optional user provided props to provide an[originPath](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront_origins.S3OriginProps.html#originpath) that CloudFront appends to the origin domain name when CloudFront requests content from the origin. The string should start with a `/`, for example: `/production`. Default value is `'/'`|
71
+ |existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.IBucket.html)|Existing instance of S3 content bucket object or interface. If this is provided, then also providing bucketProps will cause an error. |
72
+ |bucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the S3 content bucket. Note - to log S3 access for this bucket to an existing S3 bucket, put the existing log bucket in bucketProps: `serverAccessLogsBucket`|
73
+ |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|
74
+ |loggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the S3 Logging Bucket.|
75
+ |cloudFrontLoggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the CloudFront Logging Bucket. Note: to use an existing bucketto hold CloudFront logs, pass the existing log bucket in |
76
+ |logCloudFrontAccessLog|`boolean`|Optional - Whether to maintain access logs for the CloudFront Logging bucket. Specifying false for this while providing info about the log bucket will cause an error. Default = true |
77
+ |cloudFrontLoggingBucketAccessLogBucketProps|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the CloudFront Log Bucket Access Log bucket. Providing both this and `existingcloudFrontLoggingBucketAccessLogBucket` will cause an error. To provide an existing bucket to accept these logs, pass the existing bucket in `cloudFrontLoggingBucketProps::serverAccessLogBucket`|
78
+
79
+ ## Pattern Properties
80
+
81
+ | **Name** | **Type** | **Description** |
82
+ |:-------------|:----------------|-----------------|
83
+ |cloudFrontWebDistribution|[`cloudfront.Distribution`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.Distribution.html)|Returns an instance of cloudfront.Distribution created by the construct.|
84
+ |cloudFrontFunction?|[`cloudfront.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.Function.html)|Returns an instance of the Cloudfront function created by the construct.|
85
+ |s3BucketInterface|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.IBucket.html)|Returns an instance of s3.IBucket created by the construct.|
86
+ |s3Bucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|Returns an instance of s3.Bucket created by the construct. IMPORTANT: If `existingBucketObj` was provided in Pattern Construct Props, this property will be `undefined`|
87
+ |s3LoggingBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|Returns an instance of s3.Bucket created by the construct as the logging bucket for the primary bucket.|
88
+ |cloudFrontLoggingBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|The S3 bucket created by the construct to hold CloudFront logs. Only populated if the construct creates the bucket (not if an existing bucket is passed in via DistributionProps)|
89
+ |cloudFrontLoggingBucketAccessLogBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|The S3 bucket containing the S3 access logs for the CloudFront log bucket. Only populated if the construct creates the bucket (not if the bucket is passed in via `cloudFrontLoggingBucketProps::serverAccessLogBucket`|
90
+
91
+ ## Default settings
92
+
93
+ Out of the box implementation of the Construct without any override will set the following defaults:
94
+
95
+ ### Amazon CloudFront
96
+
97
+ * Configure Access logging for CloudFront Distribution
98
+ * Enable automatic injection of best practice HTTP security headers in all responses from CloudFront Distribution
99
+ * CloudFront originPath set to `'/'`
100
+ * Create an Origin Access Identity to access S3 bucket
101
+
102
+ ### Amazon S3 Bucket
103
+
104
+ * Configure Access logging for S3 Bucket
105
+ * Enable server-side encryption for S3 Bucket using AWS managed KMS Key
106
+ * Enforce encryption of data in transit
107
+ * Turn on the versioning for S3 Bucket
108
+ * Block public access for S3 Bucket
109
+ * Retain the S3 Bucket when deleting the CloudFormation stack
110
+ * Applies Lifecycle rule to move noncurrent object versions to Glacier storage after 90 days
111
+
112
+ ## Architecture
113
+
114
+ ![Architecture Diagram](architecture.png)
115
+
116
+ ---
117
+
118
+
119
+ © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -0,0 +1,9 @@
1
+ [build-system]
2
+ requires = ["setuptools~=70.0.0", "wheel~=0.42"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [tool.pyright]
6
+ defineConstant = { DEBUG = true }
7
+ pythonVersion = "3.9"
8
+ pythonPlatform = "All"
9
+ reportSelfClsParameterName = false
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,65 @@
1
+ import json
2
+ import setuptools
3
+
4
+ kwargs = json.loads(
5
+ """
6
+ {
7
+ "name": "aws-solutions-constructs.aws-cloudfront-oai-s3",
8
+ "version": "2.79.0",
9
+ "description": "CDK Constructs for AWS Cloudfront to AWS S3 integration.",
10
+ "license": "Apache-2.0",
11
+ "url": "https://github.com/awslabs/aws-solutions-constructs.git",
12
+ "long_description_content_type": "text/markdown",
13
+ "author": "Amazon Web Services",
14
+ "bdist_wheel": {
15
+ "universal": true
16
+ },
17
+ "project_urls": {
18
+ "Source": "https://github.com/awslabs/aws-solutions-constructs.git"
19
+ },
20
+ "package_dir": {
21
+ "": "src"
22
+ },
23
+ "packages": [
24
+ "aws_solutions_constructs.aws_cloudfront_oai_s3",
25
+ "aws_solutions_constructs.aws_cloudfront_oai_s3._jsii"
26
+ ],
27
+ "package_data": {
28
+ "aws_solutions_constructs.aws_cloudfront_oai_s3._jsii": [
29
+ "aws-cloudfront-oai-s3@2.79.0.jsii.tgz"
30
+ ],
31
+ "aws_solutions_constructs.aws_cloudfront_oai_s3": [
32
+ "py.typed"
33
+ ]
34
+ },
35
+ "python_requires": "~=3.9",
36
+ "install_requires": [
37
+ "aws-cdk-lib>=2.177.0, <3.0.0",
38
+ "aws-solutions-constructs.core==2.79.0",
39
+ "aws-solutions-constructs.resources==2.79.0",
40
+ "constructs>=10.0.0, <11.0.0",
41
+ "jsii>=1.109.0, <2.0.0",
42
+ "publication>=0.0.3",
43
+ "typeguard>=2.13.3,<4.3.0"
44
+ ],
45
+ "classifiers": [
46
+ "Intended Audience :: Developers",
47
+ "Operating System :: OS Independent",
48
+ "Programming Language :: JavaScript",
49
+ "Programming Language :: Python :: 3 :: Only",
50
+ "Programming Language :: Python :: 3.9",
51
+ "Programming Language :: Python :: 3.10",
52
+ "Programming Language :: Python :: 3.11",
53
+ "Typing :: Typed",
54
+ "License :: OSI Approved"
55
+ ],
56
+ "scripts": []
57
+ }
58
+ """
59
+ )
60
+
61
+ with open("README.md", encoding="utf8") as fp:
62
+ kwargs["long_description"] = fp.read()
63
+
64
+
65
+ setuptools.setup(**kwargs)
@@ -0,0 +1,543 @@
1
+ r'''
2
+ # aws-cloudfront-oai-s3 module
3
+
4
+ <!--BEGIN STABILITY BANNER-->---
5
+
6
+
7
+ ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
8
+
9
+ ---
10
+ <!--END STABILITY BANNER-->
11
+
12
+ | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
13
+ |:-------------|:-------------|
14
+
15
+ <div style="height:8px"></div>
16
+
17
+ | **Language** | **Package** |
18
+ |:-------------|-----------------|
19
+ |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_cloudfront_oai_s3`|
20
+ |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-cloudfront-oai-s3`|
21
+ |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.cloudfrontoais3`|
22
+
23
+ ## Overview
24
+
25
+ This AWS Solutions Construct provisions an Amazon CloudFront Distribution that serves objects from an AWS S3 Bucket via an Origin Access Identity (OAI).
26
+
27
+ IMPORTANT: The recommended architecture for this pattern is to use an Origin Access Control, which is available in aws-cloudfront-s3. This construct is provided to support China regions where Origin Access Controls are not available.
28
+
29
+ Here is a minimal deployable pattern definition:
30
+
31
+ Typescript
32
+
33
+ ```python
34
+ import { Construct } from 'constructs';
35
+ import { Stack, StackProps } from 'aws-cdk-lib';
36
+ import { CloudFrontToOaiToS3 } from '@aws-solutions-constructs/aws-cloudfront-oai-s3';
37
+
38
+ new CloudFrontToOaiToS3(this, 'test-cloudfront-oai-s3', {});
39
+ ```
40
+
41
+ Python
42
+
43
+ ```python
44
+ from aws_solutions_constructs.aws_cloudfront_oai_s3 import CloudFrontToOaiToS3
45
+ from aws_cdk import Stack
46
+ from constructs import Construct
47
+
48
+ CloudFrontToOaiToS3(self, 'test-cloudfront-oai-s3')
49
+ ```
50
+
51
+ Java
52
+
53
+ ```java
54
+ import software.constructs.Construct;
55
+
56
+ import software.amazon.awscdk.Stack;
57
+ import software.amazon.awscdk.StackProps;
58
+ import software.amazon.awsconstructs.services.cloudfrontoais3.*;
59
+
60
+ new CloudFrontToOaiToS3(this, "test-cloudfront-oai-s3", new CloudFrontToOaiToS3Props.Builder()
61
+ .build());
62
+ ```
63
+
64
+ ## Pattern Construct Props
65
+
66
+ | **Name** | **Type** | **Description** |
67
+ |:-------------|:----------------|-----------------|
68
+ |cloudFrontDistributionProps?|[`cloudfront.DistributionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.DistributionProps.html)|Optional user provided props to override the default props for CloudFront Distribution|
69
+ |insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
70
+ |responseHeadersPolicyProps? | [`cloudfront.ResponseHeadersPolicyProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.ResponseHeadersPolicyProps.html) | Optional user provided configuration that cloudfront applies to all http responses.|
71
+ |originPath?|`string`|Optional user provided props to provide an[originPath](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront_origins.S3OriginProps.html#originpath) that CloudFront appends to the origin domain name when CloudFront requests content from the origin. The string should start with a `/`, for example: `/production`. Default value is `'/'`|
72
+ |existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.IBucket.html)|Existing instance of S3 content bucket object or interface. If this is provided, then also providing bucketProps will cause an error. |
73
+ |bucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the S3 content bucket. Note - to log S3 access for this bucket to an existing S3 bucket, put the existing log bucket in bucketProps: `serverAccessLogsBucket`|
74
+ |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|
75
+ |loggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the S3 Logging Bucket.|
76
+ |cloudFrontLoggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the CloudFront Logging Bucket. Note: to use an existing bucketto hold CloudFront logs, pass the existing log bucket in |
77
+ |logCloudFrontAccessLog|`boolean`|Optional - Whether to maintain access logs for the CloudFront Logging bucket. Specifying false for this while providing info about the log bucket will cause an error. Default = true |
78
+ |cloudFrontLoggingBucketAccessLogBucketProps|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the CloudFront Log Bucket Access Log bucket. Providing both this and `existingcloudFrontLoggingBucketAccessLogBucket` will cause an error. To provide an existing bucket to accept these logs, pass the existing bucket in `cloudFrontLoggingBucketProps::serverAccessLogBucket`|
79
+
80
+ ## Pattern Properties
81
+
82
+ | **Name** | **Type** | **Description** |
83
+ |:-------------|:----------------|-----------------|
84
+ |cloudFrontWebDistribution|[`cloudfront.Distribution`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.Distribution.html)|Returns an instance of cloudfront.Distribution created by the construct.|
85
+ |cloudFrontFunction?|[`cloudfront.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.Function.html)|Returns an instance of the Cloudfront function created by the construct.|
86
+ |s3BucketInterface|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.IBucket.html)|Returns an instance of s3.IBucket created by the construct.|
87
+ |s3Bucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|Returns an instance of s3.Bucket created by the construct. IMPORTANT: If `existingBucketObj` was provided in Pattern Construct Props, this property will be `undefined`|
88
+ |s3LoggingBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|Returns an instance of s3.Bucket created by the construct as the logging bucket for the primary bucket.|
89
+ |cloudFrontLoggingBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|The S3 bucket created by the construct to hold CloudFront logs. Only populated if the construct creates the bucket (not if an existing bucket is passed in via DistributionProps)|
90
+ |cloudFrontLoggingBucketAccessLogBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|The S3 bucket containing the S3 access logs for the CloudFront log bucket. Only populated if the construct creates the bucket (not if the bucket is passed in via `cloudFrontLoggingBucketProps::serverAccessLogBucket`|
91
+
92
+ ## Default settings
93
+
94
+ Out of the box implementation of the Construct without any override will set the following defaults:
95
+
96
+ ### Amazon CloudFront
97
+
98
+ * Configure Access logging for CloudFront Distribution
99
+ * Enable automatic injection of best practice HTTP security headers in all responses from CloudFront Distribution
100
+ * CloudFront originPath set to `'/'`
101
+ * Create an Origin Access Identity to access S3 bucket
102
+
103
+ ### Amazon S3 Bucket
104
+
105
+ * Configure Access logging for S3 Bucket
106
+ * Enable server-side encryption for S3 Bucket using AWS managed KMS Key
107
+ * Enforce encryption of data in transit
108
+ * Turn on the versioning for S3 Bucket
109
+ * Block public access for S3 Bucket
110
+ * Retain the S3 Bucket when deleting the CloudFormation stack
111
+ * Applies Lifecycle rule to move noncurrent object versions to Glacier storage after 90 days
112
+
113
+ ## Architecture
114
+
115
+ ![Architecture Diagram](architecture.png)
116
+
117
+ ---
118
+
119
+
120
+ © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
121
+ '''
122
+ from pkgutil import extend_path
123
+ __path__ = extend_path(__path__, __name__)
124
+
125
+ import abc
126
+ import builtins
127
+ import datetime
128
+ import enum
129
+ import typing
130
+
131
+ import jsii
132
+ import publication
133
+ import typing_extensions
134
+
135
+ import typeguard
136
+ from importlib.metadata import version as _metadata_package_version
137
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
138
+
139
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
140
+ if TYPEGUARD_MAJOR_VERSION <= 2:
141
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
142
+ else:
143
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
144
+ pass
145
+ else:
146
+ if TYPEGUARD_MAJOR_VERSION == 3:
147
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
148
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
149
+ else:
150
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
151
+
152
+ from ._jsii import *
153
+
154
+ import aws_cdk.aws_cloudfront as _aws_cdk_aws_cloudfront_ceddda9d
155
+ import aws_cdk.aws_s3 as _aws_cdk_aws_s3_ceddda9d
156
+ import constructs as _constructs_77d1e7e8
157
+
158
+
159
+ class CloudFrontToOaiToS3(
160
+ _constructs_77d1e7e8.Construct,
161
+ metaclass=jsii.JSIIMeta,
162
+ jsii_type="@aws-solutions-constructs/aws-cloudfront-oai-s3.CloudFrontToOaiToS3",
163
+ ):
164
+ def __init__(
165
+ self,
166
+ scope: _constructs_77d1e7e8.Construct,
167
+ id: builtins.str,
168
+ *,
169
+ bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
170
+ cloud_front_distribution_props: typing.Any = None,
171
+ cloud_front_logging_bucket_access_log_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
172
+ cloud_front_logging_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
173
+ existing_bucket_obj: typing.Optional[_aws_cdk_aws_s3_ceddda9d.IBucket] = None,
174
+ insert_http_security_headers: typing.Optional[builtins.bool] = None,
175
+ log_cloud_front_access_log: typing.Optional[builtins.bool] = None,
176
+ logging_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
177
+ log_s3_access_logs: typing.Optional[builtins.bool] = None,
178
+ origin_path: typing.Optional[builtins.str] = None,
179
+ response_headers_policy_props: typing.Optional[typing.Union[_aws_cdk_aws_cloudfront_ceddda9d.ResponseHeadersPolicyProps, typing.Dict[builtins.str, typing.Any]]] = None,
180
+ ) -> None:
181
+ '''
182
+ :param scope: - represents the scope for all the resources.
183
+ :param id: - this is a a scope-unique id.
184
+ :param bucket_props: Optional user provided props to override the default props for the S3 Content Bucket. Default: - Default props are used
185
+ :param cloud_front_distribution_props: Optional user provided props to override the default props. Default: - Default props are used
186
+ :param cloud_front_logging_bucket_access_log_bucket_props: Optional user provided props to override the default props for the CloudFront Log Bucket Access Log bucket. Providing both this and ``existingcloudFrontLoggingBucketAccessLogBucket`` will cause an error Default: - Default props are used
187
+ :param cloud_front_logging_bucket_props: Optional user provided props to override the default props for the CloudFront Log Bucket. Default: - Default props are used
188
+ :param existing_bucket_obj: Existing instance of S3 Content Bucket object, providing both this and ``bucketProps`` will cause an error. Default: - None
189
+ :param insert_http_security_headers: Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from cloudfront. Turning this on will inject default headers and is mutually exclusive with passing custom security headers via the responseHeadersPolicyProps parameter. Default: - true
190
+ :param log_cloud_front_access_log: Optional - Whether to maintain access logs for the CloudFront Logging bucket. Specifying false for this while providing info about the log bucket will cause an error. Default: - true
191
+ :param logging_bucket_props: Optional user provided props to override the default props for the S3 Content Bucket Access Log Bucket. Default: - Default props are used
192
+ :param log_s3_access_logs: Optional - Whether to maintain access logs for the S3 Content bucket. Default: - true
193
+ :param origin_path: Optional user provided props to provide an originPath that CloudFront appends to the origin domain name when CloudFront requests content from the origin. The string should start with a ``/``, for example ``/production``. Default: = '/'
194
+ :param response_headers_policy_props: Optional user provided configuration that cloudfront applies to all http responses. Can be used to pass a custom ResponseSecurityHeadersBehavior, ResponseCustomHeadersBehavior or ResponseHeadersCorsBehavior to the cloudfront distribution. Passing a custom ResponseSecurityHeadersBehavior is mutually exclusive with turning on the default security headers via ``insertHttpSecurityHeaders`` prop. Will throw an error if both ``insertHttpSecurityHeaders`` is set to ``true`` and ResponseSecurityHeadersBehavior is passed. Default: - undefined
195
+
196
+ :access: public
197
+ :since: 0.8.0
198
+ :summary: Constructs a new instance of the CloudFrontToOaiToS3 class.
199
+ '''
200
+ if __debug__:
201
+ type_hints = typing.get_type_hints(_typecheckingstub__acf4014159c8246ce40fc3fd5cd3c68fc6f76e43738c271897d9ce8cfe87ddad)
202
+ check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
203
+ check_type(argname="argument id", value=id, expected_type=type_hints["id"])
204
+ props = CloudFrontToOaiToS3Props(
205
+ bucket_props=bucket_props,
206
+ cloud_front_distribution_props=cloud_front_distribution_props,
207
+ cloud_front_logging_bucket_access_log_bucket_props=cloud_front_logging_bucket_access_log_bucket_props,
208
+ cloud_front_logging_bucket_props=cloud_front_logging_bucket_props,
209
+ existing_bucket_obj=existing_bucket_obj,
210
+ insert_http_security_headers=insert_http_security_headers,
211
+ log_cloud_front_access_log=log_cloud_front_access_log,
212
+ logging_bucket_props=logging_bucket_props,
213
+ log_s3_access_logs=log_s3_access_logs,
214
+ origin_path=origin_path,
215
+ response_headers_policy_props=response_headers_policy_props,
216
+ )
217
+
218
+ jsii.create(self.__class__, self, [scope, id, props])
219
+
220
+ @builtins.property
221
+ @jsii.member(jsii_name="cloudFrontWebDistribution")
222
+ def cloud_front_web_distribution(
223
+ self,
224
+ ) -> _aws_cdk_aws_cloudfront_ceddda9d.Distribution:
225
+ return typing.cast(_aws_cdk_aws_cloudfront_ceddda9d.Distribution, jsii.get(self, "cloudFrontWebDistribution"))
226
+
227
+ @builtins.property
228
+ @jsii.member(jsii_name="s3BucketInterface")
229
+ def s3_bucket_interface(self) -> _aws_cdk_aws_s3_ceddda9d.IBucket:
230
+ return typing.cast(_aws_cdk_aws_s3_ceddda9d.IBucket, jsii.get(self, "s3BucketInterface"))
231
+
232
+ @builtins.property
233
+ @jsii.member(jsii_name="cloudFrontFunction")
234
+ def cloud_front_function(
235
+ self,
236
+ ) -> typing.Optional[_aws_cdk_aws_cloudfront_ceddda9d.Function]:
237
+ return typing.cast(typing.Optional[_aws_cdk_aws_cloudfront_ceddda9d.Function], jsii.get(self, "cloudFrontFunction"))
238
+
239
+ @builtins.property
240
+ @jsii.member(jsii_name="cloudFrontLoggingBucket")
241
+ def cloud_front_logging_bucket(
242
+ self,
243
+ ) -> typing.Optional[_aws_cdk_aws_s3_ceddda9d.Bucket]:
244
+ return typing.cast(typing.Optional[_aws_cdk_aws_s3_ceddda9d.Bucket], jsii.get(self, "cloudFrontLoggingBucket"))
245
+
246
+ @builtins.property
247
+ @jsii.member(jsii_name="cloudFrontLoggingBucketAccessLogBucket")
248
+ def cloud_front_logging_bucket_access_log_bucket(
249
+ self,
250
+ ) -> typing.Optional[_aws_cdk_aws_s3_ceddda9d.Bucket]:
251
+ return typing.cast(typing.Optional[_aws_cdk_aws_s3_ceddda9d.Bucket], jsii.get(self, "cloudFrontLoggingBucketAccessLogBucket"))
252
+
253
+ @builtins.property
254
+ @jsii.member(jsii_name="originAccessControl")
255
+ def origin_access_control(
256
+ self,
257
+ ) -> typing.Optional[_aws_cdk_aws_cloudfront_ceddda9d.CfnOriginAccessControl]:
258
+ return typing.cast(typing.Optional[_aws_cdk_aws_cloudfront_ceddda9d.CfnOriginAccessControl], jsii.get(self, "originAccessControl"))
259
+
260
+ @builtins.property
261
+ @jsii.member(jsii_name="s3Bucket")
262
+ def s3_bucket(self) -> typing.Optional[_aws_cdk_aws_s3_ceddda9d.Bucket]:
263
+ return typing.cast(typing.Optional[_aws_cdk_aws_s3_ceddda9d.Bucket], jsii.get(self, "s3Bucket"))
264
+
265
+ @builtins.property
266
+ @jsii.member(jsii_name="s3LoggingBucket")
267
+ def s3_logging_bucket(self) -> typing.Optional[_aws_cdk_aws_s3_ceddda9d.Bucket]:
268
+ return typing.cast(typing.Optional[_aws_cdk_aws_s3_ceddda9d.Bucket], jsii.get(self, "s3LoggingBucket"))
269
+
270
+
271
+ @jsii.data_type(
272
+ jsii_type="@aws-solutions-constructs/aws-cloudfront-oai-s3.CloudFrontToOaiToS3Props",
273
+ jsii_struct_bases=[],
274
+ name_mapping={
275
+ "bucket_props": "bucketProps",
276
+ "cloud_front_distribution_props": "cloudFrontDistributionProps",
277
+ "cloud_front_logging_bucket_access_log_bucket_props": "cloudFrontLoggingBucketAccessLogBucketProps",
278
+ "cloud_front_logging_bucket_props": "cloudFrontLoggingBucketProps",
279
+ "existing_bucket_obj": "existingBucketObj",
280
+ "insert_http_security_headers": "insertHttpSecurityHeaders",
281
+ "log_cloud_front_access_log": "logCloudFrontAccessLog",
282
+ "logging_bucket_props": "loggingBucketProps",
283
+ "log_s3_access_logs": "logS3AccessLogs",
284
+ "origin_path": "originPath",
285
+ "response_headers_policy_props": "responseHeadersPolicyProps",
286
+ },
287
+ )
288
+ class CloudFrontToOaiToS3Props:
289
+ def __init__(
290
+ self,
291
+ *,
292
+ bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
293
+ cloud_front_distribution_props: typing.Any = None,
294
+ cloud_front_logging_bucket_access_log_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
295
+ cloud_front_logging_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
296
+ existing_bucket_obj: typing.Optional[_aws_cdk_aws_s3_ceddda9d.IBucket] = None,
297
+ insert_http_security_headers: typing.Optional[builtins.bool] = None,
298
+ log_cloud_front_access_log: typing.Optional[builtins.bool] = None,
299
+ logging_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
300
+ log_s3_access_logs: typing.Optional[builtins.bool] = None,
301
+ origin_path: typing.Optional[builtins.str] = None,
302
+ response_headers_policy_props: typing.Optional[typing.Union[_aws_cdk_aws_cloudfront_ceddda9d.ResponseHeadersPolicyProps, typing.Dict[builtins.str, typing.Any]]] = None,
303
+ ) -> None:
304
+ '''
305
+ :param bucket_props: Optional user provided props to override the default props for the S3 Content Bucket. Default: - Default props are used
306
+ :param cloud_front_distribution_props: Optional user provided props to override the default props. Default: - Default props are used
307
+ :param cloud_front_logging_bucket_access_log_bucket_props: Optional user provided props to override the default props for the CloudFront Log Bucket Access Log bucket. Providing both this and ``existingcloudFrontLoggingBucketAccessLogBucket`` will cause an error Default: - Default props are used
308
+ :param cloud_front_logging_bucket_props: Optional user provided props to override the default props for the CloudFront Log Bucket. Default: - Default props are used
309
+ :param existing_bucket_obj: Existing instance of S3 Content Bucket object, providing both this and ``bucketProps`` will cause an error. Default: - None
310
+ :param insert_http_security_headers: Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from cloudfront. Turning this on will inject default headers and is mutually exclusive with passing custom security headers via the responseHeadersPolicyProps parameter. Default: - true
311
+ :param log_cloud_front_access_log: Optional - Whether to maintain access logs for the CloudFront Logging bucket. Specifying false for this while providing info about the log bucket will cause an error. Default: - true
312
+ :param logging_bucket_props: Optional user provided props to override the default props for the S3 Content Bucket Access Log Bucket. Default: - Default props are used
313
+ :param log_s3_access_logs: Optional - Whether to maintain access logs for the S3 Content bucket. Default: - true
314
+ :param origin_path: Optional user provided props to provide an originPath that CloudFront appends to the origin domain name when CloudFront requests content from the origin. The string should start with a ``/``, for example ``/production``. Default: = '/'
315
+ :param response_headers_policy_props: Optional user provided configuration that cloudfront applies to all http responses. Can be used to pass a custom ResponseSecurityHeadersBehavior, ResponseCustomHeadersBehavior or ResponseHeadersCorsBehavior to the cloudfront distribution. Passing a custom ResponseSecurityHeadersBehavior is mutually exclusive with turning on the default security headers via ``insertHttpSecurityHeaders`` prop. Will throw an error if both ``insertHttpSecurityHeaders`` is set to ``true`` and ResponseSecurityHeadersBehavior is passed. Default: - undefined
316
+
317
+ :summary: The properties for the CloudFrontToOaiToS3 Construct
318
+ '''
319
+ if isinstance(bucket_props, dict):
320
+ bucket_props = _aws_cdk_aws_s3_ceddda9d.BucketProps(**bucket_props)
321
+ if isinstance(cloud_front_logging_bucket_access_log_bucket_props, dict):
322
+ cloud_front_logging_bucket_access_log_bucket_props = _aws_cdk_aws_s3_ceddda9d.BucketProps(**cloud_front_logging_bucket_access_log_bucket_props)
323
+ if isinstance(cloud_front_logging_bucket_props, dict):
324
+ cloud_front_logging_bucket_props = _aws_cdk_aws_s3_ceddda9d.BucketProps(**cloud_front_logging_bucket_props)
325
+ if isinstance(logging_bucket_props, dict):
326
+ logging_bucket_props = _aws_cdk_aws_s3_ceddda9d.BucketProps(**logging_bucket_props)
327
+ if isinstance(response_headers_policy_props, dict):
328
+ response_headers_policy_props = _aws_cdk_aws_cloudfront_ceddda9d.ResponseHeadersPolicyProps(**response_headers_policy_props)
329
+ if __debug__:
330
+ type_hints = typing.get_type_hints(_typecheckingstub__ce452c1b179e1e9257bbdec8d4bad981cd745aeb81f84cf9e42373b54adcf494)
331
+ check_type(argname="argument bucket_props", value=bucket_props, expected_type=type_hints["bucket_props"])
332
+ check_type(argname="argument cloud_front_distribution_props", value=cloud_front_distribution_props, expected_type=type_hints["cloud_front_distribution_props"])
333
+ check_type(argname="argument cloud_front_logging_bucket_access_log_bucket_props", value=cloud_front_logging_bucket_access_log_bucket_props, expected_type=type_hints["cloud_front_logging_bucket_access_log_bucket_props"])
334
+ check_type(argname="argument cloud_front_logging_bucket_props", value=cloud_front_logging_bucket_props, expected_type=type_hints["cloud_front_logging_bucket_props"])
335
+ check_type(argname="argument existing_bucket_obj", value=existing_bucket_obj, expected_type=type_hints["existing_bucket_obj"])
336
+ check_type(argname="argument insert_http_security_headers", value=insert_http_security_headers, expected_type=type_hints["insert_http_security_headers"])
337
+ check_type(argname="argument log_cloud_front_access_log", value=log_cloud_front_access_log, expected_type=type_hints["log_cloud_front_access_log"])
338
+ check_type(argname="argument logging_bucket_props", value=logging_bucket_props, expected_type=type_hints["logging_bucket_props"])
339
+ check_type(argname="argument log_s3_access_logs", value=log_s3_access_logs, expected_type=type_hints["log_s3_access_logs"])
340
+ check_type(argname="argument origin_path", value=origin_path, expected_type=type_hints["origin_path"])
341
+ check_type(argname="argument response_headers_policy_props", value=response_headers_policy_props, expected_type=type_hints["response_headers_policy_props"])
342
+ self._values: typing.Dict[builtins.str, typing.Any] = {}
343
+ if bucket_props is not None:
344
+ self._values["bucket_props"] = bucket_props
345
+ if cloud_front_distribution_props is not None:
346
+ self._values["cloud_front_distribution_props"] = cloud_front_distribution_props
347
+ if cloud_front_logging_bucket_access_log_bucket_props is not None:
348
+ self._values["cloud_front_logging_bucket_access_log_bucket_props"] = cloud_front_logging_bucket_access_log_bucket_props
349
+ if cloud_front_logging_bucket_props is not None:
350
+ self._values["cloud_front_logging_bucket_props"] = cloud_front_logging_bucket_props
351
+ if existing_bucket_obj is not None:
352
+ self._values["existing_bucket_obj"] = existing_bucket_obj
353
+ if insert_http_security_headers is not None:
354
+ self._values["insert_http_security_headers"] = insert_http_security_headers
355
+ if log_cloud_front_access_log is not None:
356
+ self._values["log_cloud_front_access_log"] = log_cloud_front_access_log
357
+ if logging_bucket_props is not None:
358
+ self._values["logging_bucket_props"] = logging_bucket_props
359
+ if log_s3_access_logs is not None:
360
+ self._values["log_s3_access_logs"] = log_s3_access_logs
361
+ if origin_path is not None:
362
+ self._values["origin_path"] = origin_path
363
+ if response_headers_policy_props is not None:
364
+ self._values["response_headers_policy_props"] = response_headers_policy_props
365
+
366
+ @builtins.property
367
+ def bucket_props(self) -> typing.Optional[_aws_cdk_aws_s3_ceddda9d.BucketProps]:
368
+ '''Optional user provided props to override the default props for the S3 Content Bucket.
369
+
370
+ :default: - Default props are used
371
+ '''
372
+ result = self._values.get("bucket_props")
373
+ return typing.cast(typing.Optional[_aws_cdk_aws_s3_ceddda9d.BucketProps], result)
374
+
375
+ @builtins.property
376
+ def cloud_front_distribution_props(self) -> typing.Any:
377
+ '''Optional user provided props to override the default props.
378
+
379
+ :default: - Default props are used
380
+ '''
381
+ result = self._values.get("cloud_front_distribution_props")
382
+ return typing.cast(typing.Any, result)
383
+
384
+ @builtins.property
385
+ def cloud_front_logging_bucket_access_log_bucket_props(
386
+ self,
387
+ ) -> typing.Optional[_aws_cdk_aws_s3_ceddda9d.BucketProps]:
388
+ '''Optional user provided props to override the default props for the CloudFront Log Bucket Access Log bucket.
389
+
390
+ Providing both this and ``existingcloudFrontLoggingBucketAccessLogBucket`` will cause an error
391
+
392
+ :default: - Default props are used
393
+ '''
394
+ result = self._values.get("cloud_front_logging_bucket_access_log_bucket_props")
395
+ return typing.cast(typing.Optional[_aws_cdk_aws_s3_ceddda9d.BucketProps], result)
396
+
397
+ @builtins.property
398
+ def cloud_front_logging_bucket_props(
399
+ self,
400
+ ) -> typing.Optional[_aws_cdk_aws_s3_ceddda9d.BucketProps]:
401
+ '''Optional user provided props to override the default props for the CloudFront Log Bucket.
402
+
403
+ :default: - Default props are used
404
+ '''
405
+ result = self._values.get("cloud_front_logging_bucket_props")
406
+ return typing.cast(typing.Optional[_aws_cdk_aws_s3_ceddda9d.BucketProps], result)
407
+
408
+ @builtins.property
409
+ def existing_bucket_obj(self) -> typing.Optional[_aws_cdk_aws_s3_ceddda9d.IBucket]:
410
+ '''Existing instance of S3 Content Bucket object, providing both this and ``bucketProps`` will cause an error.
411
+
412
+ :default: - None
413
+ '''
414
+ result = self._values.get("existing_bucket_obj")
415
+ return typing.cast(typing.Optional[_aws_cdk_aws_s3_ceddda9d.IBucket], result)
416
+
417
+ @builtins.property
418
+ def insert_http_security_headers(self) -> typing.Optional[builtins.bool]:
419
+ '''Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from cloudfront.
420
+
421
+ Turning this on will inject default headers and is mutually exclusive with passing custom security headers
422
+ via the responseHeadersPolicyProps parameter.
423
+
424
+ :default: - true
425
+ '''
426
+ result = self._values.get("insert_http_security_headers")
427
+ return typing.cast(typing.Optional[builtins.bool], result)
428
+
429
+ @builtins.property
430
+ def log_cloud_front_access_log(self) -> typing.Optional[builtins.bool]:
431
+ '''Optional - Whether to maintain access logs for the CloudFront Logging bucket.
432
+
433
+ Specifying false for this
434
+ while providing info about the log bucket will cause an error.
435
+
436
+ :default: - true
437
+ '''
438
+ result = self._values.get("log_cloud_front_access_log")
439
+ return typing.cast(typing.Optional[builtins.bool], result)
440
+
441
+ @builtins.property
442
+ def logging_bucket_props(
443
+ self,
444
+ ) -> typing.Optional[_aws_cdk_aws_s3_ceddda9d.BucketProps]:
445
+ '''Optional user provided props to override the default props for the S3 Content Bucket Access Log Bucket.
446
+
447
+ :default: - Default props are used
448
+ '''
449
+ result = self._values.get("logging_bucket_props")
450
+ return typing.cast(typing.Optional[_aws_cdk_aws_s3_ceddda9d.BucketProps], result)
451
+
452
+ @builtins.property
453
+ def log_s3_access_logs(self) -> typing.Optional[builtins.bool]:
454
+ '''Optional - Whether to maintain access logs for the S3 Content bucket.
455
+
456
+ :default: - true
457
+ '''
458
+ result = self._values.get("log_s3_access_logs")
459
+ return typing.cast(typing.Optional[builtins.bool], result)
460
+
461
+ @builtins.property
462
+ def origin_path(self) -> typing.Optional[builtins.str]:
463
+ '''Optional user provided props to provide an originPath that CloudFront appends to the origin domain name when CloudFront requests content from the origin.
464
+
465
+ The string should start with a ``/``, for example ``/production``.
466
+
467
+ :default: = '/'
468
+ '''
469
+ result = self._values.get("origin_path")
470
+ return typing.cast(typing.Optional[builtins.str], result)
471
+
472
+ @builtins.property
473
+ def response_headers_policy_props(
474
+ self,
475
+ ) -> typing.Optional[_aws_cdk_aws_cloudfront_ceddda9d.ResponseHeadersPolicyProps]:
476
+ '''Optional user provided configuration that cloudfront applies to all http responses.
477
+
478
+ Can be used to pass a custom ResponseSecurityHeadersBehavior, ResponseCustomHeadersBehavior or
479
+ ResponseHeadersCorsBehavior to the cloudfront distribution.
480
+
481
+ Passing a custom ResponseSecurityHeadersBehavior is mutually exclusive with turning on the default security headers
482
+ via ``insertHttpSecurityHeaders`` prop. Will throw an error if both ``insertHttpSecurityHeaders`` is set to ``true``
483
+ and ResponseSecurityHeadersBehavior is passed.
484
+
485
+ :default: - undefined
486
+ '''
487
+ result = self._values.get("response_headers_policy_props")
488
+ return typing.cast(typing.Optional[_aws_cdk_aws_cloudfront_ceddda9d.ResponseHeadersPolicyProps], result)
489
+
490
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
491
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
492
+
493
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
494
+ return not (rhs == self)
495
+
496
+ def __repr__(self) -> str:
497
+ return "CloudFrontToOaiToS3Props(%s)" % ", ".join(
498
+ k + "=" + repr(v) for k, v in self._values.items()
499
+ )
500
+
501
+
502
+ __all__ = [
503
+ "CloudFrontToOaiToS3",
504
+ "CloudFrontToOaiToS3Props",
505
+ ]
506
+
507
+ publication.publish()
508
+
509
+ def _typecheckingstub__acf4014159c8246ce40fc3fd5cd3c68fc6f76e43738c271897d9ce8cfe87ddad(
510
+ scope: _constructs_77d1e7e8.Construct,
511
+ id: builtins.str,
512
+ *,
513
+ bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
514
+ cloud_front_distribution_props: typing.Any = None,
515
+ cloud_front_logging_bucket_access_log_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
516
+ cloud_front_logging_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
517
+ existing_bucket_obj: typing.Optional[_aws_cdk_aws_s3_ceddda9d.IBucket] = None,
518
+ insert_http_security_headers: typing.Optional[builtins.bool] = None,
519
+ log_cloud_front_access_log: typing.Optional[builtins.bool] = None,
520
+ logging_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
521
+ log_s3_access_logs: typing.Optional[builtins.bool] = None,
522
+ origin_path: typing.Optional[builtins.str] = None,
523
+ response_headers_policy_props: typing.Optional[typing.Union[_aws_cdk_aws_cloudfront_ceddda9d.ResponseHeadersPolicyProps, typing.Dict[builtins.str, typing.Any]]] = None,
524
+ ) -> None:
525
+ """Type checking stubs"""
526
+ pass
527
+
528
+ def _typecheckingstub__ce452c1b179e1e9257bbdec8d4bad981cd745aeb81f84cf9e42373b54adcf494(
529
+ *,
530
+ bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
531
+ cloud_front_distribution_props: typing.Any = None,
532
+ cloud_front_logging_bucket_access_log_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
533
+ cloud_front_logging_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
534
+ existing_bucket_obj: typing.Optional[_aws_cdk_aws_s3_ceddda9d.IBucket] = None,
535
+ insert_http_security_headers: typing.Optional[builtins.bool] = None,
536
+ log_cloud_front_access_log: typing.Optional[builtins.bool] = None,
537
+ logging_bucket_props: typing.Optional[typing.Union[_aws_cdk_aws_s3_ceddda9d.BucketProps, typing.Dict[builtins.str, typing.Any]]] = None,
538
+ log_s3_access_logs: typing.Optional[builtins.bool] = None,
539
+ origin_path: typing.Optional[builtins.str] = None,
540
+ response_headers_policy_props: typing.Optional[typing.Union[_aws_cdk_aws_cloudfront_ceddda9d.ResponseHeadersPolicyProps, typing.Dict[builtins.str, typing.Any]]] = None,
541
+ ) -> None:
542
+ """Type checking stubs"""
543
+ pass
@@ -0,0 +1,47 @@
1
+ from pkgutil import extend_path
2
+ __path__ = extend_path(__path__, __name__)
3
+
4
+ import abc
5
+ import builtins
6
+ import datetime
7
+ import enum
8
+ import typing
9
+
10
+ import jsii
11
+ import publication
12
+ import typing_extensions
13
+
14
+ import typeguard
15
+ from importlib.metadata import version as _metadata_package_version
16
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
17
+
18
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
19
+ if TYPEGUARD_MAJOR_VERSION <= 2:
20
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
21
+ else:
22
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
23
+ pass
24
+ else:
25
+ if TYPEGUARD_MAJOR_VERSION == 3:
26
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
27
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
28
+ else:
29
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
30
+
31
+ import aws_cdk._jsii
32
+ import aws_solutions_constructs.core._jsii
33
+ import aws_solutions_constructs.resources._jsii
34
+ import constructs._jsii
35
+
36
+ __jsii_assembly__ = jsii.JSIIAssembly.load(
37
+ "@aws-solutions-constructs/aws-cloudfront-oai-s3",
38
+ "2.79.0",
39
+ __name__[0:-6],
40
+ "aws-cloudfront-oai-s3@2.79.0.jsii.tgz",
41
+ )
42
+
43
+ __all__ = [
44
+ "__jsii_assembly__",
45
+ ]
46
+
47
+ publication.publish()
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.1
2
+ Name: aws-solutions-constructs.aws-cloudfront-oai-s3
3
+ Version: 2.79.0
4
+ Summary: CDK Constructs for AWS Cloudfront to AWS S3 integration.
5
+ Home-page: https://github.com/awslabs/aws-solutions-constructs.git
6
+ Author: Amazon Web Services
7
+ License: Apache-2.0
8
+ Project-URL: Source, https://github.com/awslabs/aws-solutions-constructs.git
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: JavaScript
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Typing :: Typed
17
+ Classifier: License :: OSI Approved
18
+ Requires-Python: ~=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: aws-cdk-lib<3.0.0,>=2.177.0
22
+ Requires-Dist: aws-solutions-constructs.core==2.79.0
23
+ Requires-Dist: aws-solutions-constructs.resources==2.79.0
24
+ Requires-Dist: constructs<11.0.0,>=10.0.0
25
+ Requires-Dist: jsii<2.0.0,>=1.109.0
26
+ Requires-Dist: publication>=0.0.3
27
+ Requires-Dist: typeguard<4.3.0,>=2.13.3
28
+
29
+ # aws-cloudfront-oai-s3 module
30
+
31
+ <!--BEGIN STABILITY BANNER-->---
32
+
33
+
34
+ ![Stability: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
35
+
36
+ ---
37
+ <!--END STABILITY BANNER-->
38
+
39
+ | **Reference Documentation**:| <span style="font-weight: normal">https://docs.aws.amazon.com/solutions/latest/constructs/</span>|
40
+ |:-------------|:-------------|
41
+
42
+ <div style="height:8px"></div>
43
+
44
+ | **Language** | **Package** |
45
+ |:-------------|-----------------|
46
+ |![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_cloudfront_oai_s3`|
47
+ |![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-cloudfront-oai-s3`|
48
+ |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.cloudfrontoais3`|
49
+
50
+ ## Overview
51
+
52
+ This AWS Solutions Construct provisions an Amazon CloudFront Distribution that serves objects from an AWS S3 Bucket via an Origin Access Identity (OAI).
53
+
54
+ IMPORTANT: The recommended architecture for this pattern is to use an Origin Access Control, which is available in aws-cloudfront-s3. This construct is provided to support China regions where Origin Access Controls are not available.
55
+
56
+ Here is a minimal deployable pattern definition:
57
+
58
+ Typescript
59
+
60
+ ```python
61
+ import { Construct } from 'constructs';
62
+ import { Stack, StackProps } from 'aws-cdk-lib';
63
+ import { CloudFrontToOaiToS3 } from '@aws-solutions-constructs/aws-cloudfront-oai-s3';
64
+
65
+ new CloudFrontToOaiToS3(this, 'test-cloudfront-oai-s3', {});
66
+ ```
67
+
68
+ Python
69
+
70
+ ```python
71
+ from aws_solutions_constructs.aws_cloudfront_oai_s3 import CloudFrontToOaiToS3
72
+ from aws_cdk import Stack
73
+ from constructs import Construct
74
+
75
+ CloudFrontToOaiToS3(self, 'test-cloudfront-oai-s3')
76
+ ```
77
+
78
+ Java
79
+
80
+ ```java
81
+ import software.constructs.Construct;
82
+
83
+ import software.amazon.awscdk.Stack;
84
+ import software.amazon.awscdk.StackProps;
85
+ import software.amazon.awsconstructs.services.cloudfrontoais3.*;
86
+
87
+ new CloudFrontToOaiToS3(this, "test-cloudfront-oai-s3", new CloudFrontToOaiToS3Props.Builder()
88
+ .build());
89
+ ```
90
+
91
+ ## Pattern Construct Props
92
+
93
+ | **Name** | **Type** | **Description** |
94
+ |:-------------|:----------------|-----------------|
95
+ |cloudFrontDistributionProps?|[`cloudfront.DistributionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.DistributionProps.html)|Optional user provided props to override the default props for CloudFront Distribution|
96
+ |insertHttpSecurityHeaders?|`boolean`|Optional user provided props to turn on/off the automatic injection of best practice HTTP security headers in all responses from CloudFront|
97
+ |responseHeadersPolicyProps? | [`cloudfront.ResponseHeadersPolicyProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.ResponseHeadersPolicyProps.html) | Optional user provided configuration that cloudfront applies to all http responses.|
98
+ |originPath?|`string`|Optional user provided props to provide an[originPath](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront_origins.S3OriginProps.html#originpath) that CloudFront appends to the origin domain name when CloudFront requests content from the origin. The string should start with a `/`, for example: `/production`. Default value is `'/'`|
99
+ |existingBucketObj?|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.IBucket.html)|Existing instance of S3 content bucket object or interface. If this is provided, then also providing bucketProps will cause an error. |
100
+ |bucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the S3 content bucket. Note - to log S3 access for this bucket to an existing S3 bucket, put the existing log bucket in bucketProps: `serverAccessLogsBucket`|
101
+ |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|
102
+ |loggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the S3 Logging Bucket.|
103
+ |cloudFrontLoggingBucketProps?|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the CloudFront Logging Bucket. Note: to use an existing bucketto hold CloudFront logs, pass the existing log bucket in |
104
+ |logCloudFrontAccessLog|`boolean`|Optional - Whether to maintain access logs for the CloudFront Logging bucket. Specifying false for this while providing info about the log bucket will cause an error. Default = true |
105
+ |cloudFrontLoggingBucketAccessLogBucketProps|[`s3.BucketProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.BucketProps.html)|Optional user provided props to override the default props for the CloudFront Log Bucket Access Log bucket. Providing both this and `existingcloudFrontLoggingBucketAccessLogBucket` will cause an error. To provide an existing bucket to accept these logs, pass the existing bucket in `cloudFrontLoggingBucketProps::serverAccessLogBucket`|
106
+
107
+ ## Pattern Properties
108
+
109
+ | **Name** | **Type** | **Description** |
110
+ |:-------------|:----------------|-----------------|
111
+ |cloudFrontWebDistribution|[`cloudfront.Distribution`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.Distribution.html)|Returns an instance of cloudfront.Distribution created by the construct.|
112
+ |cloudFrontFunction?|[`cloudfront.Function`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.Function.html)|Returns an instance of the Cloudfront function created by the construct.|
113
+ |s3BucketInterface|[`s3.IBucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.IBucket.html)|Returns an instance of s3.IBucket created by the construct.|
114
+ |s3Bucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|Returns an instance of s3.Bucket created by the construct. IMPORTANT: If `existingBucketObj` was provided in Pattern Construct Props, this property will be `undefined`|
115
+ |s3LoggingBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|Returns an instance of s3.Bucket created by the construct as the logging bucket for the primary bucket.|
116
+ |cloudFrontLoggingBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|The S3 bucket created by the construct to hold CloudFront logs. Only populated if the construct creates the bucket (not if an existing bucket is passed in via DistributionProps)|
117
+ |cloudFrontLoggingBucketAccessLogBucket?|[`s3.Bucket`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html)|The S3 bucket containing the S3 access logs for the CloudFront log bucket. Only populated if the construct creates the bucket (not if the bucket is passed in via `cloudFrontLoggingBucketProps::serverAccessLogBucket`|
118
+
119
+ ## Default settings
120
+
121
+ Out of the box implementation of the Construct without any override will set the following defaults:
122
+
123
+ ### Amazon CloudFront
124
+
125
+ * Configure Access logging for CloudFront Distribution
126
+ * Enable automatic injection of best practice HTTP security headers in all responses from CloudFront Distribution
127
+ * CloudFront originPath set to `'/'`
128
+ * Create an Origin Access Identity to access S3 bucket
129
+
130
+ ### Amazon S3 Bucket
131
+
132
+ * Configure Access logging for S3 Bucket
133
+ * Enable server-side encryption for S3 Bucket using AWS managed KMS Key
134
+ * Enforce encryption of data in transit
135
+ * Turn on the versioning for S3 Bucket
136
+ * Block public access for S3 Bucket
137
+ * Retain the S3 Bucket when deleting the CloudFormation stack
138
+ * Applies Lifecycle rule to move noncurrent object versions to Glacier storage after 90 days
139
+
140
+ ## Architecture
141
+
142
+ ![Architecture Diagram](architecture.png)
143
+
144
+ ---
145
+
146
+
147
+ © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -0,0 +1,14 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ setup.py
6
+ src/aws_solutions_constructs.aws_cloudfront_oai_s3.egg-info/PKG-INFO
7
+ src/aws_solutions_constructs.aws_cloudfront_oai_s3.egg-info/SOURCES.txt
8
+ src/aws_solutions_constructs.aws_cloudfront_oai_s3.egg-info/dependency_links.txt
9
+ src/aws_solutions_constructs.aws_cloudfront_oai_s3.egg-info/requires.txt
10
+ src/aws_solutions_constructs.aws_cloudfront_oai_s3.egg-info/top_level.txt
11
+ src/aws_solutions_constructs/aws_cloudfront_oai_s3/__init__.py
12
+ src/aws_solutions_constructs/aws_cloudfront_oai_s3/py.typed
13
+ src/aws_solutions_constructs/aws_cloudfront_oai_s3/_jsii/__init__.py
14
+ src/aws_solutions_constructs/aws_cloudfront_oai_s3/_jsii/aws-cloudfront-oai-s3@2.79.0.jsii.tgz
@@ -0,0 +1,7 @@
1
+ aws-cdk-lib<3.0.0,>=2.177.0
2
+ aws-solutions-constructs.core==2.79.0
3
+ aws-solutions-constructs.resources==2.79.0
4
+ constructs<11.0.0,>=10.0.0
5
+ jsii<2.0.0,>=1.109.0
6
+ publication>=0.0.3
7
+ typeguard<4.3.0,>=2.13.3