Try AWS Application Load Balancer
My name is Sashihara and I am an infrastructure engineer.
I'm going to try out the AWS application load balancer that was released last month.
AWS | Elastic Load Balancing | Application Load Balancer
The difference with ELB is that the L7 distribution function has been added.
It seems to support path-based routing.
Also, with the addition of path-based routing, a group called target group has been added.
Unfortunately, it doesn't seem to support distribution at the domain level.
In addition, HTTP/2 is supported and various other features have been added.
Try Application Load Balancer
For now, we will prepare two EC2 instances and place ALB on top.
Refer to instance1 for normal access, and access instance2 when accessed with the path "/instance2".
Creating a target group
First, create the target group I mentioned earlier.
As the name suggests, a target group is a group for specifying targets.
There is a target group on the EC2 dashboard, so proceed to "Create target group".
First, create "instance1-tg" for default access.
This time we will use only HTTP, so basically it will remain as is.
Just press "Create" and the target group will be created.
If this is the case, the instances in the target group are not specified, so register them.
Select instance1 and add it to registered.
create a target group in the same way as before to connect to another instance when there is access at "/instance2"
Register instance2 in the target group.
The creation of the target group is now complete.
Next, create an ALB.
Creating an ALB
When you press Create Load Balancer, you can select ALB or ELB.
Since we will be using ALB this time, select "Application Load Balancer".
Set the name to "application-LB" and select "HTTP" for the protocol.
Select the VPC and subnet to use.
If you proceed to the next step, a warning will appear saying "It is better to use HTTPS", but
this time we will ignore it as it does not support HTTPS.
Next, configure the security group.
This time, select the security group for web access that you prepared in advance.
Next, register the target group you created earlier.
Configure instance1-tg for default access and proceed.
Check the information for instance1 and create an application load balancer.
Balancer created!
However, as it is, instance2-tg is not configured, so you need to configure it.
After selecting your balancer, click Add Rule.
Then, set the path pattern to "/instance2", select instance2-tg as the target group, and click "Save".
The settings are now complete.
I'll try accessing it for now.
If no path is specified, instance1 will be accessed.
If you then specify the path "/instance2", instance2 will be accessed.
It is distributed on a path basis.
Previously, it was only possible to distribute at L4, but now a LB that can be distributed at L7 has finally been released.
I think that various functions will be added in the future, so it can be used in various situations.