Demo implementation of Azure Load Balancer with Terraform.
Note
Azure Load Balancer of Basic
SKU will be retired in 2025. Use or migrate to Standard
.
Create the variables file:
cp config/local.auto.tfvars .auto.tfvars
Set the required variables:
subscription_id = ""
Create the virtual machines keys:
mkdir .keys && ssh-keygen -f .keys/temp_rsa
Create the resources:
terraform init
terraform apply -auto-approve
Confirm if the virtual machines have been initiated correctly:
Note
The NAT Gateway will be created in parallel with the VMs
cloud-init status
The solution will be deployed two virtual machines running NGINX.
Simply call the LB public IP and port 80
:
curl loadbalancer:80
This will balance the request across the pool
An inbound NAT rule with port 22
will direct the requests exclusively to VM001.
To use it, SSH using the load balance public IP, instead of the VM.
For this project configuration in particular, the options TCP rest and idle timeout and floating IP are enabled.
This project deploys the Application Health extensions for Linux.