I have the following situation: I have 1 Rails App that has 2 domains, each of these domains has multiple/dynamical subdomains. This app is in AWS using a load-balanced Elastic Beanstalk.
我有以下情况:我有1个Rails应用程序,有2个域,这些域中的每一个都有多个/动态子域。此应用程序在AWS中使用负载平衡的Elastic Beanstalk。
What i need is that those 2 domains that points to my single Rails App to work under SLL in port 443.
我需要的是那些指向我的单个Rails应用程序的2个域在端口443中的SLL下工作。
But since Elastic Beanstalk has only one load balancer, I can only use one single SSL certificate in port 433 :( Using a UCC SLL certificate won't be the solution because i need each domains certificate to be wildcard, so the dynamic subdomains will also work.
但由于Elastic Beanstalk只有一个负载均衡器,我只能在端口433中使用一个SSL证书:(使用UCC SLL证书将不是解决方案,因为我需要每个域证书都是通配符,因此动态子域也将工作。
Any thoughts about how to get multiple Load Balancers playing nicely with an Elastic Beanstalk Environment?
有关如何使多个Load Balancers与Elastic Beanstalk环境良好匹配的任何想法?
Best.
最好。
5 个解决方案
#1
6
It's a tough one with Elastic Beanstalk as they have a cookie cutter way of deploying your app and if it's not in their options then you have either "hack it" or just go with a completely different solution using EC2 or plain cloud servers.
使用Elastic Beanstalk是一个艰难的过程,因为他们有一个cookie切割方式来部署你的应用程序,如果它不在他们的选项中,那么你要么“破解它”,要么只使用EC2或普通的云服务器来完全不同的解决方案。
One thing you can try is creating another ELB with the certificate of the second domain (and subdomains) and point it to your Elastic Beanstalk Instance. If you go to the ELB console you should be able to see the ELB for the first domain. Then, you can create your second domain based on the first domain.
您可以尝试的一件事是使用第二个域(和子域)的证书创建另一个ELB,并将其指向您的Elastic Beanstalk实例。如果你去ELB控制台,你应该能够看到第一个域的ELB。然后,您可以根据第一个域创建第二个域。
Hope it helps.
希望能帮助到你。
#2
22
To add multiple Elastic Load Balancers (ELB) to an Elastic Beanstalk (EB) application, you need to add the additional ELB to the auto scaling group of the EB app.
要将多个Elastic Load Balancers(ELB)添加到Elastic Beanstalk(EB)应用程序,您需要将其他ELB添加到EB应用程序的自动缩放组。
On the command line
The easiest way to achieve this is through the AWS CLI (https://aws.amazon.com/cli/):
实现此目的的最简单方法是通过AWS CLI(https://aws.amazon.com/cli/):
aws autoscaling attach-load-balancers --auto-scaling-group-name <SG_NAME> --load-balancer-names <ELB_NAME>
aws autoscaling attach-load-balancers --auto-scaling-group-name
In the AWS Console
Of course this can be done in the AWS Console, too:
当然,这也可以在AWS控制台中完成:
- Go to EC2 > Auto Scaling > Auto Scaling Groups
- 转到EC2> Auto Scaling> Auto Scaling Groups
- select the group you want to add the elb to
- 选择要添加elb的组
- Select the Details Tab
- 选择详细信息选项卡
- Edit-Button on the top right
- 右上角的编辑按钮
- Use the Autocompletion in the Load Balancers field to add your load balancer
- 使用“负载均衡器”字段中的“自动完成”添加负载均衡器
- Save
- 保存
For your convenience, you can see where you need to click for all of the 5 steps (don't forget to save!)
为方便起见,您可以看到所有5个步骤需要点击的位置(不要忘记保存!)
For me this works also on eb-generated auto scaling groups (Region: eu-central-1).
对我来说,这也适用于eb生成的自动缩放组(Region:eu-central-1)。
This might not have been available at the time of the question, but it is now.
这可能在提出问题时尚未提供,但现在已经存在。
#3
0
I think that the best solution for your problem is to have multiple domains on the same SSL certificate and then assign that certificate to your ELB environment.
我认为,针对您的问题的最佳解决方案是在同一SSL证书上拥有多个域,然后将该证书分配给您的ELB环境。
(you can have wildcards, maybe that wasn't available at the time the question was asked)
(您可以使用通配符,也许在提出问题时无法使用通配符)
You don't need extra load balancers.
您不需要额外的负载平衡器。
#4
0
This worked for me,
这对我有用,
First, create the load balancer
首先,创建负载均衡器
aws elb create-load-balancer --load-balancer-name my-load-balancer --listeners "Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80" "Protocol=HTTPS,LoadBalancerPort=443,InstanceProtocol=HTTP,InstancePort=80,SSLCertificateId=arn-of-certificate" --subnets eb-subnet-of-primary-elb --security-groups sg-of-primary-elb
Then, attach load balancer to primary auto scaling group of EB env
然后,将负载均衡器附加到EB env的主要自动缩放组
aws autoscaling attach-load-balancers --auto-scaling-group-name asg-name-of-primary-asg-in-eb --load-balancer-names my-load-balancer
#5
0
One more thing to be aware of is that EBS created instances need to allow your custom ELB to talk to them.
还有一点需要注意的是,EBS创建的实例需要允许自定义ELB与它们通信。
You need to create INBOUND rule in your EBS auto-created security group (with description SecurityGroup for ElasticBeanstalk environment
) to allow TCP:80 access. I had my custom ELBs in a different security group so I specified that sg-**** ID as the source.
您需要在EBS自动创建的安全组(具有ElasticBeanstalk环境的SecurityGroup说明)中创建INBOUND规则,以允许TCP:80访问。我将自定义ELB放在不同的安全组中,因此我将sg - **** ID指定为源。
#1
6
It's a tough one with Elastic Beanstalk as they have a cookie cutter way of deploying your app and if it's not in their options then you have either "hack it" or just go with a completely different solution using EC2 or plain cloud servers.
使用Elastic Beanstalk是一个艰难的过程,因为他们有一个cookie切割方式来部署你的应用程序,如果它不在他们的选项中,那么你要么“破解它”,要么只使用EC2或普通的云服务器来完全不同的解决方案。
One thing you can try is creating another ELB with the certificate of the second domain (and subdomains) and point it to your Elastic Beanstalk Instance. If you go to the ELB console you should be able to see the ELB for the first domain. Then, you can create your second domain based on the first domain.
您可以尝试的一件事是使用第二个域(和子域)的证书创建另一个ELB,并将其指向您的Elastic Beanstalk实例。如果你去ELB控制台,你应该能够看到第一个域的ELB。然后,您可以根据第一个域创建第二个域。
Hope it helps.
希望能帮助到你。
#2
22
To add multiple Elastic Load Balancers (ELB) to an Elastic Beanstalk (EB) application, you need to add the additional ELB to the auto scaling group of the EB app.
要将多个Elastic Load Balancers(ELB)添加到Elastic Beanstalk(EB)应用程序,您需要将其他ELB添加到EB应用程序的自动缩放组。
On the command line
The easiest way to achieve this is through the AWS CLI (https://aws.amazon.com/cli/):
实现此目的的最简单方法是通过AWS CLI(https://aws.amazon.com/cli/):
aws autoscaling attach-load-balancers --auto-scaling-group-name <SG_NAME> --load-balancer-names <ELB_NAME>
aws autoscaling attach-load-balancers --auto-scaling-group-name
In the AWS Console
Of course this can be done in the AWS Console, too:
当然,这也可以在AWS控制台中完成:
- Go to EC2 > Auto Scaling > Auto Scaling Groups
- 转到EC2> Auto Scaling> Auto Scaling Groups
- select the group you want to add the elb to
- 选择要添加elb的组
- Select the Details Tab
- 选择详细信息选项卡
- Edit-Button on the top right
- 右上角的编辑按钮
- Use the Autocompletion in the Load Balancers field to add your load balancer
- 使用“负载均衡器”字段中的“自动完成”添加负载均衡器
- Save
- 保存
For your convenience, you can see where you need to click for all of the 5 steps (don't forget to save!)
为方便起见,您可以看到所有5个步骤需要点击的位置(不要忘记保存!)
For me this works also on eb-generated auto scaling groups (Region: eu-central-1).
对我来说,这也适用于eb生成的自动缩放组(Region:eu-central-1)。
This might not have been available at the time of the question, but it is now.
这可能在提出问题时尚未提供,但现在已经存在。
#3
0
I think that the best solution for your problem is to have multiple domains on the same SSL certificate and then assign that certificate to your ELB environment.
我认为,针对您的问题的最佳解决方案是在同一SSL证书上拥有多个域,然后将该证书分配给您的ELB环境。
(you can have wildcards, maybe that wasn't available at the time the question was asked)
(您可以使用通配符,也许在提出问题时无法使用通配符)
You don't need extra load balancers.
您不需要额外的负载平衡器。
#4
0
This worked for me,
这对我有用,
First, create the load balancer
首先,创建负载均衡器
aws elb create-load-balancer --load-balancer-name my-load-balancer --listeners "Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80" "Protocol=HTTPS,LoadBalancerPort=443,InstanceProtocol=HTTP,InstancePort=80,SSLCertificateId=arn-of-certificate" --subnets eb-subnet-of-primary-elb --security-groups sg-of-primary-elb
Then, attach load balancer to primary auto scaling group of EB env
然后,将负载均衡器附加到EB env的主要自动缩放组
aws autoscaling attach-load-balancers --auto-scaling-group-name asg-name-of-primary-asg-in-eb --load-balancer-names my-load-balancer
#5
0
One more thing to be aware of is that EBS created instances need to allow your custom ELB to talk to them.
还有一点需要注意的是,EBS创建的实例需要允许自定义ELB与它们通信。
You need to create INBOUND rule in your EBS auto-created security group (with description SecurityGroup for ElasticBeanstalk environment
) to allow TCP:80 access. I had my custom ELBs in a different security group so I specified that sg-**** ID as the source.
您需要在EBS自动创建的安全组(具有ElasticBeanstalk环境的SecurityGroup说明)中创建INBOUND规则,以允许TCP:80访问。我将自定义ELB放在不同的安全组中,因此我将sg - **** ID指定为源。