A target group allows AWS resources to register themselves as targets for requests that the load balancer receives to forward.
For instance, service containers can automatically register to a target group so that they can receive traffic from the network load balancer when they are provisioned.
- input: subnet and name
aws elbv2 create-load-balancer ^ --name mysfits-nlb ^ --scheme internet-facing ^ --type network ^ --subnets REPLACE_ME_PUBLIC_SUBNET_ONE REPLACE_ME_PUBLIC_SUBNET_TWO ^ > %HOME%/environment/nlb-output.json
You get in the ouput:
The VpcId to replace can be found when the load balancer was created. You get back a TargetGroupArn.
aws elbv2 create-target-group ^ --name MythicalMysfits-TargetGroup ^ --port 8080 ^ --protocol TCP ^ --target-type ip ^ --vpc-id REPLACE_ME_VPC_ID ^ --health-check-interval-seconds 10 ^ --health-check-path / ^ --health-check-protocol HTTP ^ --healthy-threshold-count 3 ^ --unhealthy-threshold-count 3 ^ > %HOME%/environment/target-group-output.json