-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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): customize origin access identity in s3origin
Adds support for passing in a identity as it is possible in the CloudFrontWebDistribution closes #9859
- Loading branch information
Showing
4 changed files
with
105 additions
and
3 deletions.
There are no files selected for viewing
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
58 changes: 58 additions & 0 deletions
58
packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.expected.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,58 @@ | ||
{ | ||
"Resources": { | ||
"Bucket83908E77": { | ||
"Type": "AWS::S3::Bucket", | ||
"UpdateReplacePolicy": "Retain", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"OriginAccessIdentityDF1E3CAC": { | ||
"Type": "AWS::CloudFront::CloudFrontOriginAccessIdentity", | ||
"Properties": { | ||
"CloudFrontOriginAccessIdentityConfig": { | ||
"Comment": "Identity for bucket provided by test" | ||
} | ||
} | ||
}, | ||
"Distribution830FAC52": { | ||
"Type": "AWS::CloudFront::Distribution", | ||
"Properties": { | ||
"DistributionConfig": { | ||
"DefaultCacheBehavior": { | ||
"ForwardedValues": { | ||
"QueryString": false | ||
}, | ||
"TargetOriginId": "cloudfronts3originDistributionOrigin1741C4E95", | ||
"ViewerProtocolPolicy": "allow-all" | ||
}, | ||
"Enabled": true, | ||
"HttpVersion": "http2", | ||
"IPV6Enabled": true, | ||
"Origins": [ | ||
{ | ||
"DomainName": { | ||
"Fn::GetAtt": [ | ||
"Bucket83908E77", | ||
"RegionalDomainName" | ||
] | ||
}, | ||
"Id": "cloudfronts3originDistributionOrigin1741C4E95", | ||
"S3OriginConfig": { | ||
"OriginAccessIdentity": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"origin-access-identity/cloudfront/", | ||
{ | ||
"Ref": "OriginAccessIdentityDF1E3CAC" | ||
} | ||
] | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/@aws-cdk/aws-cloudfront-origins/test/integ.s3-origin-oai.ts
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,18 @@ | ||
import * as cloudfront from '@aws-cdk/aws-cloudfront'; | ||
import * as s3 from '@aws-cdk/aws-s3'; | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as origins from '../lib'; | ||
|
||
const app = new cdk.App(); | ||
|
||
const stack = new cdk.Stack(app, 'cloudfront-s3-origin'); | ||
|
||
const bucket = new s3.Bucket(stack, 'Bucket'); | ||
const originAccessIdentity = new cloudfront.OriginAccessIdentity(stack, 'OriginAccessIdentity', { | ||
comment: 'Identity for bucket provided by test', | ||
}); | ||
new cloudfront.Distribution(stack, 'Distribution', { | ||
defaultBehavior: { origin: new origins.S3Origin(bucket, { originAccessIdentity }) }, | ||
}); | ||
|
||
app.synth(); |
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