2020/05/07 - Amazon Lightsail - 6 updated api methods
Changes Update lightsail client to latest version
{'portInfo': {'cidrListAliases': ['string'], 'cidrs': ['string'], 'protocol': {'icmp'}}}
Closes ports for a specific Amazon Lightsail instance.
The CloseInstancePublicPorts action supports tag-based access control via resource tags applied to the resource identified by instanceName. For more information, see the Lightsail Dev Guide.
See also: AWS API Documentation
Request Syntax
client.close_instance_public_ports( portInfo={ 'fromPort': 123, 'toPort': 123, 'protocol': 'tcp'|'all'|'udp'|'icmp', 'cidrs': [ 'string', ], 'cidrListAliases': [ 'string', ] }, instanceName='string' )
dict
[REQUIRED]
An object to describe the ports to close for the specified instance.
fromPort (integer) --
The first port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - 8 (to configure Ping)
toPort (integer) --
The last port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - -1 (to configure Ping)
protocol (string) --
The IP protocol name.
The name can be one of the following:
tcp - Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of streamed data between applications running on hosts communicating by an IP network. If you have an application that doesn't require reliable data stream service, use UDP instead.
all - All transport layer protocol types. For more general information, see Transport layer on Wikipedia.
udp - With User Datagram Protocol (UDP), computer applications can send messages (or datagrams) to other hosts on an Internet Protocol (IP) network. Prior communications are not required to set up transmission channels or data paths. Applications that don't require reliable data stream service can use UDP, which provides a connectionless datagram service that emphasizes reduced latency over reliability. If you do require reliable data stream service, use TCP instead.
icmp - Internet Control Message Protocol (ICMP) is used to send error messages and operational information indicating success or failure when communicating with an instance. For example, an error is indicated when an instance could not be reached.
cidrs (list) --
The IP address, or range of IP addresses in CIDR notation, that are allowed to connect to an instance through the ports, and the protocol. Lightsail supports IPv4 addresses.
Examples:
To allow the IP address 192.0.2.44, specify 192.0.2.44 or 192.0.2.44/32.
To allow the IP addresses 192.0.2.0 to 192.0.2.255, specify 192.0.2.0/24.
For more information about CIDR block notation, see Classless Inter-Domain Routing on Wikipedia.
(string) --
cidrListAliases (list) --
An alias that defines access for a preconfigured range of IP addresses.
The only alias currently supported is lightsail-connect, which allows IP addresses of the browser-based RDP/SSH client in the Lightsail console to connect to your instance.
(string) --
string
[REQUIRED]
The name of the instance for which to close ports.
dict
Response Syntax
{ 'operation': { 'id': 'string', 'resourceName': 'string', 'resourceType': 'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod', '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' }, 'isTerminal': True|False, 'operationDetails': 'string', 'operationType': 'DeleteKnownHostKeys'|'DeleteInstance'|'CreateInstance'|'StopInstance'|'StartInstance'|'RebootInstance'|'OpenInstancePublicPorts'|'PutInstancePublicPorts'|'CloseInstancePublicPorts'|'AllocateStaticIp'|'ReleaseStaticIp'|'AttachStaticIp'|'DetachStaticIp'|'UpdateDomainEntry'|'DeleteDomainEntry'|'CreateDomain'|'DeleteDomain'|'CreateInstanceSnapshot'|'DeleteInstanceSnapshot'|'CreateInstancesFromSnapshot'|'CreateLoadBalancer'|'DeleteLoadBalancer'|'AttachInstancesToLoadBalancer'|'DetachInstancesFromLoadBalancer'|'UpdateLoadBalancerAttribute'|'CreateLoadBalancerTlsCertificate'|'DeleteLoadBalancerTlsCertificate'|'AttachLoadBalancerTlsCertificate'|'CreateDisk'|'DeleteDisk'|'AttachDisk'|'DetachDisk'|'CreateDiskSnapshot'|'DeleteDiskSnapshot'|'CreateDiskFromSnapshot'|'CreateRelationalDatabase'|'UpdateRelationalDatabase'|'DeleteRelationalDatabase'|'CreateRelationalDatabaseFromSnapshot'|'CreateRelationalDatabaseSnapshot'|'DeleteRelationalDatabaseSnapshot'|'UpdateRelationalDatabaseParameters'|'StartRelationalDatabase'|'RebootRelationalDatabase'|'StopRelationalDatabase'|'EnableAddOn'|'DisableAddOn'|'PutAlarm'|'GetAlarms'|'DeleteAlarm'|'TestAlarm'|'CreateContactMethod'|'GetContactMethods'|'SendContactMethodVerification'|'DeleteContactMethod', 'status': 'NotStarted'|'Started'|'Failed'|'Completed'|'Succeeded', 'statusChangedAt': datetime(2015, 1, 1), 'errorCode': 'string', 'errorDetails': 'string' } }
Response Structure
(dict) --
operation (dict) --
An object that describes the result of the action, such as the status of the request, the timestamp of the request, and the resources affected by the request.
id (string) --
The ID of the operation.
resourceName (string) --
The resource name.
resourceType (string) --
The resource type.
createdAt (datetime) --
The timestamp when the operation was initialized (e.g., 1479816991.349).
location (dict) --
The AWS Region and Availability Zone.
availabilityZone (string) --
The Availability Zone. Follows the format us-east-2a (case-sensitive).
regionName (string) --
The AWS Region name.
isTerminal (boolean) --
A Boolean value indicating whether the operation is terminal.
operationDetails (string) --
Details about the operation (e.g., Debian-1GB-Ohio-1).
operationType (string) --
The type of operation.
status (string) --
The status of the operation.
statusChangedAt (datetime) --
The timestamp when the status was changed (e.g., 1479816991.349).
errorCode (string) --
The error code.
errorDetails (string) --
The error details.
{'instance': {'networking': {'ports': {'cidrListAliases': ['string'], 'cidrs': ['string'], 'protocol': {'icmp'}}}}}
Returns information about a specific Amazon Lightsail instance, which is a virtual private server.
See also: AWS API Documentation
Request Syntax
client.get_instance( instanceName='string' )
string
[REQUIRED]
The name of the instance.
dict
Response Syntax
{ 'instance': { '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' }, 'resourceType': 'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod', 'tags': [ { 'key': 'string', 'value': 'string' }, ], 'blueprintId': 'string', 'blueprintName': 'string', 'bundleId': 'string', 'addOns': [ { 'name': 'string', 'status': 'string', 'snapshotTimeOfDay': 'string', 'nextSnapshotTimeOfDay': 'string' }, ], 'isStaticIp': True|False, 'privateIpAddress': 'string', 'publicIpAddress': 'string', 'ipv6Address': 'string', 'hardware': { 'cpuCount': 123, 'disks': [ { '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' }, 'resourceType': 'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod', 'tags': [ { 'key': 'string', 'value': 'string' }, ], 'addOns': [ { 'name': 'string', 'status': 'string', 'snapshotTimeOfDay': 'string', 'nextSnapshotTimeOfDay': 'string' }, ], 'sizeInGb': 123, 'isSystemDisk': True|False, 'iops': 123, 'path': 'string', 'state': 'pending'|'error'|'available'|'in-use'|'unknown', 'attachedTo': 'string', 'isAttached': True|False, 'attachmentState': 'string', 'gbInUse': 123 }, ], 'ramSizeInGb': ... }, 'networking': { 'monthlyTransfer': { 'gbPerMonthAllocated': 123 }, 'ports': [ { 'fromPort': 123, 'toPort': 123, 'protocol': 'tcp'|'all'|'udp'|'icmp', 'accessFrom': 'string', 'accessType': 'Public'|'Private', 'commonName': 'string', 'accessDirection': 'inbound'|'outbound', 'cidrs': [ 'string', ], 'cidrListAliases': [ 'string', ] }, ] }, 'state': { 'code': 123, 'name': 'string' }, 'username': 'string', 'sshKeyName': 'string' } }
Response Structure
(dict) --
instance (dict) --
An array of key-value pairs containing information about the specified instance.
name (string) --
The name the user gave the instance (e.g., Amazon_Linux-1GB-Ohio-1).
arn (string) --
The Amazon Resource Name (ARN) of the instance (e.g., arn:aws:lightsail:us-east-2:123456789101:Instance/244ad76f-8aad-4741-809f-12345EXAMPLE).
supportCode (string) --
The support code. Include this code in your email to support when you have questions about an instance or another resource in Lightsail. This code enables our support team to look up your Lightsail information more easily.
createdAt (datetime) --
The timestamp when the instance was created (e.g., 1479734909.17).
location (dict) --
The region name and Availability Zone where the instance is located.
availabilityZone (string) --
The Availability Zone. Follows the format us-east-2a (case-sensitive).
regionName (string) --
The AWS Region name.
resourceType (string) --
The type of resource (usually Instance).
tags (list) --
The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Lightsail Dev Guide.
(dict) --
Describes a tag key and optional value assigned to an Amazon Lightsail resource.
For more information about tags in Lightsail, see the Lightsail Dev 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: + - = . _ : / @
blueprintId (string) --
The blueprint ID (e.g., os_amlinux_2016_03).
blueprintName (string) --
The friendly name of the blueprint (e.g., Amazon Linux).
bundleId (string) --
The bundle for the instance (e.g., micro_1_0).
addOns (list) --
An array of objects representing the add-ons enabled on the instance.
(dict) --
Describes an add-on that is enabled for an Amazon Lightsail resource.
name (string) --
The name of the add-on.
status (string) --
The status of the add-on.
snapshotTimeOfDay (string) --
The daily time when an automatic snapshot is created.
The time shown is in HH:00 format, and in Coordinated Universal Time (UTC).
The snapshot is automatically created between the time shown and up to 45 minutes after.
nextSnapshotTimeOfDay (string) --
The next daily time an automatic snapshot will be created.
The time shown is in HH:00 format, and in Coordinated Universal Time (UTC).
The snapshot is automatically created between the time shown and up to 45 minutes after.
isStaticIp (boolean) --
A Boolean value indicating whether this instance has a static IP assigned to it.
privateIpAddress (string) --
The private IP address of the instance.
publicIpAddress (string) --
The public IP address of the instance.
ipv6Address (string) --
The IPv6 address of the instance.
hardware (dict) --
The size of the vCPU and the amount of RAM for the instance.
cpuCount (integer) --
The number of vCPUs the instance has.
disks (list) --
The disks attached to the instance.
(dict) --
Describes a system disk or a block storage disk.
name (string) --
The unique name of the disk.
arn (string) --
The Amazon Resource Name (ARN) of the disk.
supportCode (string) --
The support code. Include this code in your email to support when you have questions about an instance or another resource in Lightsail. This code enables our support team to look up your Lightsail information more easily.
createdAt (datetime) --
The date when the disk was created.
location (dict) --
The AWS Region and Availability Zone where the disk is located.
availabilityZone (string) --
The Availability Zone. Follows the format us-east-2a (case-sensitive).
regionName (string) --
The AWS Region name.
resourceType (string) --
The Lightsail resource type (e.g., Disk).
tags (list) --
The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Lightsail Dev Guide.
(dict) --
Describes a tag key and optional value assigned to an Amazon Lightsail resource.
For more information about tags in Lightsail, see the Lightsail Dev 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: + - = . _ : / @
addOns (list) --
An array of objects representing the add-ons enabled on the disk.
(dict) --
Describes an add-on that is enabled for an Amazon Lightsail resource.
name (string) --
The name of the add-on.
status (string) --
The status of the add-on.
snapshotTimeOfDay (string) --
The daily time when an automatic snapshot is created.
The time shown is in HH:00 format, and in Coordinated Universal Time (UTC).
The snapshot is automatically created between the time shown and up to 45 minutes after.
nextSnapshotTimeOfDay (string) --
The next daily time an automatic snapshot will be created.
The time shown is in HH:00 format, and in Coordinated Universal Time (UTC).
The snapshot is automatically created between the time shown and up to 45 minutes after.
sizeInGb (integer) --
The size of the disk in GB.
isSystemDisk (boolean) --
A Boolean value indicating whether this disk is a system disk (has an operating system loaded on it).
iops (integer) --
The input/output operations per second (IOPS) of the disk.
path (string) --
The disk path.
state (string) --
Describes the status of the disk.
attachedTo (string) --
The resources to which the disk is attached.
isAttached (boolean) --
A Boolean value indicating whether the disk is attached.
attachmentState (string) --
(Deprecated) The attachment state of the disk.
gbInUse (integer) --
(Deprecated) The number of GB in use by the disk.
ramSizeInGb (float) --
The amount of RAM in GB on the instance (e.g., 1.0).
networking (dict) --
Information about the public ports and monthly data transfer rates for the instance.
monthlyTransfer (dict) --
The amount of data in GB allocated for monthly data transfers.
gbPerMonthAllocated (integer) --
The amount allocated per month (in GB).
ports (list) --
An array of key-value pairs containing information about the ports on the instance.
(dict) --
Describes information about ports for an Amazon Lightsail instance.
fromPort (integer) --
The first port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - 8 (to configure Ping)
toPort (integer) --
The last port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - -1 (to configure Ping)
protocol (string) --
The IP protocol name.
The name can be one of the following:
tcp - Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of streamed data between applications running on hosts communicating by an IP network. If you have an application that doesn't require reliable data stream service, use UDP instead.
all - All transport layer protocol types. For more general information, see Transport layer on Wikipedia.
udp - With User Datagram Protocol (UDP), computer applications can send messages (or datagrams) to other hosts on an Internet Protocol (IP) network. Prior communications are not required to set up transmission channels or data paths. Applications that don't require reliable data stream service can use UDP, which provides a connectionless datagram service that emphasizes reduced latency over reliability. If you do require reliable data stream service, use TCP instead.
icmp - Internet Control Message Protocol (ICMP) is used to send error messages and operational information indicating success or failure when communicating with an instance. For example, an error is indicated when an instance could not be reached.
accessFrom (string) --
The location from which access is allowed. For example, Anywhere (0.0.0.0/0), or Custom if a specific IP address or range of IP addresses is allowed.
accessType (string) --
The type of access ( Public or Private).
commonName (string) --
The common name of the port information.
accessDirection (string) --
The access direction ( inbound or outbound).
cidrs (list) --
The IP address, or range of IP addresses in CIDR notation, that are allowed to connect to an instance through the ports, and the protocol. Lightsail supports IPv4 addresses.
For more information about CIDR block notation, see Classless Inter-Domain Routing on Wikipedia.
(string) --
cidrListAliases (list) --
An alias that defines access for a preconfigured range of IP addresses.
The only alias currently supported is lightsail-connect, which allows IP addresses of the browser-based RDP/SSH client in the Lightsail console to connect to your instance.
(string) --
state (dict) --
The status code and the state (e.g., running) for the instance.
code (integer) --
The status code for the instance.
name (string) --
The state of the instance (e.g., running or pending).
username (string) --
The user name for connecting to the instance (e.g., ec2-user).
sshKeyName (string) --
The name of the SSH key being used to connect to the instance (e.g., LightsailDefaultKeyPair).
{'portStates': {'cidrListAliases': ['string'], 'cidrs': ['string'], 'protocol': {'icmp'}}}
Returns the firewall port states for a specific Amazon Lightsail instance, the IP addresses allowed to connect to the instance through the ports, and the protocol.
See also: AWS API Documentation
Request Syntax
client.get_instance_port_states( instanceName='string' )
string
[REQUIRED]
The name of the instance for which to return firewall port states.
dict
Response Syntax
{ 'portStates': [ { 'fromPort': 123, 'toPort': 123, 'protocol': 'tcp'|'all'|'udp'|'icmp', 'state': 'open'|'closed', 'cidrs': [ 'string', ], 'cidrListAliases': [ 'string', ] }, ] }
Response Structure
(dict) --
portStates (list) --
An array of objects that describe the firewall port states for the specified instance.
(dict) --
Describes open ports on an instance, the IP addresses allowed to connect to the instance through the ports, and the protocol.
fromPort (integer) --
The first port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - 8 (to configure Ping)
toPort (integer) --
The last port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - -1 (to configure Ping)
protocol (string) --
The IP protocol name.
The name can be one of the following:
tcp - Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of streamed data between applications running on hosts communicating by an IP network. If you have an application that doesn't require reliable data stream service, use UDP instead.
all - All transport layer protocol types. For more general information, see Transport layer on Wikipedia.
udp - With User Datagram Protocol (UDP), computer applications can send messages (or datagrams) to other hosts on an Internet Protocol (IP) network. Prior communications are not required to set up transmission channels or data paths. Applications that don't require reliable data stream service can use UDP, which provides a connectionless datagram service that emphasizes reduced latency over reliability. If you do require reliable data stream service, use TCP instead.
icmp - Internet Control Message Protocol (ICMP) is used to send error messages and operational information indicating success or failure when communicating with an instance. For example, an error is indicated when an instance could not be reached.
state (string) --
Specifies whether the instance port is open or closed.
cidrs (list) --
The IP address, or range of IP addresses in CIDR notation, that are allowed to connect to an instance through the ports, and the protocol. Lightsail supports IPv4 addresses.
For more information about CIDR block notation, see Classless Inter-Domain Routing on Wikipedia.
(string) --
cidrListAliases (list) --
An alias that defines access for a preconfigured range of IP addresses.
The only alias currently supported is lightsail-connect, which allows IP addresses of the browser-based RDP/SSH client in the Lightsail console to connect to your instance.
(string) --
{'instances': {'networking': {'ports': {'cidrListAliases': ['string'], 'cidrs': ['string'], 'protocol': {'icmp'}}}}}
Returns information about all Amazon Lightsail virtual private servers, or instances.
See also: AWS API Documentation
Request Syntax
client.get_instances( pageToken='string' )
string
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.
dict
Response Syntax
{ 'instances': [ { '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' }, 'resourceType': 'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod', 'tags': [ { 'key': 'string', 'value': 'string' }, ], 'blueprintId': 'string', 'blueprintName': 'string', 'bundleId': 'string', 'addOns': [ { 'name': 'string', 'status': 'string', 'snapshotTimeOfDay': 'string', 'nextSnapshotTimeOfDay': 'string' }, ], 'isStaticIp': True|False, 'privateIpAddress': 'string', 'publicIpAddress': 'string', 'ipv6Address': 'string', 'hardware': { 'cpuCount': 123, 'disks': [ { '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' }, 'resourceType': 'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod', 'tags': [ { 'key': 'string', 'value': 'string' }, ], 'addOns': [ { 'name': 'string', 'status': 'string', 'snapshotTimeOfDay': 'string', 'nextSnapshotTimeOfDay': 'string' }, ], 'sizeInGb': 123, 'isSystemDisk': True|False, 'iops': 123, 'path': 'string', 'state': 'pending'|'error'|'available'|'in-use'|'unknown', 'attachedTo': 'string', 'isAttached': True|False, 'attachmentState': 'string', 'gbInUse': 123 }, ], 'ramSizeInGb': ... }, 'networking': { 'monthlyTransfer': { 'gbPerMonthAllocated': 123 }, 'ports': [ { 'fromPort': 123, 'toPort': 123, 'protocol': 'tcp'|'all'|'udp'|'icmp', 'accessFrom': 'string', 'accessType': 'Public'|'Private', 'commonName': 'string', 'accessDirection': 'inbound'|'outbound', 'cidrs': [ 'string', ], 'cidrListAliases': [ 'string', ] }, ] }, 'state': { 'code': 123, 'name': 'string' }, 'username': 'string', 'sshKeyName': 'string' }, ], 'nextPageToken': 'string' }
Response Structure
(dict) --
instances (list) --
An array of key-value pairs containing information about your instances.
(dict) --
Describes an instance (a virtual private server).
name (string) --
The name the user gave the instance (e.g., Amazon_Linux-1GB-Ohio-1).
arn (string) --
The Amazon Resource Name (ARN) of the instance (e.g., arn:aws:lightsail:us-east-2:123456789101:Instance/244ad76f-8aad-4741-809f-12345EXAMPLE).
supportCode (string) --
The support code. Include this code in your email to support when you have questions about an instance or another resource in Lightsail. This code enables our support team to look up your Lightsail information more easily.
createdAt (datetime) --
The timestamp when the instance was created (e.g., 1479734909.17).
location (dict) --
The region name and Availability Zone where the instance is located.
availabilityZone (string) --
The Availability Zone. Follows the format us-east-2a (case-sensitive).
regionName (string) --
The AWS Region name.
resourceType (string) --
The type of resource (usually Instance).
tags (list) --
The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Lightsail Dev Guide.
(dict) --
Describes a tag key and optional value assigned to an Amazon Lightsail resource.
For more information about tags in Lightsail, see the Lightsail Dev 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: + - = . _ : / @
blueprintId (string) --
The blueprint ID (e.g., os_amlinux_2016_03).
blueprintName (string) --
The friendly name of the blueprint (e.g., Amazon Linux).
bundleId (string) --
The bundle for the instance (e.g., micro_1_0).
addOns (list) --
An array of objects representing the add-ons enabled on the instance.
(dict) --
Describes an add-on that is enabled for an Amazon Lightsail resource.
name (string) --
The name of the add-on.
status (string) --
The status of the add-on.
snapshotTimeOfDay (string) --
The daily time when an automatic snapshot is created.
The time shown is in HH:00 format, and in Coordinated Universal Time (UTC).
The snapshot is automatically created between the time shown and up to 45 minutes after.
nextSnapshotTimeOfDay (string) --
The next daily time an automatic snapshot will be created.
The time shown is in HH:00 format, and in Coordinated Universal Time (UTC).
The snapshot is automatically created between the time shown and up to 45 minutes after.
isStaticIp (boolean) --
A Boolean value indicating whether this instance has a static IP assigned to it.
privateIpAddress (string) --
The private IP address of the instance.
publicIpAddress (string) --
The public IP address of the instance.
ipv6Address (string) --
The IPv6 address of the instance.
hardware (dict) --
The size of the vCPU and the amount of RAM for the instance.
cpuCount (integer) --
The number of vCPUs the instance has.
disks (list) --
The disks attached to the instance.
(dict) --
Describes a system disk or a block storage disk.
name (string) --
The unique name of the disk.
arn (string) --
The Amazon Resource Name (ARN) of the disk.
supportCode (string) --
The support code. Include this code in your email to support when you have questions about an instance or another resource in Lightsail. This code enables our support team to look up your Lightsail information more easily.
createdAt (datetime) --
The date when the disk was created.
location (dict) --
The AWS Region and Availability Zone where the disk is located.
availabilityZone (string) --
The Availability Zone. Follows the format us-east-2a (case-sensitive).
regionName (string) --
The AWS Region name.
resourceType (string) --
The Lightsail resource type (e.g., Disk).
tags (list) --
The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Lightsail Dev Guide.
(dict) --
Describes a tag key and optional value assigned to an Amazon Lightsail resource.
For more information about tags in Lightsail, see the Lightsail Dev 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: + - = . _ : / @
addOns (list) --
An array of objects representing the add-ons enabled on the disk.
(dict) --
Describes an add-on that is enabled for an Amazon Lightsail resource.
name (string) --
The name of the add-on.
status (string) --
The status of the add-on.
snapshotTimeOfDay (string) --
The daily time when an automatic snapshot is created.
The time shown is in HH:00 format, and in Coordinated Universal Time (UTC).
The snapshot is automatically created between the time shown and up to 45 minutes after.
nextSnapshotTimeOfDay (string) --
The next daily time an automatic snapshot will be created.
The time shown is in HH:00 format, and in Coordinated Universal Time (UTC).
The snapshot is automatically created between the time shown and up to 45 minutes after.
sizeInGb (integer) --
The size of the disk in GB.
isSystemDisk (boolean) --
A Boolean value indicating whether this disk is a system disk (has an operating system loaded on it).
iops (integer) --
The input/output operations per second (IOPS) of the disk.
path (string) --
The disk path.
state (string) --
Describes the status of the disk.
attachedTo (string) --
The resources to which the disk is attached.
isAttached (boolean) --
A Boolean value indicating whether the disk is attached.
attachmentState (string) --
(Deprecated) The attachment state of the disk.
gbInUse (integer) --
(Deprecated) The number of GB in use by the disk.
ramSizeInGb (float) --
The amount of RAM in GB on the instance (e.g., 1.0).
networking (dict) --
Information about the public ports and monthly data transfer rates for the instance.
monthlyTransfer (dict) --
The amount of data in GB allocated for monthly data transfers.
gbPerMonthAllocated (integer) --
The amount allocated per month (in GB).
ports (list) --
An array of key-value pairs containing information about the ports on the instance.
(dict) --
Describes information about ports for an Amazon Lightsail instance.
fromPort (integer) --
The first port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - 8 (to configure Ping)
toPort (integer) --
The last port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - -1 (to configure Ping)
protocol (string) --
The IP protocol name.
The name can be one of the following:
tcp - Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of streamed data between applications running on hosts communicating by an IP network. If you have an application that doesn't require reliable data stream service, use UDP instead.
all - All transport layer protocol types. For more general information, see Transport layer on Wikipedia.
udp - With User Datagram Protocol (UDP), computer applications can send messages (or datagrams) to other hosts on an Internet Protocol (IP) network. Prior communications are not required to set up transmission channels or data paths. Applications that don't require reliable data stream service can use UDP, which provides a connectionless datagram service that emphasizes reduced latency over reliability. If you do require reliable data stream service, use TCP instead.
icmp - Internet Control Message Protocol (ICMP) is used to send error messages and operational information indicating success or failure when communicating with an instance. For example, an error is indicated when an instance could not be reached.
accessFrom (string) --
The location from which access is allowed. For example, Anywhere (0.0.0.0/0), or Custom if a specific IP address or range of IP addresses is allowed.
accessType (string) --
The type of access ( Public or Private).
commonName (string) --
The common name of the port information.
accessDirection (string) --
The access direction ( inbound or outbound).
cidrs (list) --
The IP address, or range of IP addresses in CIDR notation, that are allowed to connect to an instance through the ports, and the protocol. Lightsail supports IPv4 addresses.
For more information about CIDR block notation, see Classless Inter-Domain Routing on Wikipedia.
(string) --
cidrListAliases (list) --
An alias that defines access for a preconfigured range of IP addresses.
The only alias currently supported is lightsail-connect, which allows IP addresses of the browser-based RDP/SSH client in the Lightsail console to connect to your instance.
(string) --
state (dict) --
The status code and the state (e.g., running) for the instance.
code (integer) --
The status code for the instance.
name (string) --
The state of the instance (e.g., running or pending).
username (string) --
The user name for connecting to the instance (e.g., ec2-user).
sshKeyName (string) --
The name of the SSH key being used to connect to the instance (e.g., LightsailDefaultKeyPair).
nextPageToken (string) --
The token to advance to the next page of resutls 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.
{'portInfo': {'cidrListAliases': ['string'], 'cidrs': ['string'], 'protocol': {'icmp'}}}
Opens ports for a specific Amazon Lightsail instance, and specifies the IP addresses allowed to connect to the instance through the ports, and the protocol.
The OpenInstancePublicPorts action supports tag-based access control via resource tags applied to the resource identified by instanceName. For more information, see the Lightsail Dev Guide.
See also: AWS API Documentation
Request Syntax
client.open_instance_public_ports( portInfo={ 'fromPort': 123, 'toPort': 123, 'protocol': 'tcp'|'all'|'udp'|'icmp', 'cidrs': [ 'string', ], 'cidrListAliases': [ 'string', ] }, instanceName='string' )
dict
[REQUIRED]
An object to describe the ports to open for the specified instance.
fromPort (integer) --
The first port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - 8 (to configure Ping)
toPort (integer) --
The last port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - -1 (to configure Ping)
protocol (string) --
The IP protocol name.
The name can be one of the following:
tcp - Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of streamed data between applications running on hosts communicating by an IP network. If you have an application that doesn't require reliable data stream service, use UDP instead.
all - All transport layer protocol types. For more general information, see Transport layer on Wikipedia.
udp - With User Datagram Protocol (UDP), computer applications can send messages (or datagrams) to other hosts on an Internet Protocol (IP) network. Prior communications are not required to set up transmission channels or data paths. Applications that don't require reliable data stream service can use UDP, which provides a connectionless datagram service that emphasizes reduced latency over reliability. If you do require reliable data stream service, use TCP instead.
icmp - Internet Control Message Protocol (ICMP) is used to send error messages and operational information indicating success or failure when communicating with an instance. For example, an error is indicated when an instance could not be reached.
cidrs (list) --
The IP address, or range of IP addresses in CIDR notation, that are allowed to connect to an instance through the ports, and the protocol. Lightsail supports IPv4 addresses.
Examples:
To allow the IP address 192.0.2.44, specify 192.0.2.44 or 192.0.2.44/32.
To allow the IP addresses 192.0.2.0 to 192.0.2.255, specify 192.0.2.0/24.
For more information about CIDR block notation, see Classless Inter-Domain Routing on Wikipedia.
(string) --
cidrListAliases (list) --
An alias that defines access for a preconfigured range of IP addresses.
The only alias currently supported is lightsail-connect, which allows IP addresses of the browser-based RDP/SSH client in the Lightsail console to connect to your instance.
(string) --
string
[REQUIRED]
The name of the instance for which to open ports.
dict
Response Syntax
{ 'operation': { 'id': 'string', 'resourceName': 'string', 'resourceType': 'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod', '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' }, 'isTerminal': True|False, 'operationDetails': 'string', 'operationType': 'DeleteKnownHostKeys'|'DeleteInstance'|'CreateInstance'|'StopInstance'|'StartInstance'|'RebootInstance'|'OpenInstancePublicPorts'|'PutInstancePublicPorts'|'CloseInstancePublicPorts'|'AllocateStaticIp'|'ReleaseStaticIp'|'AttachStaticIp'|'DetachStaticIp'|'UpdateDomainEntry'|'DeleteDomainEntry'|'CreateDomain'|'DeleteDomain'|'CreateInstanceSnapshot'|'DeleteInstanceSnapshot'|'CreateInstancesFromSnapshot'|'CreateLoadBalancer'|'DeleteLoadBalancer'|'AttachInstancesToLoadBalancer'|'DetachInstancesFromLoadBalancer'|'UpdateLoadBalancerAttribute'|'CreateLoadBalancerTlsCertificate'|'DeleteLoadBalancerTlsCertificate'|'AttachLoadBalancerTlsCertificate'|'CreateDisk'|'DeleteDisk'|'AttachDisk'|'DetachDisk'|'CreateDiskSnapshot'|'DeleteDiskSnapshot'|'CreateDiskFromSnapshot'|'CreateRelationalDatabase'|'UpdateRelationalDatabase'|'DeleteRelationalDatabase'|'CreateRelationalDatabaseFromSnapshot'|'CreateRelationalDatabaseSnapshot'|'DeleteRelationalDatabaseSnapshot'|'UpdateRelationalDatabaseParameters'|'StartRelationalDatabase'|'RebootRelationalDatabase'|'StopRelationalDatabase'|'EnableAddOn'|'DisableAddOn'|'PutAlarm'|'GetAlarms'|'DeleteAlarm'|'TestAlarm'|'CreateContactMethod'|'GetContactMethods'|'SendContactMethodVerification'|'DeleteContactMethod', 'status': 'NotStarted'|'Started'|'Failed'|'Completed'|'Succeeded', 'statusChangedAt': datetime(2015, 1, 1), 'errorCode': 'string', 'errorDetails': 'string' } }
Response Structure
(dict) --
operation (dict) --
An array of objects that describe the result of the action, such as the status of the request, the timestamp of the request, and the resources affected by the request.
id (string) --
The ID of the operation.
resourceName (string) --
The resource name.
resourceType (string) --
The resource type.
createdAt (datetime) --
The timestamp when the operation was initialized (e.g., 1479816991.349).
location (dict) --
The AWS Region and Availability Zone.
availabilityZone (string) --
The Availability Zone. Follows the format us-east-2a (case-sensitive).
regionName (string) --
The AWS Region name.
isTerminal (boolean) --
A Boolean value indicating whether the operation is terminal.
operationDetails (string) --
Details about the operation (e.g., Debian-1GB-Ohio-1).
operationType (string) --
The type of operation.
status (string) --
The status of the operation.
statusChangedAt (datetime) --
The timestamp when the status was changed (e.g., 1479816991.349).
errorCode (string) --
The error code.
errorDetails (string) --
The error details.
{'portInfos': {'cidrListAliases': ['string'], 'cidrs': ['string'], 'protocol': {'icmp'}}}
Opens ports for a specific Amazon Lightsail instance, and specifies the IP addresses allowed to connect to the instance through the ports, and the protocol. This action also closes all currently open ports that are not included in the request. Include all of the ports and the protocols you want to open in your PutInstancePublicPorts``request. Or use the ``OpenInstancePublicPorts action to open ports without closing currently open ports.
The PutInstancePublicPorts action supports tag-based access control via resource tags applied to the resource identified by instanceName. For more information, see the Lightsail Dev Guide.
See also: AWS API Documentation
Request Syntax
client.put_instance_public_ports( portInfos=[ { 'fromPort': 123, 'toPort': 123, 'protocol': 'tcp'|'all'|'udp'|'icmp', 'cidrs': [ 'string', ], 'cidrListAliases': [ 'string', ] }, ], instanceName='string' )
list
[REQUIRED]
An array of objects to describe the ports to open for the specified instance.
(dict) --
Describes ports to open on an instance, the IP addresses allowed to connect to the instance through the ports, and the protocol.
fromPort (integer) --
The first port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - 8 (to configure Ping)
toPort (integer) --
The last port in a range of open ports on an instance.
Allowed ports:
TCP and UDP - 0 to 65535
ICMP - -1 (to configure Ping)
protocol (string) --
The IP protocol name.
The name can be one of the following:
tcp - Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of streamed data between applications running on hosts communicating by an IP network. If you have an application that doesn't require reliable data stream service, use UDP instead.
all - All transport layer protocol types. For more general information, see Transport layer on Wikipedia.
udp - With User Datagram Protocol (UDP), computer applications can send messages (or datagrams) to other hosts on an Internet Protocol (IP) network. Prior communications are not required to set up transmission channels or data paths. Applications that don't require reliable data stream service can use UDP, which provides a connectionless datagram service that emphasizes reduced latency over reliability. If you do require reliable data stream service, use TCP instead.
icmp - Internet Control Message Protocol (ICMP) is used to send error messages and operational information indicating success or failure when communicating with an instance. For example, an error is indicated when an instance could not be reached.
cidrs (list) --
The IP address, or range of IP addresses in CIDR notation, that are allowed to connect to an instance through the ports, and the protocol. Lightsail supports IPv4 addresses.
Examples:
To allow the IP address 192.0.2.44, specify 192.0.2.44 or 192.0.2.44/32.
To allow the IP addresses 192.0.2.0 to 192.0.2.255, specify 192.0.2.0/24.
For more information about CIDR block notation, see Classless Inter-Domain Routing on Wikipedia.
(string) --
cidrListAliases (list) --
An alias that defines access for a preconfigured range of IP addresses.
The only alias currently supported is lightsail-connect, which allows IP addresses of the browser-based RDP/SSH client in the Lightsail console to connect to your instance.
(string) --
string
[REQUIRED]
The name of the instance for which to open ports.
dict
Response Syntax
{ 'operation': { 'id': 'string', 'resourceName': 'string', 'resourceType': 'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod', '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' }, 'isTerminal': True|False, 'operationDetails': 'string', 'operationType': 'DeleteKnownHostKeys'|'DeleteInstance'|'CreateInstance'|'StopInstance'|'StartInstance'|'RebootInstance'|'OpenInstancePublicPorts'|'PutInstancePublicPorts'|'CloseInstancePublicPorts'|'AllocateStaticIp'|'ReleaseStaticIp'|'AttachStaticIp'|'DetachStaticIp'|'UpdateDomainEntry'|'DeleteDomainEntry'|'CreateDomain'|'DeleteDomain'|'CreateInstanceSnapshot'|'DeleteInstanceSnapshot'|'CreateInstancesFromSnapshot'|'CreateLoadBalancer'|'DeleteLoadBalancer'|'AttachInstancesToLoadBalancer'|'DetachInstancesFromLoadBalancer'|'UpdateLoadBalancerAttribute'|'CreateLoadBalancerTlsCertificate'|'DeleteLoadBalancerTlsCertificate'|'AttachLoadBalancerTlsCertificate'|'CreateDisk'|'DeleteDisk'|'AttachDisk'|'DetachDisk'|'CreateDiskSnapshot'|'DeleteDiskSnapshot'|'CreateDiskFromSnapshot'|'CreateRelationalDatabase'|'UpdateRelationalDatabase'|'DeleteRelationalDatabase'|'CreateRelationalDatabaseFromSnapshot'|'CreateRelationalDatabaseSnapshot'|'DeleteRelationalDatabaseSnapshot'|'UpdateRelationalDatabaseParameters'|'StartRelationalDatabase'|'RebootRelationalDatabase'|'StopRelationalDatabase'|'EnableAddOn'|'DisableAddOn'|'PutAlarm'|'GetAlarms'|'DeleteAlarm'|'TestAlarm'|'CreateContactMethod'|'GetContactMethods'|'SendContactMethodVerification'|'DeleteContactMethod', 'status': 'NotStarted'|'Started'|'Failed'|'Completed'|'Succeeded', 'statusChangedAt': datetime(2015, 1, 1), 'errorCode': 'string', 'errorDetails': 'string' } }
Response Structure
(dict) --
operation (dict) --
An array of objects that describe the result of the action, such as the status of the request, the timestamp of the request, and the resources affected by the request.
id (string) --
The ID of the operation.
resourceName (string) --
The resource name.
resourceType (string) --
The resource type.
createdAt (datetime) --
The timestamp when the operation was initialized (e.g., 1479816991.349).
location (dict) --
The AWS Region and Availability Zone.
availabilityZone (string) --
The Availability Zone. Follows the format us-east-2a (case-sensitive).
regionName (string) --
The AWS Region name.
isTerminal (boolean) --
A Boolean value indicating whether the operation is terminal.
operationDetails (string) --
Details about the operation (e.g., Debian-1GB-Ohio-1).
operationType (string) --
The type of operation.
status (string) --
The status of the operation.
statusChangedAt (datetime) --
The timestamp when the status was changed (e.g., 1479816991.349).
errorCode (string) --
The error code.
errorDetails (string) --
The error details.