Skip to content

/AWS1/CL_ELB=>CREATELOADBALANCER()

About CreateLoadBalancer

Creates a Classic Load Balancer.

You can add listeners, security groups, subnets, and tags when you create your load balancer, or you can add them later using CreateLoadBalancerListeners, ApplySecurityGroupsToLoadBalancer, AttachLoadBalancerToSubnets, and AddTags.

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

You can create up to 20 load balancers per region per account. You can request an increase for the number of load balancers for your account. For more information, see Limits for Your Classic Load Balancer in the Classic Load Balancers Guide.

Method Signature

IMPORTING

Required arguments:

iv_loadbalancername TYPE /AWS1/ELBACCESSPOINTNAME /AWS1/ELBACCESSPOINTNAME

The name of the load balancer.

This name must be unique within your set of load balancers for the region, must have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and cannot begin or end with a hyphen.

it_listeners TYPE /AWS1/CL_ELBLISTENER=>TT_LISTENERS TT_LISTENERS

The listeners.

For more information, see Listeners for Your Classic Load Balancer in the Classic Load Balancers Guide.

Optional arguments:

it_availabilityzones TYPE /AWS1/CL_ELBAZS_W=>TT_AVAILABILITYZONES TT_AVAILABILITYZONES

One or more Availability Zones from the same region as the load balancer.

You must specify at least one Availability Zone.

You can add more Availability Zones after you create the load balancer using EnableAvailabilityZonesForLoadBalancer.

it_subnets TYPE /AWS1/CL_ELBSUBNETS_W=>TT_SUBNETS TT_SUBNETS

The IDs of the subnets in your VPC to attach to the load balancer. Specify one subnet per Availability Zone specified in AvailabilityZones.

it_securitygroups TYPE /AWS1/CL_ELBSECURITYGROUPS_W=>TT_SECURITYGROUPS TT_SECURITYGROUPS

The IDs of the security groups to assign to the load balancer.

iv_scheme TYPE /AWS1/ELBLOADBALANCERSCHEME /AWS1/ELBLOADBALANCERSCHEME

The type of a load balancer. Valid only for load balancers in a VPC.


By default, Elastic Load Balancing creates an Internet-facing load balancer with a DNS name that resolves to public IP addresses. For more information about Internet-facing and Internal load balancers, see Load Balancer Scheme in the Elastic Load Balancing User Guide.

Specify internal to create a load balancer with a DNS name that resolves to private IP addresses.

it_tags TYPE /AWS1/CL_ELBTAG=>TT_TAGLIST TT_TAGLIST

A list of tags to assign to the load balancer.

For more information about tagging your load balancer, see Tag Your Classic Load Balancer in the Classic Load Balancers Guide.

RETURNING

