forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cloudfront-origins): read versioned access level (aws#33038)
### Issue # (if applicable) Closes aws#33034 ### Reason for this change This allows creating an S3 bucket origin OriginAccessControl for access of versioned objects via CloudFront. ### Description of changes Added a new `AccessLevel.READ_VERSIONED`, to extend the list of the OAC access levels, which extends the S3 bucket policy to contain `s3:GetObjectVersion`. I followed the existing patterns for the different AccessLevels, to make the change as small as possible. This enables versioned S3 bucket origins to allow the CloudFront distribution to access object versions. ### Describe any new or updated permissions being added n/a ### Description of how you validated changes Added a new unit-test and a new integration test ### 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*
- Loading branch information
1 parent
0edf1ba
commit 49434ef
Showing
13 changed files
with
31,723 additions
and
3 deletions.
There are no files selected for viewing
30,569 changes: 30,569 additions & 0 deletions
30,569
...ot/asset.bfcf4228d6660f50e81f19efdb64c6388dda6796296eb239decdff1dbc2f4981.bundle/index.js
Large diffs are not rendered by default.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...d-versioned.js.snapshot/cloudfront-s3-bucket-origin-oac-read-versioned-access.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
160 changes: 160 additions & 0 deletions
160
...versioned.js.snapshot/cloudfront-s3-bucket-origin-oac-read-versioned-access.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
{ | ||
"Resources": { | ||
"Bucket83908E77": { | ||
"Type": "AWS::S3::Bucket", | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
}, | ||
"BucketPolicyE9A3008A": { | ||
"Type": "AWS::S3::BucketPolicy", | ||
"Properties": { | ||
"Bucket": { | ||
"Ref": "Bucket83908E77" | ||
}, | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": [ | ||
"s3:GetObject", | ||
"s3:GetObjectVersion" | ||
], | ||
"Condition": { | ||
"StringEquals": { | ||
"AWS:SourceArn": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":cloudfront::", | ||
{ | ||
"Ref": "AWS::AccountId" | ||
}, | ||
":distribution/", | ||
{ | ||
"Ref": "Distribution830FAC52" | ||
} | ||
] | ||
] | ||
} | ||
} | ||
}, | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "cloudfront.amazonaws.com" | ||
}, | ||
"Resource": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
{ | ||
"Fn::GetAtt": [ | ||
"Bucket83908E77", | ||
"Arn" | ||
] | ||
}, | ||
"/*" | ||
] | ||
] | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
} | ||
} | ||
}, | ||
"DistributionOrigin1S3OriginAccessControlEB606076": { | ||
"Type": "AWS::CloudFront::OriginAccessControl", | ||
"Properties": { | ||
"OriginAccessControlConfig": { | ||
"Name": "cloudfronts3bucketoriginoacrOrigin1S3OriginAccessControlE3A6B956", | ||
"OriginAccessControlOriginType": "s3", | ||
"SigningBehavior": "always", | ||
"SigningProtocol": "sigv4" | ||
} | ||
} | ||
}, | ||
"Distribution830FAC52": { | ||
"Type": "AWS::CloudFront::Distribution", | ||
"Properties": { | ||
"DistributionConfig": { | ||
"DefaultCacheBehavior": { | ||
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6", | ||
"Compress": true, | ||
"TargetOriginId": "cloudfronts3bucketoriginoacreadversionedaccessDistributionOrigin1920A1FBA", | ||
"ViewerProtocolPolicy": "allow-all" | ||
}, | ||
"Enabled": true, | ||
"HttpVersion": "http2", | ||
"IPV6Enabled": true, | ||
"Origins": [ | ||
{ | ||
"DomainName": { | ||
"Fn::GetAtt": [ | ||
"Bucket83908E77", | ||
"RegionalDomainName" | ||
] | ||
}, | ||
"Id": "cloudfronts3bucketoriginoacreadversionedaccessDistributionOrigin1920A1FBA", | ||
"OriginAccessControlId": { | ||
"Fn::GetAtt": [ | ||
"DistributionOrigin1S3OriginAccessControlEB606076", | ||
"Id" | ||
] | ||
}, | ||
"S3OriginConfig": { | ||
"OriginAccessIdentity": "" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"Outputs": { | ||
"ExportsOutputRefBucket83908E7781C90AC0": { | ||
"Value": { | ||
"Ref": "Bucket83908E77" | ||
}, | ||
"Export": { | ||
"Name": "cloudfront-s3-bucket-origin-oac-read-versioned-access:ExportsOutputRefBucket83908E7781C90AC0" | ||
} | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...est/aws-cloudfront-origins/test/integ.s3-origin-oac-read-versioned.js.snapshot/integ.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
168 changes: 168 additions & 0 deletions
168
.../aws-cloudfront-origins/test/integ.s3-origin-oac-read-versioned.js.snapshot/manifest.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.