I was working on a task today to make Grafana available on two different URLs: grafana.okrasolar.com and grafana.harvest.okrasolar.com

On it’s own, that’s not too tricky:

I just needed to add a alias record:

new ARecord(this, 'Alias', {  zone: this.props.hostedZone,  target: route53.RecordTarget.fromAlias(new LoadBalancerTarget(grafanaService.loadBalancer)),  recordName: 'grafana'})

The hard part was setting up SSL certs for both domains.

The ApplicationLoadBalancedFargateService only allows you to supply one certificate.

To get it working with two certificates, I had to do:

This does the trick but it leaves me with one problem: I can’t do HTTP to HTTPS redirection because the ApplicationLoadBalancedFargateService already creates a listener on port 80 and I can’t find a way to access it.

Jeremy Nagel

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store