0

I'm trying to modify the default Host Header CNAME attach to the rule when using a shared ALB with ElasticBeanstalk configuration. By using Terraform, here's how my configuration look like:

    {
      namespace = "aws:elasticbeanstalk:environment"
      name      = "LoadBalancerIsShared"
      value     = "true"
    },
    {
      namespace = "aws:elbv2:listener:443"
      name      = "Rules"
      value     = "default"
    },
    {
      namespace = "aws:elbv2:loadbalancer"
      name      = "SharedLoadBalancer"
      value     = data.aws_lb.default.arn
    },
    {
      namespace = "aws:elasticbeanstalk:environment:process:default"
      name      = "DeregistrationDelay"
      value     = "20"
    },
    {
      namespace = "aws:elasticbeanstalk:environment:process:default"
      name      = "HealthCheckInterval"
      value     = "15"
    },
    {
      namespace = "aws:elasticbeanstalk:environment:process:default"
      name      = "HealthCheckTimeout"
      value     = "5"
    },
    {
      namespace = "aws:elasticbeanstalk:environment:process:default"
      name      = "HealthyThresholdCount"
      value     = "3"
    },
    {
      namespace = "aws:elasticbeanstalk:environment:process:default"
      name      = "Port"
      value     = "80"
    },
    {
      namespace = "aws:elasticbeanstalk:environment:process:default"
      name      = "Protocol"
      value     = "HTTP"
    },
    {
      namespace = "aws:elasticbeanstalk:environment:process:default"
      name      = "StickinessEnabled"
      value     = "false"
    },
    {
      namespace = "aws:elasticbeanstalk:environment:process:default"
      name      = "StickinessLBCookieDuration"
      value     = "86400"
    },
    {
      namespace = "aws:elasticbeanstalk:environment:process:default"
      name      = "StickinessType"
      value     = "lb_cookie"
    },
    {
      namespace = "aws:elasticbeanstalk:environment:process:default"
      name      = "UnhealthyThresholdCount"
      value     = "5"
    },
    {
      namespace = "aws:elbv2:listenerrule:myrule"
      name      = "HostHeaders"
      value     = "my.example.com"
    },
    {
      namespace = "aws:elbv2:listenerrule:myrule"
      name      = "Process"
      value     = "default"
    }

Based on this AWS documentation, it should just work, but somehow, the Host Header attached to the Shared ALB always end up using region.elasticbeanstalk.com as follow:

EB Loadbalancer configuration Shared ALB rules

Thanks again for your help!

1 Answers1

0

What you're seeing in your load balancer is the default rule, and that's because you didn't include your custom rule in the ELB's setting.

Try this:

...
    {
      namespace = "aws:elbv2:listener:443"
      name      = "Rules"
      value     = "default,myrule"
    },
...

Let me know if that helps