load_balancers
Creates, updates, deletes, gets or lists a load_balancers resource.
Overview
| Name | load_balancers |
| Type | Resource |
| Id | aws.lightsail.load_balancers |
Fields
The following fields are returned by SELECT queries:
- get_load_balancer
- get_load_balancers
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the load balancer (my-load-balancer). (pattern: <code>\w[\w-]*\w</code>) |
arn | string | The Amazon Resource Name (ARN) of the load balancer. (pattern: <code>.\S.</code>) |
configuration_options | object | A string to string map of the configuration options for your load balancer. Valid values are listed below. |
created_at | string (date-time) | The date when your load balancer was created. |
dns_name | string | The DNS name of your Lightsail load balancer. (pattern: <code>.\S.</code>) |
health_check_path | string | The path you specified to perform your health checks. If no path is specified, the load balancer tries to make a request to the default (root) page. (pattern: <code>.\S.</code>) |
https_redirection_enabled | boolean | A Boolean value that indicates whether HTTPS redirection is enabled for the load balancer. |
instance_health_summary | array | An array of InstanceHealthSummary objects describing the health of the load balancer. |
instance_port | integer | The port where the load balancer will direct traffic to your Lightsail instances. For HTTP traffic, it's port 80. For HTTPS traffic, it's port 443. |
ip_address_type | string | The IP address type of the load balancer. The possible values are ipv4 for IPv4 only, ipv6 for IPv6 only, and dualstack for IPv4 and IPv6. (dualstack, ipv4, ipv6) |
location | object | The AWS Region where your load balancer was created (us-east-2a). Lightsail automatically creates your load balancer across Availability Zones. |
protocol | string | The protocol you have enabled for your load balancer. Valid values are below. You can't just have HTTP_HTTPS, but you can have just HTTP. (HTTP_HTTPS, HTTP) |
public_ports | array | An array of public port settings for your load balancer. For HTTP, use port 80. For HTTPS, use port 443. |
resource_type | string | The resource type (LoadBalancer. (ContainerService, Instance, StaticIp, KeyPair, InstanceSnapshot, Domain, PeeredVpc, LoadBalancer, LoadBalancerTlsCertificate, Disk, DiskSnapshot, RelationalDatabase, RelationalDatabaseSnapshot, ExportSnapshotRecord, CloudFormationStackRecord, Alarm, ContactMethod, Distribution, Certificate, Bucket) |
state | string | The status of your load balancer. Valid values are below. (active, provisioning, active_impaired, failed, unknown) |
support_code | string | The support code. Include this code in your email to support when you have questions about your Lightsail load balancer. This code enables our support team to look up your Lightsail information more easily. |
tags | array | The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer Guide. |
tls_certificate_summaries | array | An array of LoadBalancerTlsCertificateSummary objects that provide additional information about the SSL/TLS certificates. For example, if true, the certificate is attached to the load balancer. |
tls_policy_name | string | The name of the TLS security policy for the load balancer. (pattern: <code>\w[\w-]*\w</code>) |
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the load balancer (my-load-balancer). (pattern: <code>\w[\w-]*\w</code>) |
arn | string | The Amazon Resource Name (ARN) of the load balancer. (pattern: <code>.\S.</code>) |
configuration_options | object | A string to string map of the configuration options for your load balancer. Valid values are listed below. |
created_at | string (date-time) | The date when your load balancer was created. |
dns_name | string | The DNS name of your Lightsail load balancer. (pattern: <code>.\S.</code>) |
health_check_path | string | The path you specified to perform your health checks. If no path is specified, the load balancer tries to make a request to the default (root) page. (pattern: <code>.\S.</code>) |
https_redirection_enabled | boolean | A Boolean value that indicates whether HTTPS redirection is enabled for the load balancer. |
instance_health_summary | array | An array of InstanceHealthSummary objects describing the health of the load balancer. |
instance_port | integer | The port where the load balancer will direct traffic to your Lightsail instances. For HTTP traffic, it's port 80. For HTTPS traffic, it's port 443. |
ip_address_type | string | The IP address type of the load balancer. The possible values are ipv4 for IPv4 only, ipv6 for IPv6 only, and dualstack for IPv4 and IPv6. (dualstack, ipv4, ipv6) |
location | object | The AWS Region where your load balancer was created (us-east-2a). Lightsail automatically creates your load balancer across Availability Zones. |
protocol | string | The protocol you have enabled for your load balancer. Valid values are below. You can't just have HTTP_HTTPS, but you can have just HTTP. (HTTP_HTTPS, HTTP) |
public_ports | array | An array of public port settings for your load balancer. For HTTP, use port 80. For HTTPS, use port 443. |
resource_type | string | The resource type (LoadBalancer. (ContainerService, Instance, StaticIp, KeyPair, InstanceSnapshot, Domain, PeeredVpc, LoadBalancer, LoadBalancerTlsCertificate, Disk, DiskSnapshot, RelationalDatabase, RelationalDatabaseSnapshot, ExportSnapshotRecord, CloudFormationStackRecord, Alarm, ContactMethod, Distribution, Certificate, Bucket) |
state | string | The status of your load balancer. Valid values are below. (active, provisioning, active_impaired, failed, unknown) |
support_code | string | The support code. Include this code in your email to support when you have questions about your Lightsail load balancer. This code enables our support team to look up your Lightsail information more easily. |
tags | array | The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer Guide. |
tls_certificate_summaries | array | An array of LoadBalancerTlsCertificateSummary objects that provide additional information about the SSL/TLS certificates. For example, if true, the certificate is attached to the load balancer. |
tls_policy_name | string | The name of the TLS security policy for the load balancer. (pattern: <code>\w[\w-]*\w</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_load_balancer | select | region | Returns information about the specified Lightsail load balancer. | |
get_load_balancers | select | region | Returns information about all load balancers in an account. | |
create_load_balancer | insert | region, loadBalancerName, instancePort | Creates a Lightsail load balancer. To learn more about deciding whether to load balance your application, see Configure your Lightsail instances for load balancing. You can create up to 10 load balancers per AWS Region in your account. When you create a load balancer, you can specify a unique name and port settings. To change additional load balancer settings, use the UpdateLoadBalancerAttribute operation. The create load balancer operation supports tag-based access control via request tags. For more information, see the Amazon Lightsail Developer Guide. | |
update_load_balancer_attribute | update | region, loadBalancerName, attributeName, attributeValue | Updates the specified attribute for a load balancer. You can only update one attribute at a time. The update load balancer attribute operation supports tag-based access control via resource tags applied to the resource identified by load balancer name. For more information, see the Amazon Lightsail Developer Guide. | |
attach_instances_to_load_balancer | update | region, loadBalancerName, instanceNames | Attaches one or more Lightsail instances to a load balancer. After some time, the instances are attached to the load balancer and the health check status is available. The attach instances to load balancer operation supports tag-based access control via resource tags applied to the resource identified by load balancer name. For more information, see the Lightsail Developer Guide. | |
delete_load_balancer | delete | region | Deletes a Lightsail load balancer and all its associated SSL/TLS certificates. Once the load balancer is deleted, you will need to create a new load balancer, create a new certificate, and verify domain ownership again. The delete load balancer operation supports tag-based access control via resource tags applied to the resource identified by load balancer name. For more information, see the Amazon Lightsail Developer Guide. | |
detach_instances_from_load_balancer | exec | region, loadBalancerName, instanceNames | Detaches the specified instances from a Lightsail load balancer. This operation waits until the instances are no longer needed before they are detached from the load balancer. The detach instances from load balancer operation supports tag-based access control via resource tags applied to the resource identified by load balancer name. For more information, see the Amazon Lightsail Developer Guide. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_load_balancer
- get_load_balancers
Returns information about the specified Lightsail load balancer.
SELECT
name,
arn,
configuration_options,
created_at,
dns_name,
health_check_path,
https_redirection_enabled,
instance_health_summary,
instance_port,
ip_address_type,
location,
protocol,
public_ports,
resource_type,
state,
support_code,
tags,
tls_certificate_summaries,
tls_policy_name
FROM aws.lightsail.load_balancers
WHERE region = '{{ region }}' -- required
;
Returns information about all load balancers in an account.
SELECT
name,
arn,
configuration_options,
created_at,
dns_name,
health_check_path,
https_redirection_enabled,
instance_health_summary,
instance_port,
ip_address_type,
location,
protocol,
public_ports,
resource_type,
state,
support_code,
tags,
tls_certificate_summaries,
tls_policy_name
FROM aws.lightsail.load_balancers
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_load_balancer
- Manifest
Creates a Lightsail load balancer. To learn more about deciding whether to load balance your application, see Configure your Lightsail instances for load balancing. You can create up to 10 load balancers per AWS Region in your account. When you create a load balancer, you can specify a unique name and port settings. To change additional load balancer settings, use the UpdateLoadBalancerAttribute operation. The create load balancer operation supports tag-based access control via request tags. For more information, see the Amazon Lightsail Developer Guide.
INSERT INTO aws.lightsail.load_balancers (
loadBalancerName,
instancePort,
healthCheckPath,
certificateName,
certificateDomainName,
certificateAlternativeNames,
tags,
ipAddressType,
tlsPolicyName,
region
)
SELECT
'{{ loadBalancerName }}' /* required */,
{{ instancePort }} /* required */,
'{{ healthCheckPath }}',
'{{ certificateName }}',
'{{ certificateDomainName }}',
'{{ certificateAlternativeNames }}',
'{{ tags }}',
'{{ ipAddressType }}',
'{{ tlsPolicyName }}',
'{{ region }}'
RETURNING
operations
;
# Description fields are for documentation purposes
- name: load_balancers
props:
- name: region
value: "{{ region }}"
description: Required parameter for the load_balancers resource.
- name: loadBalancerName
value: "{{ loadBalancerName }}"
description: |
The name of your load balancer.
- name: instancePort
value: {{ instancePort }}
description: |
The instance port where you're creating your load balancer.
- name: healthCheckPath
value: "{{ healthCheckPath }}"
description: |
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 ("/"). You may want to specify a custom health check path other than the root of your application if your home page loads slowly or has a lot of media or scripting on it.
- name: certificateName
value: "{{ certificateName }}"
description: |
The name of the SSL/TLS certificate. If you specify certificateName, then certificateDomainName is required (and vice-versa).
- name: certificateDomainName
value: "{{ certificateDomainName }}"
description: |
The domain name with which your certificate is associated (example.com). If you specify certificateDomainName, then certificateName is required (and vice-versa).
- name: certificateAlternativeNames
value:
- "{{ certificateAlternativeNames }}"
description: |
The optional alternative domains and subdomains to use with your SSL/TLS certificate (www.example.com, example.com, m.example.com, blog.example.com).
- name: tags
description: |
The tag keys and optional values to add to the resource during create. Use the TagResource action to tag a resource after it's created.
value:
- key: "{{ key }}"
value: "{{ value }}"
- name: ipAddressType
value: "{{ ipAddressType }}"
description: |
The IP address type for the load balancer. The possible values are ipv4 for IPv4 only, ipv6 for IPv6 only, and dualstack for IPv4 and IPv6. The default value is dualstack.
valid_values: ['dualstack', 'ipv4', 'ipv6']
- name: tlsPolicyName
value: "{{ tlsPolicyName }}"
description: |
The name of the TLS policy to apply to the load balancer. Use the GetLoadBalancerTlsPolicies action to get a list of TLS policy names that you can specify. For more information about load balancer TLS policies, see Configuring TLS security policies on your Amazon Lightsail load balancers in the Amazon Lightsail Developer Guide.
UPDATE examples
- update_load_balancer_attribute
- attach_instances_to_load_balancer
Updates the specified attribute for a load balancer. You can only update one attribute at a time. The update load balancer attribute operation supports tag-based access control via resource tags applied to the resource identified by load balancer name. For more information, see the Amazon Lightsail Developer Guide.
UPDATE aws.lightsail.load_balancers
SET
loadBalancerName = '{{ loadBalancerName }}',
attributeName = '{{ attributeName }}',
attributeValue = '{{ attributeValue }}'
WHERE
region = '{{ region }}' --required
AND loadBalancerName = '{{ loadBalancerName }}' --required
AND attributeName = '{{ attributeName }}' --required
AND attributeValue = '{{ attributeValue }}' --required
RETURNING
operations;
Attaches one or more Lightsail instances to a load balancer. After some time, the instances are attached to the load balancer and the health check status is available. The attach instances to load balancer operation supports tag-based access control via resource tags applied to the resource identified by load balancer name. For more information, see the Lightsail Developer Guide.
UPDATE aws.lightsail.load_balancers
SET
loadBalancerName = '{{ loadBalancerName }}',
instanceNames = '{{ instanceNames }}'
WHERE
region = '{{ region }}' --required
AND loadBalancerName = '{{ loadBalancerName }}' --required
AND instanceNames = '{{ instanceNames }}' --required
RETURNING
operations;
DELETE examples
- delete_load_balancer
Deletes a Lightsail load balancer and all its associated SSL/TLS certificates. Once the load balancer is deleted, you will need to create a new load balancer, create a new certificate, and verify domain ownership again. The delete load balancer operation supports tag-based access control via resource tags applied to the resource identified by load balancer name. For more information, see the Amazon Lightsail Developer Guide.
DELETE FROM aws.lightsail.load_balancers
WHERE region = '{{ region }}' --required
;
Lifecycle Methods
- detach_instances_from_load_balancer
Detaches the specified instances from a Lightsail load balancer. This operation waits until the instances are no longer needed before they are detached from the load balancer. The detach instances from load balancer operation supports tag-based access control via resource tags applied to the resource identified by load balancer name. For more information, see the Amazon Lightsail Developer Guide.
EXEC aws.lightsail.load_balancers.detach_instances_from_load_balancer
@region='{{ region }}' --required
@@json=
'{
"loadBalancerName": "{{ loadBalancerName }}",
"instanceNames": "{{ instanceNames }}"
}'
;