VM::EC2::ELB(3pm)

πŸ“¦
version 1.28 Β· 7 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

Hey bestie! πŸ’– Welcome to the manual page for VM::EC2::ELB(3pm) β€” yes, that's the Perl module that gives you an object describing an Amazon Elastic Load Balancer. It's giving load-balancing realness. πŸŽ€

✨ NAME ✨

VM::EC2::ELB -- Object describing an Elastic Load Balancer

🌸 SYNOPSIS 🌸

use VM::EC2;

$ec2       = VM::EC2->new(...);
$lb = $ec2->create_load_balancer(%args);
  or
$lb = $ec2->describe_load_balancers(-load_balancer_name=>'my-lb');

@zones        = $lb->AvailabilityZones;
$created      = $lb->CreatedTime;
$dns_name     = $lb->DNSName;
$health_check = $lb->HealthCheck;
@instances    = $lb->Instances;
@list_desc    = $lb->ListenerDescriptions;
$name         = $lb->LoadBalancerName;
@policies_obj = $lb->Policies;
@policies     = $lb->describe_policies(-policy_names=>'mypolicy');
$scheme       = $lb->Scheme;
$sg_name      = $lb->SourceSecurityGroup;
$success      = $lb->create_load_balancer_listeners(%args);
$success      = $lb->enable_availability_zones_for_load_balancer(@zones);
@list         = $lb->register_instances_with_load_balancer(-instances => 'i-12345678');
$state        = $lb->describe_instance_health(-instances => 'i-12345678')
$success      = $lb->delete_load_balancer;

πŸ’… DESCRIPTION πŸ’…

This object represents an Amazon Elastic Load Balancer and is returned by VM::EC2->describe_load_balancers() and VM::EC2->create_load_balancer(). Besides methods to query the ELB's attributes, there are methods that manage the ELB's lifecycle and properties. No cap. 🫢

πŸ”₯ METHODS πŸ”₯

The following object methods are supported:

  • AvailabilityZones β€” The enabled availability zones for the ELB in the form of an array of VM::EC2::AvailabilityZone objects.
  • BackendServerDescriptions β€” The backend server descriptions.
  • CreatedTime β€” The creation date of the ELB.
  • DNSName β€” The DNS name of the ELB.
  • HealthCheck β€” The health check associated with the ELB in the form of a VM::EC2::ELB::HealthCheck object.
  • Instances β€” The instances that the ELB points to, in the form of an array of VM::EC2::Instance objects.
  • ListenerDescriptions β€” An array of VM::EC2::ELB::ListenerDescription objects.
  • LoadBalancerName β€” The name of the ELB.
  • Policies β€” The policies of the ELB in the form of a VM::EC2::ELB::Policies object.
  • Scheme β€” Specifies the type of ELB ('internal' is for VPC only.)
  • SecurityGroups β€” The security groups the ELB is a member of (VPC only) in the form of VM::EC2::SecurityGroup objects.
  • SourceSecurityGroup β€” The security group that the ELB is a member of.
  • Subnets β€” Provides an array of VPC subnet objects (VM::EC2::VPC::Subnet) that the ELB is part of.
  • VPCId β€” Provides the ID of the VPC attached to the ELB.

"Unimplemented/untested" object methods related to Route 53 (return raw data/data structures):

  • CanonicalHostedZoneName β€” The name of the Amazon Route 53 hosted zone that is associated with the ELB.
  • CanonicalHostedZoneNameID β€” The ID of the Amazon Route 53 hosted zone name that is associated with the ELB.

The following convenience methods are supported:

  • active_policies β€” Returns the policies that are actively in use by the ELB in the form of VM::EC2::ELB::PolicyDescription objects.
  • all_policies β€” Returns all policies that are associated with the ELB in the form of VM::EC2::ELB::PolicyDescription objects.
  • listeners β€” Provides the VM::EC2::ELB::Listener objects associated with the ELB.

πŸ¦‹ LIFECYCLE METHODS πŸ¦‹

$success = $elb->delete_load_balancer / $success = $elb->delete

This method deletes the ELB. Returns true on success. Bye bye, load balancer! πŸ‘‹

Generates a stickiness policy with sticky session lifetimes that follow that of an application-generated cookie. This policy can be associated only with HTTP/HTTPS listeners. Returns true on success.

Generates a stickiness policy with sticky session lifetimes controlled by the lifetime of the browser (user-agent) or a specified expiration period. This policy can be associated only with HTTP/HTTPS listeners. Returns true on success.

$success = $elb->create_load_balancer_listeners(-listeners=>\%listener_hash); / $success = $elb->create_listeners(\%listener_hash);

