Lightsail / Client / get_load_balancers
get_load_balancers#
- 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' )
- Parameters:
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.- Return type:
dict
- Returns:
Response Syntax
{ '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
(dict) –
loadBalancers (list) –
An array of LoadBalancer objects describing your load balancers.
(dict) –
Describes a load balancer.
name (string) –
The name of the load balancer (
my-load-balancer
).arn (string) –
The Amazon Resource Name (ARN) of the load balancer.
supportCode (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.
createdAt (datetime) –
The date when your load balancer was created.
location (dict) –
The AWS Region where your load balancer was created (
us-east-2a
). Lightsail automatically creates your load balancer across Availability Zones.availabilityZone (string) –
The Availability Zone. Follows the format
us-east-2a
(case-sensitive).regionName (string) –
The Amazon Web Services Region name.
resourceType (string) –
The resource type (
LoadBalancer
.tags (list) –
The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer Guide.
(dict) –
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.
key (string) –
The key of the tag.
Constraints: Tag keys accept a maximum of 128 letters, numbers, spaces in UTF-8, or the following characters: + - = . _ : / @
value (string) –
The value of the tag.
Constraints: Tag values accept a maximum of 256 letters, numbers, spaces in UTF-8, or the following characters: + - = . _ : / @
dnsName (string) –
The DNS name of your Lightsail load balancer.
state (string) –
The status of your load balancer. Valid values are below.
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 justHTTP
.publicPorts (list) –
An array of public port settings for your load balancer. For HTTP, use port 80. For HTTPS, use port 443.
(integer) –
healthCheckPath (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.
instancePort (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.
instanceHealthSummary (list) –
An array of InstanceHealthSummary objects describing the health of the load balancer.
(dict) –
Describes information about the health of the instance.
instanceName (string) –
The name of the Lightsail instance for which you are requesting health check data.
instanceHealth (string) –
Describes the overall instance health. Valid values are below.
instanceHealthReason (string) –
More information about the instance health. If the
instanceHealth
ishealthy
, then aninstanceHealthReason
value is not provided.If
instanceHealth
isinitial
, theinstanceHealthReason
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
isunhealthy
, theinstanceHealthReason
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
isunused
, theinstanceHealthReason
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
isdraining
, theinstanceHealthReason
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.
tlsCertificateSummaries (list) –
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.(dict) –
Provides a summary of SSL/TLS certificate metadata.
name (string) –
The name of the SSL/TLS certificate.
isAttached (boolean) –
When
true
, the SSL/TLS certificate is attached to the Lightsail load balancer.
configurationOptions (dict) –
A string to string map of the configuration options for your load balancer. Valid values are listed below.
(string) –
(string) –
ipAddressType (string) –
The IP address type of the load balancer.
The possible values are
ipv4
for IPv4 only, anddualstack
for IPv4 and IPv6.httpsRedirectionEnabled (boolean) –
A Boolean value that indicates whether HTTPS redirection is enabled for the load balancer.
tlsPolicyName (string) –
The name of the TLS security policy for the load balancer.
nextPageToken (string) –
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 thepageToken
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