‫(Instructor) So a quick lecture
‫to understand rules as a whole.
‫So rules are set up on your application load balancer
‫and you can have many rules or one rule too,
‫and the last rule is called the default rule
‫and each rule will have a specific target. Okay?
‫Now, the rules are going to be processed in order. Okay?
‫The default rule is going to be the last one to be processed
‫and each rule supports different actions.
‫For example, it can forward to a specific target group,
‫it can redirect to a specific other URL,
‫or it can send a fixed response back.
‫Rules can have conditions in terms of which rule is
‫going to be hit first.
‫So, it could be having a rule on the host header. Okay?
‫This is part of the client request.
‫It could be an HTTP request method to see if the request is
‫a GET or a POST, or a PUT.
‫The path pattern, so where the request is sent to,
‫is it slash my app 1 or slash my app 2.
‫Source IP, so what, where's the request coming from.
‫And a specific HTTP header in general,
‫or the query string parameters as part of the request.
‫So this really allows you to create some complex routing to
‫different target groups based on certain conditions
‫on the originating request.
‫Another thing you should know is that for a single rule,
‫as part of your ALB, you could have
‫multiple target groups as a target.
‫And the idea is that you can specify weights for each
‫target group within a single rule.
‫So the idea behind this is that you want to be able to
‫evolve your backend services, okay,
‫from one target group to another, and to update them.
‫And so you want to have version one in one target group
‫and version two in another target group.
‫And you want to evaluate whether or not
‫version two make sense.
‫This is also called a blue green deployment.
‫So thanks to this weighting,
‫you can control how much traffic goes from your ALB to
‫a specific target group as part of a rule.
‫So let's have a look at an example.
‫So let's say that we have our users,
‫they talked to the ALB and the ALB has been wired to talk to
‫target group one historically. Okay.
‫Which is your blue group,
‫but now you're going to add a target group two,
‫which is a new version of your application.
‫And you will set up weights in your rule.
‫You have a weight of eight, for target group one
‫and a weight of two for target group two.
‫That means that now for a single rule,
‫the ALB will send 80% of the traffic to your first group and
‫20% of the traffic to the second group,
‫which would allow you to do some monitoring on your target
‫groups and to see whether or not they are receiving the
‫traffic correctly,
‫whether or not the metrics are good, and whether or not your
‫application version is behaving as expected. Okay?
‫So this is a cool new feature as well.
‫So that's it for this lecture.
‫I hope you liked it.
‫And I will see you in the next lecture.