Creates one or more listeners on a ELB for the specified port. If a listener with the given port does not already exist, it will be created; otherwise, the properties of the new listener must match the properties of the existing listener. Returns true on success.

The passed argument must either be a VM::EC2::ELB:Listener object (or arrayref of objects) or a hash (or arrayref of hashes) containing the following keys:

  • Protocol β€” Value as one of: HTTP, HTTPS, TCP, or SSL
  • LoadBalancerPort β€” Value in range 1-65535
  • InstancePort β€” Value in range 1-65535

and optionally:

  • InstanceProtocol β€” Value as one of: HTTP, HTTPS, TCP, or SSL
  • SSLCertificateId β€” Certificate ID from AWS IAM certificate list

$success = $elb->delete_load_balancer_listeners(-load_balancer_ports=>\@ports) / $success = $elb->delete_listeners(@ports)

Deletes listeners from the ELB for the specified port. Returns true on success.

@zones = $elb->disable_availability_zones_for_load_balancer(-zones=>\@zones) / @zones = $elb->disable_availability_zones(@zones) / @zones = $elb->disable_zones(@zones)

Removes the specified EC2 Availability Zones from the set of configured Availability Zones for the ELB. Returns a series of VM::EC2::AvailabilityZone objects now associated with the ELB.

@zones = $elb->enable_availability_zones_for_load_balancer(-zones=>\@zones) / @zones = $elb->enable_availability_zones(@zones) / @zones = $elb->enable_zones(@zones)

Adds the specified EC2 Availability Zones to the set of configured Availability Zones for the ELB. Returns a series of VM::EC2::AvailabilityZone objects now associated with the ELB.

@instance_ids = $elb->register_instances_with_load_balancer(-instances=>\@instance_ids) / @instance_ids = $elb->register_instances(@instance_ids)

Adds new instances to the ELB. If the instance is in an availability zone that is not registered with the ELB will be in the OutOfService state. Once the zone is added to the ELB the instance will go into the InService state. Returns an array of instance IDs now associated with the ELB.

@instance_ids = $elb->deregister_instances_from_load_balancer(-instances=>\@instance_ids) / @instance_ids = $elb->deregister_instances(@instance_ids)

Deregisters instances from the ELB. Once the instance is deregistered, it will stop receiving traffic from the ELB. Returns an array of instance IDs now associated with the ELB.

@states = $elb->describe_instance_health(-instances=>\@instance_ids) / @states = $elb->describe_instance_health(@instance_ids)

Provides the current state of the instances of the specified LoadBalancer. If no instances are specified, the state of all the instances for the ELB is returned. Returns an array of VM::EC2::ELB::InstanceState objects.

$success = $elb->create_load_balancer_policy(-policy_name=>$name,-policy_type_name=>$type_name,-policy_attributes=>\@attrs) / $success = $elb->create_policy(-policy_name=>$name,-policy_type_name=>$type_name,-policy_attributes=>\@attrs)

Creates a new policy that contains the necessary attributes depending on the policy type. Policies are settings that are saved for your ELB and that can be applied to the front-end listener, or the back-end application server, depending on your policy type. Returns true on success.

$success = $elb->delete_load_balancer_policy(-policy_name=>$policy_name) / $success = $elb->delete_policy($policy_name)

Deletes a policy from the ELB. The specified policy must not be enabled for any listeners. Returns true on success.

configure_health_check

$health_check = $elb->configure_health_check(-healthy_threshold=>$cnt,-interval=>$secs,-target=>$target,-timeout=>$secs,-unhealthy_threshold=>$cnt)

This is the glow-up for one specific target service's health check. You're telling the ELB what "alive" even means for that target. πŸ’–

Now the important part: -target has a whole format it has to follow, and if you freestyle it, it will not slay.

  • It must be in the format Protocol:Port[/PathToPing]
  • Valid Protocol types are: HTTP, HTTPS, TCP, SSL
  • Port must be in range 0-65535
  • PathToPing is only applicable to HTTP or HTTPS protocol types, and must be 1024 characters long or fewer

Example, so you can see the shape of it:

HTTP:80/index.html

create_policy

$success = $elb->create_policy(-policy_name=>$name,-policy_type_name=>$type_name)

Makes a brand new policy, and it'll contain whatever attributes it needs depending on the policy type you picked. Returns true on success. ✨


set_load_balancer_listener_ssl_certificate

$success = $elb->set_load_balancer_listener_ssl_certificate(-port=>$port,-cert_id=>$cert_id)

