-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cloudfront): add support for TrustedKeyGroups in Distribution an…
…d CloudFrontWebDistribution (#12847) @njlynch Closes #11791 https://media3.giphy.com/media/3o7aCWJavAgtBzLWrS/giphy.gif ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
8 changed files
with
259 additions
and
16 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
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
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
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
57 changes: 57 additions & 0 deletions
57
packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.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,57 @@ | ||
{ | ||
"Resources": { | ||
"MyPublicKey78071F3D": { | ||
"Type": "AWS::CloudFront::PublicKey", | ||
"Properties": { | ||
"PublicKeyConfig": { | ||
"CallerReference": "c8752fac3fe06fc93f3fbd12d7e0282d8967409e4d", | ||
"EncodedKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAudf8/iNkQgdvjEdm6xYS\nJAyxd/kGTbJfQNg9YhInb7TSm0dGu0yx8yZ3fnpmxuRPqJIlaVr+fT4YRl71gEYa\ndlhHmnVegyPNjP9dNqZ7zwNqMEPOPnS/NOHbJj1KYKpn1f8pPNycQ5MQCntKGnSj\n6fc+nbcC0joDvGz80xuy1W4hLV9oC9c3GT26xfZb2jy9MVtA3cppNuTwqrFi3t6e\n0iGpraxZlT5wewjZLpQkngqYr6s3aucPAZVsGTEYPo4nD5mswmtZOm+tgcOrivtD\n/3sD/qZLQ6c5siqyS8aTraD6y+VXugujfarTU65IeZ6QAUbLMsWuZOIi5Jn8zAwx\nNQIDAQAB\n-----END PUBLIC KEY-----", | ||
"Name": "integdistributionkeygroupMyPublicKeyC0F3B115" | ||
} | ||
} | ||
}, | ||
"MyKeyGroupAF22FD35": { | ||
"Type": "AWS::CloudFront::KeyGroup", | ||
"Properties": { | ||
"KeyGroupConfig": { | ||
"Items": [ | ||
{ | ||
"Ref": "MyPublicKey78071F3D" | ||
} | ||
], | ||
"Name": "integdistributionkeygroupMyKeyGroupF179E01A" | ||
} | ||
} | ||
}, | ||
"DistB3B78991": { | ||
"Type": "AWS::CloudFront::Distribution", | ||
"Properties": { | ||
"DistributionConfig": { | ||
"DefaultCacheBehavior": { | ||
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6", | ||
"Compress": true, | ||
"TargetOriginId": "integdistributionkeygroupDistOrigin1B9677703", | ||
"TrustedKeyGroups": [ | ||
{ | ||
"Ref": "MyKeyGroupAF22FD35" | ||
} | ||
], | ||
"ViewerProtocolPolicy": "allow-all" | ||
}, | ||
"Enabled": true, | ||
"HttpVersion": "http2", | ||
"IPV6Enabled": true, | ||
"Origins": [ | ||
{ | ||
"CustomOriginConfig": { | ||
"OriginProtocolPolicy": "https-only" | ||
}, | ||
"DomainName": "www.example.com", | ||
"Id": "integdistributionkeygroupDistOrigin1B9677703" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
packages/@aws-cdk/aws-cloudfront/test/integ.distribution-key-group.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,32 @@ | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as cloudfront from '../lib'; | ||
import { TestOrigin } from './test-origin'; | ||
|
||
const app = new cdk.App(); | ||
const stack = new cdk.Stack(app, 'integ-distribution-key-group'); | ||
const publicKey = `-----BEGIN PUBLIC KEY----- | ||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAudf8/iNkQgdvjEdm6xYS | ||
JAyxd/kGTbJfQNg9YhInb7TSm0dGu0yx8yZ3fnpmxuRPqJIlaVr+fT4YRl71gEYa | ||
dlhHmnVegyPNjP9dNqZ7zwNqMEPOPnS/NOHbJj1KYKpn1f8pPNycQ5MQCntKGnSj | ||
6fc+nbcC0joDvGz80xuy1W4hLV9oC9c3GT26xfZb2jy9MVtA3cppNuTwqrFi3t6e | ||
0iGpraxZlT5wewjZLpQkngqYr6s3aucPAZVsGTEYPo4nD5mswmtZOm+tgcOrivtD | ||
/3sD/qZLQ6c5siqyS8aTraD6y+VXugujfarTU65IeZ6QAUbLMsWuZOIi5Jn8zAwx | ||
NQIDAQAB | ||
-----END PUBLIC KEY-----`; | ||
|
||
new cloudfront.Distribution(stack, 'Dist', { | ||
defaultBehavior: { | ||
origin: new TestOrigin('www.example.com'), | ||
trustedKeyGroups: [ | ||
new cloudfront.KeyGroup(stack, 'MyKeyGroup', { | ||
items: [ | ||
new cloudfront.PublicKey(stack, 'MyPublicKey', { | ||
encodedKey: publicKey, | ||
}), | ||
], | ||
}), | ||
], | ||
}, | ||
}); | ||
|
||
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
Oops, something went wrong.