load_balancers
Creates, updates, deletes or gets a load_balancer resource or lists load_balancers in a region
Overview
| Name | load_balancers |
| Type | Resource |
| Description | Resource Type definition for AWS::Lightsail::LoadBalancer |
| Id | awscc.lightsail.load_balancers |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
load_balancer_name | string | The name of your load balancer. |
load_balancer_arn | string | |
instance_port | integer | The instance port where you're creating your load balancer. |
ip_address_type | string | The 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_instances | array | The names of the instances attached to the load balancer. |
health_check_path | string | The 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_enabled | boolean | Configuration option to enable session stickiness. |
session_stickiness_lb_cookie_duration_seconds | string | Configuration option to adjust session stickiness cookie duration parameter. |
tls_policy_name | string | The name of the TLS policy to apply to the load balancer. |
tags | array | An array of key-value pairs to apply to this resource. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
load_balancer_name | string | The name of your load balancer. |
region | string | AWS region. |
For more information, see AWS::Lightsail::LoadBalancer.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | load_balancers | INSERT | LoadBalancerName, InstancePort, region |
delete_resource | load_balancers | DELETE | Identifier, region |
update_resource | load_balancers | UPDATE | Identifier, PatchDocument, region |
list_resources | load_balancers_list_only | SELECT | region |
get_resource | load_balancers | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 = '{{ region }}' AND
Identifier = '{{ load_balancer_name }}';
Lists all load_balancers in a region.
SELECT
region,
load_balancer_name
FROM awscc.lightsail.load_balancers_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new load_balancer resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.lightsail.load_balancers (
LoadBalancerName,
InstancePort,
region
)
SELECT
'{{ load_balancer_name }}',
'{{ instance_port }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.lightsail.load_balancers (
LoadBalancerName,
InstancePort,
IpAddressType,
AttachedInstances,
HealthCheckPath,
SessionStickinessEnabled,
SessionStickinessLBCookieDurationSeconds,
TlsPolicyName,
Tags,
region
)
SELECT
'{{ load_balancer_name }}',
'{{ instance_port }}',
'{{ ip_address_type }}',
'{{ attached_instances }}',
'{{ health_check_path }}',
'{{ session_stickiness_enabled }}',
'{{ session_stickiness_lb_cookie_duration_seconds }}',
'{{ tls_policy_name }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: load_balancer
props:
- name: load_balancer_name
value: '{{ load_balancer_name }}'
- name: instance_port
value: '{{ instance_port }}'
- name: ip_address_type
value: '{{ ip_address_type }}'
- name: attached_instances
value:
- '{{ attached_instances[0] }}'
- name: health_check_path
value: '{{ health_check_path }}'
- name: session_stickiness_enabled
value: '{{ session_stickiness_enabled }}'
- name: session_stickiness_lb_cookie_duration_seconds
value: '{{ session_stickiness_lb_cookie_duration_seconds }}'
- name: tls_policy_name
value: '{{ tls_policy_name }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.lightsail.load_balancers
WHERE
Identifier = '{{ load_balancer_name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the load_balancers resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
lightsail:CreateLoadBalancer,
lightsail:GetLoadBalancer,
lightsail:GetLoadBalancers,
lightsail:GetInstance,
lightsail:AttachInstancesToLoadBalancer,
lightsail:DetachInstancesFromLoadBalancer,
lightsail:UpdateLoadBalancerAttribute,
lightsail:TagResource,
lightsail:UntagResource
lightsail:GetLoadBalancer,
lightsail:GetLoadBalancers
lightsail:GetLoadBalancer,
lightsail:GetLoadBalancers,
lightsail:GetInstance,
lightsail:AttachInstancesToLoadBalancer,
lightsail:DetachInstancesFromLoadBalancer,
lightsail:UpdateLoadBalancerAttribute,
lightsail:TagResource,
lightsail:UntagResource
lightsail:DeleteLoadBalancer,
lightsail:GetLoadBalancer,
lightsail:GetLoadBalancers
lightsail:GetLoadBalancers