Sets the certificate that terminates the specified listener's SSL connections. Heads up bestie: the certificate you pass in replaces any prior certificate that was used on the same ELB and port. There is no undo, it's just the new cert now. Returns true on success. πŸŽ€


set_load_balancer_policies_of_listener

$success = $elb->set_load_balancer_policies_of_listener(-port=>$port,-policy_names=>\@names)

set_policies_of_listener

$success = $elb->set_policies_of_listener(-port=>$port,-policy_names=>\@names)

Associates, updates, or disables a policy with a listener on the ELB. And the tea is you can stack multiple policies onto a single listener β€” not just one. Returns true on success. πŸ’…


apply_security_groups_to_load_balancer

@groups = $elb->apply_security_groups_to_load_balancer(-security_groups=>\@groups)

apply_security_groups

@groups = $elb->apply_security_groups(@groups)

Associates one or more security groups with your ELB in VPC. The security group IDs you hand it will override any currently applied security groups β€” so this is a full replacement moment, not a lil addition, ok? πŸ™ˆ

Returns a list of VM::EC2::SecurityGroup objects.


attach_load_balancer_to_subnets

@subnets = $elb->attach_load_balancer_to_subnets(-subnets=>\@subnets)

attach_to_subnets

@subnets = $elb->attach_to_subnets(@subnets)

Adds one or more subnets to the set of configured subnets for the ELB. Returns a series of VM::EC2::VPC::Subnet objects corresponding to the subnets the ELB is now attached to. πŸ¦‹


detach_load_balancer_from_subnets

@subnets = $elb->detach_load_balancer_from_subnets(-subnets=>\@subnets)

detach_from_subnets

@subnets = $elb->detach_from_subnets(@subnets)

Removes subnets from the set of configured subnets in the VPC for the ELB. Returns a series of VM::EC2::VPC::Subnet objects corresponding to the subnets the ELB is now attached to. 🌸


set_load_balancer_policies_for_backend_server

$success = $elb->set_load_balancer_policies_for_backend_server(-port=>$port,-policy_names=>$names)

set_policies_for_backend_server

$success = $elb->set_policies_for_backend_server(-port=>$port,-policy_names=>$names)

Replaces the current set of policies associated with a port on which the back-end server is listening with a new set of policies. Once the policies have been created, you can apply them right here as a list. πŸ“‹

Real talk, and this is straight from the source: at this time, only the back-end server authentication policy type can be applied to the back-end ports, and that policy type is composed of multiple public key policies. So don't try to sneak anything else in there, it's giving not-that.

Returns true on success. πŸ”₯


add_tags

$success = $elb->add_tags({ Name => Value[, Name => Value,...]);

add_tags

$success = $elb->add_tags(\%tags);

Adds tags to the ELB. You can put up to ten tags on it β€” that's the ceiling, bestie, no more. πŸ‘‘


✨ INFORMATION METHODS ✨

describe_instance_health

$state = $lb->describe_instance_health(-instances=>\@instances)

describe_instance_health

$state = $lb->describe_instance_health(@instances)

describe_instance_health

$state = $lb->describe_instance_health

Returns the current state of the instances registered with the ELB. A lil vibe check on everybody's health, if you will. 🩺✨


describe_load_balancer_policies

@policies = $lb->describe_load_balancer_policies(-policy_names=>\@names)

describe_load_balancer_policies

@policies = $lb->describe_load_balancer_policies;

This one hands you back @policies. The policy objects themselves are their own whole thing β€” check the SEE ALSO list below for where that lives. πŸ’œ


🌈 STRING OVERLOADING 🌈

When you use this object in a string context, it will interpolate the Elastic Load Balancer Name. So you can just drop it straight into a string and it'll show up as the name. No cap, that's genuinely so convenient. 🫢


πŸ‘€ SEE ALSO πŸ‘€

  • VM::EC2
  • VM::EC2::Generic
  • VM::EC2::ELB::HealthCheck
  • VM::EC2::ELB::ListenerDescription
  • VM::EC2::ELB::BackendServerDescription
  • VM::EC2::ELB::Policies

πŸ’– AUTHOR πŸ’–

Lance Kinley <lkinley@loyaltymethods.com>.

Copyright (c) 2012-2014 Loyalty Methods, Inc.

This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty. πŸ“œ


And that's the whole page, bestie!! You made it to the end, iconic behavior honestly. πŸŽ‰ This one shipped as perl v5.38.2, dated 2024-08-10, and it's the VM::EC2::ELB(3pm) manpage. Go forth and load-balance, mwah πŸ’‹

πŸ“¦ where this page comes from