Skip to content

Commit

Permalink
feat(cloudfront): add origin group selection criteria to L2 Distribut…
Browse files Browse the repository at this point in the history
…ion and L2 OriginGroup (#32740)

### Issue # (if applicable)

Closes #<issue number here>.

### Reason for this change

add origin selection criteria to L2 Distribution & L2 OriginGroup
add unit + integration tests

### Description of changes

Add Selection Criteria to Distribution L2 construct. CFN docs can be found here: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-origingroup.html#cfn-cloudfront-distribution-origingroup-selectioncriteria


### Description of how you validated changes

Added unit + integration tests for this new feature - by default it can be undefined, so shouldn't impact other configurations.

### 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
jamiepmullan authored Jan 28, 2025
1 parent 78bcd09 commit 1b35c4e
Show file tree
Hide file tree
Showing 15 changed files with 803 additions and 3 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"Resources": {
"cg1": {
"Type": "AWS::MediaPackageV2::ChannelGroup",
"Properties": {
"ChannelGroupName": "channelGroup1"
}
},
"cg2": {
"Type": "AWS::MediaPackageV2::ChannelGroup",
"Properties": {
"ChannelGroupName": "channelGroup2"
}
},
"Distribution830FAC52": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"CacheBehaviors": [
{
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"PathPattern": "/video",
"TargetOriginId": "cloudfrontorigingroupselectioncriteriaDistributionOriginGroup1518D308D",
"ViewerProtocolPolicy": "allow-all"
}
],
"DefaultCacheBehavior": {
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
"Compress": true,
"TargetOriginId": "cloudfrontorigingroupselectioncriteriaDistributionOriginGroup1518D308D",
"ViewerProtocolPolicy": "allow-all"
},
"Enabled": true,
"HttpVersion": "http2",
"IPV6Enabled": true,
"OriginGroups": {
"Items": [
{
"FailoverCriteria": {
"StatusCodes": {
"Items": [
404
],
"Quantity": 1
}
},
"Id": "cloudfrontorigingroupselectioncriteriaDistributionOriginGroup1518D308D",
"Members": {
"Items": [
{
"OriginId": "cloudfrontorigingroupselectioncriteriaDistributionOrigin1AA511FA4"
},
{
"OriginId": "cloudfrontorigingroupselectioncriteriaDistributionOrigin2AFDC8F08"
}
],
"Quantity": 2
},
"SelectionCriteria": "media-quality-based"
}
],
"Quantity": 1
},
"Origins": [
{
"CustomOriginConfig": {
"OriginProtocolPolicy": "https-only",
"OriginSSLProtocols": [
"TLSv1.2"
]
},
"DomainName": {
"Fn::GetAtt": [
"cg1",
"EgressDomain"
]
},
"Id": "cloudfrontorigingroupselectioncriteriaDistributionOrigin1AA511FA4"
},
{
"CustomOriginConfig": {
"OriginProtocolPolicy": "https-only",
"OriginSSLProtocols": [
"TLSv1.2"
]
},
"DomainName": {
"Fn::GetAtt": [
"cg2",
"EgressDomain"
]
},
"Id": "cloudfrontorigingroupselectioncriteriaDistributionOrigin2AFDC8F08"
}
]
}
}
}
},
"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."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1b35c4e

Please sign in to comment.