paws.networking (version 0.1.6)

elbv2_create_load_balancer: Creates an Application Load Balancer or a Network Load Balancer

Description

Creates an Application Load Balancer or a Network Load Balancer.

Usage

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

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 public subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.

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

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

SubnetMappings

The IDs of the public subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.

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

[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.

SecurityGroups

[Application 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.

Tags

One or more tags to assign to the load balancer.

Type

The type of load balancer. The default is application.

IpAddressType

[Application Load Balancers] The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 (for IPv4 addresses) and dualstack (for IPv4 and IPv6 addresses). Internal load balancers must use ipv4.

Request syntax

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

Details

When you create a load balancer, you can specify security groups, public subnets, IP address type, and tags. Otherwise, you could do so later using SetSecurityGroups, SetSubnets, SetIpAddressType, and AddTags.

To create listeners for your load balancer, use CreateListener. To describe your current load balancers, see DescribeLoadBalancers. When you are finished with a load balancer, you can delete it using DeleteLoadBalancer.

For limit information, see Limits for Your Application Load Balancer in the Application Load Balancers Guide and Limits for Your Network Load Balancer in the Network Load Balancers Guide.

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.

For more information, see Application Load Balancers in the Application Load Balancers Guide and Network Load Balancers in the Network Load Balancers Guide.

Examples

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

Run the code above in your browser using DataCamp Workspace