AWS Elastic Load Balancing Operations
External
Internal
Elastic Load Balancing V2 Deployment with CloudFormation
Create a Network Load Balancer with Amazon Console
This network load balancer was created to service ECS FARGATE containers. It must be created before the corresponding FARGATE service is defined.
Go to Amazon EC2 console -> Load Balancers -> Create Load Balancer -> Network Load Balancer.
Basic Configuration
Name. For more details about load balancer names, see:
It should not start with "internal-...".
Example: "playground-nlb"
Scheme. For more details about load balancer scheme, see:
I have used "internet-facing", because this is what I was able to make work. Return here and experiment with "internal", so the service endpoints exposed through load balancer are not publicly available, but only through an API Gateway that will be subsequently configured..
Listeners
For more details about listeners, see:
Use TCP over port 80.
Availability Zones
For more details see:
Specify the VPC in which the targets exist.
Then, specify at least one, possible more availability zones and one subnet per availability zone. All subnets in which target endpoint services run must be specified here.
Elastic IP: Return to Elastic IP.
Security Settings
Refers to TLS configuration, which should be mandatory for public facing load balancers. Return here.
Configure Routing
If this load balancer is created to service ECS FARGATE containers that have not been defined yet, so we don't have enough information to create the corresponding target group. That is fine, at this stage, the relevant target group will be created during the ECS Service creation process. However, the load balancer cannot be created without a target group, so create a temporary one, which may be deleted later, to satisfy the console workflow.
Target Group
More information about target groups:
Target group: New target group
Name: to-be-deleted
Target type: Instance
Protocol: TCP
Port: 55555
If we build this load balancer for an ECS service, we can create the target group in advance, by specifying the name, the protocol (TCP), the port (10001) and the target type "ip".
Health Checks
Protocol: TCP Return here.
Register Targets
Registered Targets
Instances
Do not select anything now.
Next: Review -> Create.
Information
At this point, after the load balancer is created, selecting it in the load balancer tab provides access to ARN, DNS Name, Hosted Zone ID.
The ECS Service
Follow-Up Tasks
After the ECS-backed target group is created, come back and delete the "to-be-deleted" target group.
Test a Network Load Balancer
curl http://playground-nlb-85d74951c7b728b3.elb.us-west-2.amazonaws.com:10001/amazons
Create an Application Load Balancer
TODO.
Register a Target with a Target Group in Command Line
aws elbv2 register-targets --target-group-arn arn:aws:elasticloadbalancing:us-west-2:77777777777:targetgroup/themyscira/4d66315292d681f9 --targets Id=10.7.1.84