oo_output TYPE REF TO /aws1/cl_elbcreateaccpointout /AWS1/CL_ELBCREATEACCPOINTOUT

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_elb~createloadbalancer(
  it_availabilityzones = VALUE /aws1/cl_elbazs_w=>tt_availabilityzones(
    ( new /aws1/cl_elbazs_w( |string| ) )
  )
  it_listeners = VALUE /aws1/cl_elblistener=>tt_listeners(
    (
      new /aws1/cl_elblistener(
        iv_instanceport = 123
        iv_instanceprotocol = |string|
        iv_loadbalancerport = 123
        iv_protocol = |string|
        iv_sslcertificateid = |string|
      )
    )
  )
  it_securitygroups = VALUE /aws1/cl_elbsecuritygroups_w=>tt_securitygroups(
    ( new /aws1/cl_elbsecuritygroups_w( |string| ) )
  )
  it_subnets = VALUE /aws1/cl_elbsubnets_w=>tt_subnets(
    ( new /aws1/cl_elbsubnets_w( |string| ) )
  )
  it_tags = VALUE /aws1/cl_elbtag=>tt_taglist(
    (
      new /aws1/cl_elbtag(
        iv_key = |string|
        iv_value = |string|
      )
    )
  )
  iv_loadbalancername = |string|
  iv_scheme = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_dnsname = lo_result->get_dnsname( ).
ENDIF.

To create an HTTP load balancer in a VPC

This example creates a load balancer with an HTTP listener in a VPC.

DATA(lo_result) = lo_client->/aws1/if_elb~createloadbalancer(
  it_listeners = VALUE /aws1/cl_elblistener=>tt_listeners(
    (
      new /aws1/cl_elblistener(
        iv_instanceport = 80
        iv_instanceprotocol = |HTTP|
        iv_loadbalancerport = 80
        iv_protocol = |HTTP|
      )
    )
  )
  it_securitygroups = VALUE /aws1/cl_elbsecuritygroups_w=>tt_securitygroups(
    ( new /aws1/cl_elbsecuritygroups_w( |sg-a61988c3| ) )
  )
  it_subnets = VALUE /aws1/cl_elbsubnets_w=>tt_subnets(
    ( new /aws1/cl_elbsubnets_w( |subnet-15aaab61| ) )
  )
  iv_loadbalancername = |my-load-balancer|
).

To create an HTTP load balancer in EC2-Classic

This example creates a load balancer with an HTTP listener in EC2-Classic.

DATA(lo_result) = lo_client->/aws1/if_elb~createloadbalancer(
  it_availabilityzones = VALUE /aws1/cl_elbazs_w=>tt_availabilityzones(
    ( new /aws1/cl_elbazs_w( |us-west-2a| ) )
  )
  it_listeners = VALUE /aws1/cl_elblistener=>tt_listeners(
    (
      new /aws1/cl_elblistener(
        iv_instanceport = 80
        iv_instanceprotocol = |HTTP|
        iv_loadbalancerport = 80
        iv_protocol = |HTTP|
      )
    )
  )
  iv_loadbalancername = |my-load-balancer|
).

To create an HTTPS load balancer in a VPC

This example creates a load balancer with an HTTPS listener in a VPC.

DATA(lo_result) = lo_client->/aws1/if_elb~createloadbalancer(
  it_listeners = VALUE /aws1/cl_elblistener=>tt_listeners(
    (
      new /aws1/cl_elblistener(
        iv_instanceport = 80
        iv_instanceprotocol = |HTTP|
        iv_loadbalancerport = 80
        iv_protocol = |HTTP|
      )
    )
    (
      new /aws1/cl_elblistener(
        iv_instanceport = 80
        iv_instanceprotocol = |HTTP|
        iv_loadbalancerport = 443
        iv_protocol = |HTTPS|
        iv_sslcertificateid = |arn:aws:iam::123456789012:server-certificate/my-server-cert|
      )
    )
  )
  it_securitygroups = VALUE /aws1/cl_elbsecuritygroups_w=>tt_securitygroups(
    ( new /aws1/cl_elbsecuritygroups_w( |sg-a61988c3| ) )
  )
  it_subnets = VALUE /aws1/cl_elbsubnets_w=>tt_subnets(
    ( new /aws1/cl_elbsubnets_w( |subnet-15aaab61| ) )
  )
  iv_loadbalancername = |my-load-balancer|
).

To create an HTTPS load balancer in EC2-Classic

This example creates a load balancer with an HTTPS listener in EC2-Classic.

DATA(lo_result) = lo_client->/aws1/if_elb~createloadbalancer(
  it_availabilityzones = VALUE /aws1/cl_elbazs_w=>tt_availabilityzones(
    ( new /aws1/cl_elbazs_w( |us-west-2a| ) )
  )
  it_listeners = VALUE /aws1/cl_elblistener=>tt_listeners(
    (
      new /aws1/cl_elblistener(
        iv_instanceport = 80
        iv_instanceprotocol = |HTTP|
        iv_loadbalancerport = 80
        iv_protocol = |HTTP|
      )
    )
    (
      new /aws1/cl_elblistener(
        iv_instanceport = 80
        iv_instanceprotocol = |HTTP|
        iv_loadbalancerport = 443
        iv_protocol = |HTTPS|
        iv_sslcertificateid = |arn:aws:iam::123456789012:server-certificate/my-server-cert|
      )
    )
  )
  iv_loadbalancername = |my-load-balancer|
).

To create an internal load balancer

This example creates an internal load balancer with an HTTP listener in a VPC.

DATA(lo_result) = lo_client->/aws1/if_elb~createloadbalancer(
  it_listeners = VALUE /aws1/cl_elblistener=>tt_listeners(
    (
      new /aws1/cl_elblistener(
        iv_instanceport = 80
        iv_instanceprotocol = |HTTP|
        iv_loadbalancerport = 80
        iv_protocol = |HTTP|
      )
    )
  )
  it_securitygroups = VALUE /aws1/cl_elbsecuritygroups_w=>tt_securitygroups(
    ( new /aws1/cl_elbsecuritygroups_w( |sg-a61988c3| ) )
  )
  it_subnets = VALUE /aws1/cl_elbsubnets_w=>tt_subnets(
    ( new /aws1/cl_elbsubnets_w( |subnet-15aaab61| ) )
  )
  iv_loadbalancername = |my-load-balancer|
  iv_scheme = |internal|
).