Skip to content

Commit 30675f0

Browse files
authored
feat(cloudfront): s3 origin access control L2 construct (#31254)
### Issue # (if applicable) Closes #21771 . ### Reason for this change L2 support for setting up OAC for S3 origins. See [RFC 617](https://github.com/aws/aws-cdk-rfcs/blob/main/text/0617-cloudfront-oac-l2.md) for more details. ### Description of changes - New L2 construct `OriginAccessControl` - Deprecation of `CloudFrontWebDistribution` — replaced by existing `Distribution` construct - Deprecation of `S3Origin` — replaced by new constructs `S3BucketOrigin` and `S3StaticWebsiteOrigin` - README updates ### Description of how you validated changes Added unit tests and integration tests Internal tracking: V1491594161 ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 586cb04 commit 30675f0

File tree

70 files changed

+167295
-34
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+167295
-34
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-bucket-origin-default.js.snapshot/asset.3cef2cdbb46b3821e641ffb8b9af9731af5f7e4a9e857ab633dbcd9023de724d.bundle/index.js

+31,546
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-bucket-origin-default.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-bucket-origin-default.js.snapshot/cloudfront-s3-bucket-origin-default.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"Resources": {
3+
"Bucket83908E77": {
4+
"Type": "AWS::S3::Bucket",
5+
"UpdateReplacePolicy": "Delete",
6+
"DeletionPolicy": "Delete"
7+
},
8+
"Distribution830FAC52": {
9+
"Type": "AWS::CloudFront::Distribution",
10+
"Properties": {
11+
"DistributionConfig": {
12+
"DefaultCacheBehavior": {
13+
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
14+
"Compress": true,
15+
"TargetOriginId": "cloudfronts3bucketorigindefaultDistributionOrigin18071673C",
16+
"ViewerProtocolPolicy": "allow-all"
17+
},
18+
"Enabled": true,
19+
"HttpVersion": "http2",
20+
"IPV6Enabled": true,
21+
"Origins": [
22+
{
23+
"DomainName": {
24+
"Fn::GetAtt": [
25+
"Bucket83908E77",
26+
"RegionalDomainName"
27+
]
28+
},
29+
"Id": "cloudfronts3bucketorigindefaultDistributionOrigin18071673C",
30+
"S3OriginConfig": {
31+
"OriginAccessIdentity": ""
32+
}
33+
}
34+
]
35+
}
36+
}
37+
}
38+
},
39+
"Outputs": {
40+
"ExportsOutputRefDistribution830FAC524DF81588": {
41+
"Value": {
42+
"Ref": "Distribution830FAC52"
43+
},
44+
"Export": {
45+
"Name": "cloudfront-s3-bucket-origin-default:ExportsOutputRefDistribution830FAC524DF81588"
46+
}
47+
}
48+
},
49+
"Parameters": {
50+
"BootstrapVersion": {
51+
"Type": "AWS::SSM::Parameter::Value<String>",
52+
"Default": "/cdk-bootstrap/hnb659fds/version",
53+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
54+
}
55+
},
56+
"Rules": {
57+
"CheckBootstrapVersion": {
58+
"Assertions": [
59+
{
60+
"Assert": {
61+
"Fn::Not": [
62+
{
63+
"Fn::Contains": [
64+
[
65+
"1",
66+
"2",
67+
"3",
68+
"4",
69+
"5"
70+
],
71+
{
72+
"Ref": "BootstrapVersion"
73+
}
74+
]
75+
}
76+
]
77+
},
78+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
79+
}
80+
]
81+
}
82+
}
83+
}

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-bucket-origin-default.js.snapshot/integ.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-bucket-origin-default.js.snapshot/manifest.json

+156
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront-origins/test/integ.s3-bucket-origin-default.js.snapshot/s3originoacDefaultTestDeployAssertD8FD270A.assets.json

+32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)