Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ecs): add URL output for LB services #4238

Merged
merged 1 commit into from
Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,23 @@ export abstract class ApplicationLoadBalancedServiceBase extends cdk.Construct {
this.listener.addCertificateArns('Arns', [this.certificate.certificateArn]);
}

let domainName = this.loadBalancer.loadBalancerDnsName;
if (typeof props.domainName !== 'undefined') {
if (typeof props.domainZone === 'undefined') {
throw new Error('A Route53 hosted domain zone name is required to configure the specified domain name');
}

new ARecord(this, "DNS", {
const record = new ARecord(this, "DNS", {
zone: props.domainZone,
recordName: props.domainName,
target: AddressRecordTarget.fromAlias(new LoadBalancerTarget(this.loadBalancer)),
});

domainName = record.domainName;
}

new cdk.CfnOutput(this, 'LoadBalancerDNS', { value: this.loadBalancer.loadBalancerDnsName });
new cdk.CfnOutput(this, 'ServiceURL', { value: protocol.toLowerCase() + '://' + domainName });
}

protected getDefaultCluster(scope: cdk.Construct, vpc?: IVpc): Cluster {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,22 @@
]
}
},
"FargateServiceServiceURL47701F45": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"FargateServiceLBB353E155",
"DNSName"
]
}
]
]
}
},
"LoadBalancerDNS": {
"Value": {
"Fn::GetAtt": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,22 @@
"DNSName"
]
}
},
"L3ServiceURL0F065F2D": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"L3LB212FC0E0",
"DNSName"
]
}
]
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,19 @@
"DNSName"
]
}
},
"HttpsServiceServiceURLA7303487": {
"Value": {
"Fn::Join": [
"",
[
"https://",
{
"Ref": "HttpsServiceDNS5E40A908"
}
]
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -960,13 +960,45 @@
]
}
},
"L3ServiceURL0F065F2D": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"L3LB212FC0E0",
"DNSName"
]
}
]
]
}
},
"L3bLoadBalancerDNSED096132": {
"Value": {
"Fn::GetAtt": [
"L3bLBB8FADA4E",
"DNSName"
]
}
},
"L3bServiceURL0EDED888": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"L3bLBB8FADA4E",
"DNSName"
]
}
]
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,22 @@
]
}
},
"L3ServiceURL0F065F2D": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"L3LB212FC0E0",
"DNSName"
]
}
]
]
}
},
"L3bLoadBalancerDNSED096132": {
"Value": {
"Fn::GetAtt": [
Expand All @@ -1616,13 +1632,45 @@
]
}
},
"L3bServiceURL0EDED888": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"L3bLBB8FADA4E",
"DNSName"
]
}
]
]
}
},
"L3cLoadBalancerDNS9409202E": {
"Value": {
"Fn::GetAtt": [
"L3cLB041B1E8C",
"DNSName"
]
}
},
"L3cServiceURL2E1758C7": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"L3cLB041B1E8C",
"DNSName"
]
}
]
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,22 @@
"DNSName"
]
}
},
"L3ServiceURL0F065F2D": {
"Value": {
"Fn::Join": [
"",
[
"http://",
{
"Fn::GetAtt": [
"L3LB212FC0E0",
"DNSName"
]
}
]
]
}
}
}
}