Try AWS Application Load Balancer

AWS

My name is Sashihara and I am an infrastructure engineer.

Let's try out AWS's Application Load Balancer, which was released last month.
AWS | Elastic Load Balancing | Application Load Balancer

The difference with ELB is the addition of L7 distribution functionality.
It seems to support path-based routing.
Also, with the addition of path-based routing, a group called a target group has been added.

Unfortunately, it does not seem to support domain-level distribution.
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 an ALB on top of them.
Normal access will refer to instance1, and if there is an access via the path "/instance2", instance2 will be accessed.

2016-09-19_15h21_09

 

Creating a Target Group

First, create the target group as explained above

As the name suggests, a target group is a group for specifying targets.
There is a target group in the EC2 dashboard, so proceed to "Create a target group".

2016-09-19_14h31_00

First, create "instance1-tg" for default access.
Since we will only be using HTTP this time, we will leave it as is.

Simply click "Create" and the target group will be created

2016-09-19_14h32_59

If you leave it as it is, the instances in the target group will not be specified, so you will need to register them
2016-09-19_14h35_38

Select instance1 and add it to the registered list
2016-09-19_14h36_34


create a target group in the same way as before to connect to another instance when access is made at "/instance2"

2016-09-19_14h38_18

Register instance2 to the target group

2016-09-19_14h42_35

This completes the creation of the target group

Next, create an ALB

Creating an ALB

When you click Create Load Balancer, you can choose between ALB or ELB

Since we will be using ALB this time, select "Application Load Balancer"
2016-09-19_14h44_45

Set the name to "application-LB" and select "HTTP" as the protocol.
Select the VPC and subnet to use.
2016-09-19_14h46_17

If you proceed further, you will get a warning that "It would be better to use HTTPS," but
since HTTPS is not supported this time, we will ignore it.

Next, we will configure the security group.
In this example, we will select the security group for web access that we prepared in advance.

2016-09-19_14h51_53

Next, register the target group you created earlier.
Set instance1-tg for default access and proceed to the next step.
2016-09-19_14h53_39

Verify the information for instance1 and create an application load balancer

Balancer created!

2016-09-19_14h55_53

However, if you leave it as it is, instance2-tg will not be set up, so you will need to set it up

After selecting the balancer, click Add Rule
2016-09-19_15h00_12

Then, enter "/instance2" as the path pattern, select instance2-tg as the target group, and click "Save."

The setup is now complete

I'll try accessing it for now

If no path is specified, instance1 will be accessed
2016-09-19_15h07_56

If you then specify the path "/instance2", instance2 will be accessed

2016-09-19_15h11_51

It's distributed on a path-based basis

Previously, only L4 distribution was possible, but now LB with L7 distribution has been released.
I think various functions will be added in the future, so it seems like it will be useful in a variety of situations.

If you found this article helpful , please give it a like!
0
Loading...
0 votes, average: 0.00 / 10
1,215
X facebook Hatena Bookmark pocket

The person who wrote this article

About the author