Registering Targets

Learn to register targets with the load balancer.

The next step is to register targets with the target group. This assigns targets (WordPress instances in our case) to the target group so the load balancer can later address them all together.

The elbv2 register-targets command needs the following parameters:

  • --target-group-arn to specify the target group.

  • --targets to specify the targets (our WordPress instances). To specify instances, we can use the Id=<instance id> syntax. Other options instead of Id are ip for an IP address, lambda for an AWS Lambda function (we will not cover those), and alb for another load balancer (an Application Load Balancer to be precise).

We can list multiple targets separated by a space, so it looks like this:

Get hands-on with 1400+ tech skills courses.