0
votes

I have a VPC with both private and public Subnets, and an Elasticbeanstalk Environment which runs its instances in the private Subnet. The Elasticbeanstalk Environment also has a Classic Elastic Load Balancer, which needs to be in the public Subnet. Unfortunately, EB keeps putting it with the instances.

I've called the Load Balancer into existence using the elb options on the Environment. The relevant bit of cloudformation looks like:

"accountapienv": {
  "Type": "AWS::ElasticBeanstalk::Environment", 
  "Properties": {
    "Tier": { "Type": "Standard", Name": "WebServer" }
    "OptionSettings": [
      {
        "ResourceName": "AWSEBAutoScalingGroup", 
        "Namespace": "aws:autoscaling:asg", 
        "OptionName": "MinSize", 
        "Value": "2"
      }, 
      {
        "Namespace": "aws:ec2:vpc", 
        "OptionName": "Subnets", 
        "Value": { "Fn::Join": [",", [ {"Ref": "privateuseast1b"}, {"Ref": "privateuseast1c" } ] ] }
      }, 
      {
        "OptionName": "CrossZone", 
        "Namespace": "aws:elb:loadbalancer", 
        "Value": true
      }, 
      {
        "OptionName": "ListenerProtocol", 
        "Namespace": "aws:elb:listener:443", 
        "Value": "HTTPS"
      }, 

If I were to invoke the balancer directly as a "Type": "AWS::ElasticLoadBalancing::LoadBalancer" object, there would be a subnets option, but then I would have a hard time pointing it as an Elastic Beanstalk Environment instance pool.

I am not willing to move my instances.

So how can I get my load balancer into a public Subnet?

1

1 Answers

0
votes

Found it! It's:

{
     "Namespace": "aws:ec2:vpc", 
     "OptionName": "ELBSubnets", 
     "Value": ...
}

Though why AWS treats this as a VPC option I have no idea.