Lightsail.Client.
get_load_balancers
(**kwargs)¶Returns information about all load balancers in an account.
See also: AWS API Documentation
Request Syntax
response = client.get_load_balancers(
pageToken='string'
)
The token to advance to the next page of results from your request.
To get a page token, perform an initial GetLoadBalancers
request. If your results are paginated, the response will return a next page token that you can specify as the page token in a subsequent request.
{
'loadBalancers': [
{
'name': 'string',
'arn': 'string',
'supportCode': 'string',
'createdAt': datetime(2015, 1, 1),
'location': {
'availabilityZone': 'string',
'regionName': 'us-east-1'|'us-east-2'|'us-west-1'|'us-west-2'|'eu-west-1'|'eu-west-2'|'eu-west-3'|'eu-central-1'|'ca-central-1'|'ap-south-1'|'ap-southeast-1'|'ap-southeast-2'|'ap-northeast-1'|'ap-northeast-2'|'eu-north-1'
},
'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
'tags': [
{
'key': 'string',
'value': 'string'
},
],
'dnsName': 'string',
'state': 'active'|'provisioning'|'active_impaired'|'failed'|'unknown',
'protocol': 'HTTP_HTTPS'|'HTTP',
'publicPorts': [
123,
],
'healthCheckPath': 'string',
'instancePort': 123,
'instanceHealthSummary': [
{
'instanceName': 'string',
'instanceHealth': 'initial'|'healthy'|'unhealthy'|'unused'|'draining'|'unavailable',
'instanceHealthReason': 'Lb.RegistrationInProgress'|'Lb.InitialHealthChecking'|'Lb.InternalError'|'Instance.ResponseCodeMismatch'|'Instance.Timeout'|'Instance.FailedHealthChecks'|'Instance.NotRegistered'|'Instance.NotInUse'|'Instance.DeregistrationInProgress'|'Instance.InvalidState'|'Instance.IpUnusable'
},
],
'tlsCertificateSummaries': [
{
'name': 'string',
'isAttached': True|False
},
],
'configurationOptions': {
'string': 'string'
},
'ipAddressType': 'dualstack'|'ipv4',
'httpsRedirectionEnabled': True|False,
'tlsPolicyName': 'string'
},
],
'nextPageToken': 'string'
}
Response Structure
An array of LoadBalancer objects describing your load balancers.
Describes a load balancer.
The name of the load balancer (e.g., my-load-balancer
).
The Amazon Resource Name (ARN) of the load balancer.
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.
The date when your load balancer was created.
The AWS Region where your load balancer was created (e.g., us-east-2a
). Lightsail automatically creates your load balancer across Availability Zones.
The Availability Zone. Follows the format us-east-2a
(case-sensitive).
The Amazon Web Services Region name.
The resource type (e.g., LoadBalancer
.
The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer Guide.
Describes a tag key and optional value assigned to an Amazon Lightsail resource.
For more information about tags in Lightsail, see the Amazon Lightsail Developer Guide.
The key of the tag.
Constraints: Tag keys accept a maximum of 128 letters, numbers, spaces in UTF-8, or the following characters: + - = . _ : / @
The value of the tag.
Constraints: Tag values accept a maximum of 256 letters, numbers, spaces in UTF-8, or the following characters: + - = . _ : / @
The DNS name of your Lightsail load balancer.
The status of your load balancer. Valid values are below.
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
.
An array of public port settings for your load balancer. For HTTP, use port 80. For HTTPS, use port 443.
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.
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.
An array of InstanceHealthSummary objects describing the health of the load balancer.
Describes information about the health of the instance.
The name of the Lightsail instance for which you are requesting health check data.
Describes the overall instance health. Valid values are below.
More information about the instance health. If the instanceHealth
is healthy
, then an instanceHealthReason
value is not provided.
If instanceHealth
is initial
, the instanceHealthReason
value can be one of the following:
Lb.RegistrationInProgress
- The target instance is in the process of being registered with the load balancer.Lb.InitialHealthChecking
- The Lightsail load balancer is still sending the target instance the minimum number of health checks required to determine its health status.If instanceHealth
is unhealthy
, the instanceHealthReason
value can be one of the following:
Instance.ResponseCodeMismatch
- The health checks did not return an expected HTTP code.Instance.Timeout
- The health check requests timed out.Instance.FailedHealthChecks
- The health checks failed because the connection to the target instance timed out, the target instance response was malformed, or the target instance failed the health check for an unknown reason.Lb.InternalError
- The health checks failed due to an internal error.If instanceHealth
is unused
, the instanceHealthReason
value can be one of the following:
Instance.NotRegistered
- The target instance is not registered with the target group.Instance.NotInUse
- The target group is not used by any load balancer, or the target instance is in an Availability Zone that is not enabled for its load balancer.Instance.IpUnusable
- The target IP address is reserved for use by a Lightsail load balancer.Instance.InvalidState
- The target is in the stopped or terminated state.If instanceHealth
is draining
, the instanceHealthReason
value can be one of the following:
Instance.DeregistrationInProgress
- The target instance is in the process of being deregistered and the deregistration delay period has not expired.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.
Provides a summary of SSL/TLS certificate metadata.
The name of the SSL/TLS certificate.
When true
, the SSL/TLS certificate is attached to the Lightsail load balancer.
A string to string map of the configuration options for your load balancer. Valid values are listed below.
The IP address type of the load balancer.
The possible values are ipv4
for IPv4 only, and dualstack
for IPv4 and IPv6.
A Boolean value that indicates whether HTTPS redirection is enabled for the load balancer.
The name of the TLS security policy for the load balancer.
The token to advance to the next page of results from your request.
A next page token is not returned if there are no more results to display.
To get the next page of results, perform another GetLoadBalancers
request and specify the next page token using the pageToken
parameter.
Exceptions
Lightsail.Client.exceptions.ServiceException
Lightsail.Client.exceptions.InvalidInputException
Lightsail.Client.exceptions.NotFoundException
Lightsail.Client.exceptions.OperationFailureException
Lightsail.Client.exceptions.AccessDeniedException
Lightsail.Client.exceptions.AccountSetupInProgressException
Lightsail.Client.exceptions.UnauthenticatedException