Skip to content

Create Load Balancer

elbv2_create_load_balancer R Documentation

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

Description

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.

Usage

elbv2_create_load_balancer(Name, Subnets, SubnetMappings,
  SecurityGroups, Scheme, Tags, Type, IpAddressType,
  CustomerOwnedIpv4Pool)

Arguments

Name

[required] The name of the load balancer.

This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, must not begin or end with a hyphen, and must not begin with "internal-".

Subnets

The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both. To specify an Elastic IP address, specify subnet mappings instead of subnets.

[Application Load Balancers] You must specify subnets from at least two Availability Zones.

[Application Load Balancers on Outposts] You must specify one Outpost subnet.

[Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.

[Network Load Balancers] You can specify subnets from one or more Availability Zones.

[Gateway Load Balancers] You can specify subnets from one or more Availability Zones.

SubnetMappings

The IDs of the subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings, but not both.

[Application Load Balancers] You must specify subnets from at least two Availability Zones. You cannot specify Elastic IP addresses for your subnets.

[Application Load Balancers on Outposts] You must specify one Outpost subnet.

[Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.

[Network Load Balancers] You can specify subnets from one or more Availability Zones. You can specify one Elastic IP address per subnet if you need static IP addresses for your internet-facing load balancer. For internal load balancers, you can specify one private IP address per subnet from the IPv4 range of the subnet. For internet-facing load balancer, you can specify one IPv6 address per subnet.

[Gateway Load Balancers] You can specify subnets from one or more Availability Zones. You cannot specify Elastic IP addresses for your subnets.

SecurityGroups

[Application Load Balancers and Network Load Balancers] The IDs of the security groups for the load balancer.

Scheme

The nodes of an Internet-facing load balancer have public IP addresses. The DNS name of an Internet-facing load balancer is publicly resolvable to the public IP addresses of the nodes. Therefore, Internet-facing load balancers can route requests from clients over the internet.

The nodes of an internal load balancer have only private IP addresses. The DNS name of an internal load balancer is publicly resolvable to the private IP addresses of the nodes. Therefore, internal load balancers can route requests only from clients with access to the VPC for the load balancer.

The default is an Internet-facing load balancer.

You cannot specify a scheme for a Gateway Load Balancer.

Tags

The tags to assign to the load balancer.

Type

The type of load balancer. The default is application.

IpAddressType

Note: Internal load balancers must use the ipv4 IP address type.

[Application Load Balancers] The IP address type. The possible values are ipv4 (for only IPv4 addresses), dualstack (for IPv4 and IPv6 addresses), and dualstack-without-public-ipv4 (for IPv6 only public addresses, with private IPv4 and IPv6 addresses).

[Network Load Balancers] The IP address type. The possible values are ipv4 (for only IPv4 addresses) and dualstack (for IPv4 and IPv6 addresses). You can’t specify dualstack for a load balancer with a UDP or TCP_UDP listener.

[Gateway Load Balancers] The IP address type. The possible values are ipv4 (for only IPv4 addresses) and dualstack (for IPv4 and IPv6 addresses).

CustomerOwnedIpv4Pool

[Application Load Balancers on Outposts] The ID of the customer-owned address pool (CoIP pool).

Value

A list with the following syntax:

list(
  LoadBalancers = list(
    list(
      LoadBalancerArn = "string",
      DNSName = "string",
      CanonicalHostedZoneId = "string",
      CreatedTime = as.POSIXct(
        "2015-01-01"
      ),
      LoadBalancerName = "string",
      Scheme = "internet-facing"|"internal",
      VpcId = "string",
      State = list(
        Code = "active"|"provisioning"|"active_impaired"|"failed",
        Reason = "string"
      ),
      Type = "application"|"network"|"gateway",
      AvailabilityZones = list(
        list(
          ZoneName = "string",
          SubnetId = "string",
          OutpostId = "string",
          LoadBalancerAddresses = list(
            list(
              IpAddress = "string",
              AllocationId = "string",
              PrivateIPv4Address = "string",
              IPv6Address = "string"
            )
          )
        )
      ),
      SecurityGroups = list(
        "string"
      ),
      IpAddressType = "ipv4"|"dualstack"|"dualstack-without-public-ipv4",
      CustomerOwnedIpv4Pool = "string",
      EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic = "string"
    )
  )
)

Request syntax

svc$create_load_balancer(
  Name = "string",
  Subnets = list(
    "string"
  ),
  SubnetMappings = list(
    list(
      SubnetId = "string",
      AllocationId = "string",
      PrivateIPv4Address = "string",
      IPv6Address = "string"
    )
  ),
  SecurityGroups = list(
    "string"
  ),
  Scheme = "internet-facing"|"internal",
  Tags = list(
    list(
      Key = "string",
      Value = "string"
    )
  ),
  Type = "application"|"network"|"gateway",
  IpAddressType = "ipv4"|"dualstack"|"dualstack-without-public-ipv4",
  CustomerOwnedIpv4Pool = "string"
)

Examples

## Not run: 
# This example creates an Internet-facing load balancer and enables the
# Availability Zones for the specified subnets.
svc$create_load_balancer(
  Name = "my-load-balancer",
  Subnets = list(
    "subnet-b7d581c0",
    "subnet-8360a9e7"
  )
)

# This example creates an internal load balancer and enables the
# Availability Zones for the specified subnets.
svc$create_load_balancer(
  Name = "my-internal-load-balancer",
  Scheme = "internal",
  SecurityGroups = list(),
  Subnets = list(
    "subnet-b7d581c0",
    "subnet-8360a9e7"
  )
)

## End(Not run)