rayova / cdk-ecs-keycloak

Spin up high availability Keycloak clusters on AWS ECS with Fargate
Apache License 2.0
38 stars 5 forks source link

Custom Domain #386

Open fwhenin opened 2 years ago

fwhenin commented 2 years ago

I'm not sure exactly how to access the ALB in the Cluster to then use it to add an A record to Route53, so i can use something like keycloak.domain.com as my url. any help would be great

jaypea commented 2 years ago

@fwhenin this worked for me:

 const keycloakCluster = new keycloak.KeycloakCluster(this, 'Keycloak', {...));
new route53.ARecord(this, 'AppDNSAlias', {
      recordName: domainName,
      target: route53.RecordTarget.fromAlias(
        new route53Targets.LoadBalancerTarget(
          keycloakCluster.node.tryFindChild(
            'LoadBalancer',
          ) as unknown as elbv2.ApplicationLoadBalancer,
        ),
      ),
      zone: hostedZone,
    });