GetInstances - Amazon Lightsail


Returns information about all Amazon Lightsail virtual private servers, or instances.

Request Syntax

{ "pageToken": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.


The token to advance to the next page of results from your request.

To get a page token, perform an initial GetInstances 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.

Type: String

Required: No

Response Syntax

{ "instances": [ { "addOns": [ { "duration": "string", "name": "string", "nextSnapshotTimeOfDay": "string", "snapshotTimeOfDay": "string", "status": "string", "threshold": "string" } ], "arn": "string", "blueprintId": "string", "blueprintName": "string", "bundleId": "string", "createdAt": number, "hardware": { "cpuCount": number, "disks": [ { "addOns": [ { "duration": "string", "name": "string", "nextSnapshotTimeOfDay": "string", "snapshotTimeOfDay": "string", "status": "string", "threshold": "string" } ], "arn": "string", "attachedTo": "string", "attachmentState": "string", "autoMountStatus": "string", "createdAt": number, "gbInUse": number, "iops": number, "isAttached": boolean, "isSystemDisk": boolean, "location": { "availabilityZone": "string", "regionName": "string" }, "name": "string", "path": "string", "resourceType": "string", "sizeInGb": number, "state": "string", "supportCode": "string", "tags": [ { "key": "string", "value": "string" } ] } ], "ramSizeInGb": number }, "ipAddressType": "string", "ipv6Addresses": [ "string" ], "isStaticIp": boolean, "location": { "availabilityZone": "string", "regionName": "string" }, "metadataOptions": { "httpEndpoint": "string", "httpProtocolIpv6": "string", "httpPutResponseHopLimit": number, "httpTokens": "string", "state": "string" }, "name": "string", "networking": { "monthlyTransfer": { "gbPerMonthAllocated": number }, "ports": [ { "accessDirection": "string", "accessFrom": "string", "accessType": "string", "cidrListAliases": [ "string" ], "cidrs": [ "string" ], "commonName": "string", "fromPort": number, "ipv6Cidrs": [ "string" ], "protocol": "string", "toPort": number } ] }, "privateIpAddress": "string", "publicIpAddress": "string", "resourceType": "string", "sshKeyName": "string", "state": { "code": number, "name": "string" }, "supportCode": "string", "tags": [ { "key": "string", "value": "string" } ], "username": "string" } ], "nextPageToken": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.


An array of key-value pairs containing information about your instances.

Type: Array of Instance objects


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 GetInstances request and specify the next page token using the pageToken parameter.

Type: String


For information about the errors that are common to all actions, see Common Errors.


Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.

HTTP Status Code: 400


Lightsail throws this exception when an account is still in the setup in progress state.

HTTP Status Code: 400


Lightsail throws this exception when user input does not conform to the validation rules of an input field.


Domain and distribution APIs are only available in the N. Virginia (us-east-1) AWS Region. Please set your AWS Region configuration to us-east-1 to create, view, or edit these resources.

HTTP Status Code: 400


Lightsail throws this exception when it cannot find a resource.

HTTP Status Code: 400


Lightsail throws this exception when an operation fails to execute.

HTTP Status Code: 400


A general service exception.

HTTP Status Code: 500


Lightsail throws this exception when the user has not been authenticated.

HTTP Status Code: 400


In the following example or examples, the Authorization header contents (AUTHPARAMS) must be replaced with an AWS Signature Version 4 signature. For more information about creating these signatures, see Signature Version 4 Signing Process in the AWS General Reference.

You need to learn how to sign HTTP requests only if you intend to manually create them. When you use the AWS Command Line Interface (AWS CLI) or one of the AWS SDKs to make requests to AWS, these tools automatically sign the requests for you with the access key that you specify when you configure the tools. When you use these tools, you don't need to learn how to sign requests yourself.

Get instances

The following example returns all instances in the us-west-2 AWS Region.

Sample Request

POST / HTTP/1.1 Host: Accept-Encoding: identity X-Amz-Target: Lightsail_20161128.GetInstances Content-Type: application/x-amz-json-1.1 User-Agent: AGENT X-Amz-Date: 20201019T144314Z Authorization: AUTHPARAMS Signature=AUTHPARAMS Content-Length: 2 {}

Sample Response

HTTP/1.1 200 OK Server: Server Date: Mon, 19 Oct 2020 14:43:17 GMT Content-Type: application/x-amz-json-1.1 Content-Length: 2750 x-amzn-RequestId: aaa1993d-8d60-4a13-899c-bEXAMPLE9bc7 Connection: keep-alive { "instances": [ { "addOns": [ { "name": "AutoSnapshot", "snapshotTimeOfDay": "06:00", "status": "Enabled" } ], "arn": "arn:aws:lightsail:us-west-2:111122223333:Instance/93d19bc4-bd2a-4deb-9048-4EXAMPLE4236", "blueprintId": "wordpress_5_1_1_2", "blueprintName": "WordPress", "bundleId": "micro_2_0", "createdAt": 1.590771192493E9, "hardware": { "cpuCount": 1, "disks": [ { "attachedTo": "WordPress-1", "attachmentState": "attached", "createdAt": 1.590771192493E9, "iops": 120, "isSystemDisk": true, "path": "/dev/sda1", "sizeInGb": 40 } ], "ramSizeInGb": 1.0 }, "isStaticIp": true, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "name": "WordPress-1", "networking": { "monthlyTransfer": {"gbPerMonthAllocated": 2048}, "ports": [ { "accessDirection": "inbound", "accessFrom": "Anywhere (", "accessType": "public", "cidrListAliases": [], "cidrs": [""], "commonName": "", "fromPort": 80, "protocol": "tcp", "toPort": 80 }, { "accessDirection": "inbound", "accessFrom": "Anywhere (", "accessType": "public", "cidrListAliases": [], "cidrs": [""], "commonName": "", "fromPort": 22, "protocol": "tcp", "toPort": 22 }, { "accessDirection": "inbound", "accessFrom": "Anywhere (", "accessType": "public", "cidrListAliases": [], "cidrs": [""], "commonName": "", "fromPort": 443, "protocol": "tcp", "toPort": 443 } ] }, "privateIpAddress": "", "publicIpAddress": "", "resourceType": "Instance", "sshKeyName": "LightsailDefaultKeyPair", "state": { "code": 16, "name": "running" }, "supportCode": "1234567890/i-0dEXAMPLE1abad00e", "tags": [], "username": "bitnami" }, { "arn": "arn:aws:lightsail:us-west-2:111122223333:Instance/bd08b156-5c35-4b89-9e90-8EXAMPLEd006", "blueprintId": "amazon_linux", "blueprintName": "Amazon Linux", "bundleId": "nano_2_0", "createdAt": 1.591802416964E9, "hardware": { "cpuCount": 1, "disks": [ { "attachedTo": "Amazon_Linux-1", "attachmentState": "attached", "createdAt": 1.591802416964E9, "iops": 100, "isSystemDisk": true, "path": "/dev/xvda", "sizeInGb": 20 } ], "ramSizeInGb": 0.5 }, "isStaticIp": true, "location": { "availabilityZone": "us-west-2a", "regionName": "us-west-2" }, "name": "Amazon_Linux-1", "networking": { "monthlyTransfer": {"gbPerMonthAllocated": 1024}, "ports": [ { "accessDirection": "inbound", "accessFrom": "Anywhere (", "accessType": "public", "cidrListAliases": [], "cidrs": [""], "commonName": "", "fromPort": 80, "protocol": "tcp", "toPort": 80 }, { "accessDirection": "inbound", "accessFrom": "Anywhere (", "accessType": "public", "cidrListAliases": [], "cidrs": [""], "commonName": "", "fromPort": 22, "protocol": "tcp", "toPort": 22 } ] }, "privateIpAddress": "", "publicIpAddress": "", "resourceType": "Instance", "sshKeyName": "LightsailDefaultKeyPair", "state": { "code": 16, "name": "running" }, "supportCode": "1234567890/i-0dEXAMPLE1abad00e", "tags": [], "username": "ec2-user" } ] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: