-
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(aws-route53): route53 Alias record support (#1131)
Support creating alias records to Application Load Balancers and CloudFront distributions.
- Loading branch information
1 parent
c5fd907
commit 72f0124
Showing
11 changed files
with
636 additions
and
2 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
78 changes: 78 additions & 0 deletions
78
packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-alias-target.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,78 @@ | ||
{ | ||
"Resources": { | ||
"HostedZoneDB99F866": { | ||
"Type": "AWS::Route53::HostedZone", | ||
"Properties": { | ||
"Name": "test.public." | ||
} | ||
}, | ||
"HostedZoneAlias40D2E006": { | ||
"Type": "AWS::Route53::RecordSet", | ||
"Properties": { | ||
"Name": "_foo.test.public.", | ||
"Type": "A", | ||
"AliasTarget": { | ||
"DNSName": { | ||
"Fn::GetAtt": [ | ||
"MyDistributionCFDistributionDE147309", | ||
"DomainName" | ||
] | ||
}, | ||
"HostedZoneId": "Z2FDTNDATAQYW2" | ||
}, | ||
"HostedZoneId": { | ||
"Ref": "HostedZoneDB99F866" | ||
} | ||
} | ||
}, | ||
"Bucket83908E77": { | ||
"Type": "AWS::S3::Bucket" | ||
}, | ||
"MyDistributionCFDistributionDE147309": { | ||
"Type": "AWS::CloudFront::Distribution", | ||
"Properties": { | ||
"DistributionConfig": { | ||
"CacheBehaviors": [], | ||
"DefaultCacheBehavior": { | ||
"AllowedMethods": [ | ||
"GET", | ||
"HEAD" | ||
], | ||
"CachedMethods": [ | ||
"GET", | ||
"HEAD" | ||
], | ||
"ForwardedValues": { | ||
"Cookies": { | ||
"Forward": "none" | ||
}, | ||
"QueryString": false | ||
}, | ||
"TargetOriginId": "origin1", | ||
"ViewerProtocolPolicy": "redirect-to-https" | ||
}, | ||
"DefaultRootObject": "index.html", | ||
"Enabled": true, | ||
"HttpVersion": "http2", | ||
"IPV6Enabled": true, | ||
"Origins": [ | ||
{ | ||
"DomainName": { | ||
"Fn::GetAtt": [ | ||
"Bucket83908E77", | ||
"DomainName" | ||
] | ||
}, | ||
"Id": "origin1", | ||
"S3OriginConfig": {} | ||
} | ||
], | ||
"PriceClass": "PriceClass_100", | ||
"ViewerCertificate": { | ||
"CloudFrontDefaultCertificate": true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
packages/@aws-cdk/aws-cloudfront/test/integ.cloudfront-alias-target.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,30 @@ | ||
import route53 = require('@aws-cdk/aws-route53'); | ||
import s3 = require('@aws-cdk/aws-s3'); | ||
import cdk = require('@aws-cdk/cdk'); | ||
import cloudfront = require('../lib'); | ||
|
||
const app = new cdk.App(); | ||
|
||
const stack = new cdk.Stack(app, 'aws-cdk-cloudfront'); | ||
|
||
const zone = new route53.PublicHostedZone(stack, 'HostedZone', { zoneName: 'test.public' }); | ||
|
||
const sourceBucket = new s3.Bucket(stack, 'Bucket'); | ||
|
||
const distribution = new cloudfront.CloudFrontWebDistribution(stack, 'MyDistribution', { | ||
originConfigs: [ | ||
{ | ||
s3OriginSource: { | ||
s3BucketSource: sourceBucket | ||
}, | ||
behaviors : [ {isDefaultBehavior: true}] | ||
} | ||
] | ||
}); | ||
|
||
new route53.AliasRecord(zone, 'Alias', { | ||
recordName: '_foo', | ||
target: distribution | ||
}); | ||
|
||
app.run(); |
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
Oops, something went wrong.