createLoadBalancer

Creates an Application Load Balancer, Network Load Balancer, or Gateway Load Balancer.

For more information, see the following:

This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple load balancers with the same settings, each call succeeds.

Samples

// This example creates an Internet facing load balancer and enables the Availability Zones for the
// specified subnets.
val resp = elasticLoadBalancingV2Client.createLoadBalancer {
    name = "my-load-balancer"
    subnets = listOf<String>(
        "subnet-b7d581c0",
        "subnet-8360a9e7"
    )
}
// This example creates an internal load balancer and enables the Availability Zones for the specified
// subnets.
val resp = elasticLoadBalancingV2Client.createLoadBalancer {
    name = "my-internal-load-balancer"
    subnets = listOf<String>(
        "subnet-b7d581c0",
        "subnet-8360a9e7"
    )
    securityGroups = listOf<String>(
    )
    scheme = LoadBalancerSchemeEnum.fromValue("internal")
}