Skip to main content

load_balancers

Creates, updates, deletes or gets a load_balancer resource or lists load_balancers in a region

Overview

Nameload_balancers
TypeResource
DescriptionResource Type definition for AWS::Lightsail::LoadBalancer
Idawscc.lightsail.load_balancers

Fields

NameDatatypeDescription
load_balancer_namestringThe name of your load balancer.
load_balancer_arnstring
instance_portintegerThe instance port where you're creating your load balancer.
ip_address_typestringThe IP address type for the load balancer. The possible values are ipv4 for IPv4 only, and dualstack for IPv4 and IPv6. The default value is dualstack.
attached_instancesarrayThe names of the instances attached to the load balancer.
health_check_pathstringThe path you provided to perform the load balancer health check. If you didn't specify a health check path, Lightsail uses the root path of your website (e.g., "/").
session_stickiness_enabledbooleanConfiguration option to enable session stickiness.
session_stickiness_lb_cookie_duration_secondsstringConfiguration option to adjust session stickiness cookie duration parameter.
tls_policy_namestringThe name of the TLS policy to apply to the load balancer.
tagsarrayAn array of key-value pairs to apply to this resource.
regionstringAWS region.

For more information, see AWS::Lightsail::LoadBalancer.

Methods

NameResourceAccessible byRequired Params
create_resourceload_balancersINSERTLoadBalancerName, InstancePort, region
delete_resourceload_balancersDELETEIdentifier, region
update_resourceload_balancersUPDATEIdentifier, PatchDocument, region
list_resourcesload_balancers_list_onlySELECTregion
get_resourceload_balancersSELECTIdentifier, region

SELECT examples

Gets all properties from an individual load_balancer.

SELECT
region,
load_balancer_name,
load_balancer_arn,
instance_port,
ip_address_type,
attached_instances,
health_check_path,
session_stickiness_enabled,
session_stickiness_lb_cookie_duration_seconds,
tls_policy_name,
tags
FROM awscc.lightsail.load_balancers
WHERE
region = 'us-east-1' AND
Identifier = '{{ load_balancer_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new load_balancer resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.lightsail.load_balancers (
LoadBalancerName,
InstancePort,
region
)
SELECT
'{{ load_balancer_name }}',
'{{ instance_port }}',
'{{ region }}';

UPDATE example

Use the following StackQL query and manifest file to update a load_balancer resource, using stack-deploy.

/*+ update */
UPDATE awscc.lightsail.load_balancers
SET PatchDocument = string('{{ {
"AttachedInstances": attached_instances,
"HealthCheckPath": health_check_path,
"SessionStickinessEnabled": session_stickiness_enabled,
"SessionStickinessLBCookieDurationSeconds": session_stickiness_lb_cookie_duration_seconds,
"TlsPolicyName": tls_policy_name,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ load_balancer_name }}';

DELETE example

/*+ delete */
DELETE FROM awscc.lightsail.load_balancers
WHERE
Identifier = '{{ load_balancer_name }}' AND
region = 'us-east-1';

Permissions

To operate on the load_balancers resource, the following permissions are required:

lightsail:CreateLoadBalancer,
lightsail:GetLoadBalancer,
lightsail:GetLoadBalancers,
lightsail:GetInstance,
lightsail:AttachInstancesToLoadBalancer,
lightsail:DetachInstancesFromLoadBalancer,
lightsail:UpdateLoadBalancerAttribute,
lightsail:TagResource,
lightsail:UntagResource