Amazon Lightsail

2024/05/21 - Amazon Lightsail - 14 updated api methods

Changes  This release adds support for Amazon Lightsail instances to switch between dual-stack or IPv4 only and IPv6-only public IP address types.

CloseInstancePublicPorts (updated) Link ¶
Changes (request)
{'portInfo': {'protocol': {'icmpv6'}}}

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 Amazon Lightsail Developer Guide.

See also: AWS API Documentation

Request Syntax

client.close_instance_public_ports(
    portInfo={
        'fromPort': 123,
        'toPort': 123,
        'protocol': 'tcp'|'all'|'udp'|'icmp'|'icmpv6',
        'cidrs': [
            'string',
        ],
        'ipv6Cidrs': [
            'string',
        ],
        'cidrListAliases': [
            'string',
        ]
    },
    instanceName='string'
)
type portInfo

dict

param portInfo

[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 - The ICMP type for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

    • ICMPv6 - The ICMP type for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

  • toPort (integer) --

    The last port in a range of open ports on an instance.

    Allowed ports:

    • TCP and UDP - 0 to 65535

    • ICMP - The ICMP code for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

    • ICMPv6 - The ICMP code for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

  • 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. When you specify icmp as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

    • icmp6 - Internet Control Message Protocol (ICMP) for IPv6. When you specify icmp6 as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

  • cidrs (list) --

    The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

    Note

    The ipv6Cidrs parameter lists the IPv6 addresses that are allowed to connect to an instance.

    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) --

  • ipv6Cidrs (list) --

    The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol. Only devices with an IPv6 address can connect to an instance through IPv6; otherwise, IPv4 should be used.

    Note

    The cidrs parameter lists the IPv4 addresses that are allowed to connect to an instance.

    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) --

type instanceName

string

param instanceName

[REQUIRED]

The name of the instance for which to close ports.

rtype

dict

returns

Response Syntax

{
    'operation': {
        'id': 'string',
        'resourceName': 'string',
        'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
        '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'
        },
        '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'|'CreateDistribution'|'UpdateDistribution'|'DeleteDistribution'|'ResetDistributionCache'|'AttachCertificateToDistribution'|'DetachCertificateFromDistribution'|'UpdateDistributionBundle'|'SetIpAddressType'|'CreateCertificate'|'DeleteCertificate'|'CreateContainerService'|'UpdateContainerService'|'DeleteContainerService'|'CreateContainerServiceDeployment'|'CreateContainerServiceRegistryLogin'|'RegisterContainerImage'|'DeleteContainerImage'|'CreateBucket'|'DeleteBucket'|'CreateBucketAccessKey'|'DeleteBucketAccessKey'|'UpdateBucketBundle'|'UpdateBucket'|'SetResourceAccessForBucket'|'UpdateInstanceMetadataOptions'|'StartGUISession'|'StopGUISession'|'SetupInstanceHttps',
        '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 ( 1479816991.349 ).

      • location (dict) --

        The Amazon Web Services Region and Availability Zone.

        • availabilityZone (string) --

          The Availability Zone. Follows the format us-east-2a (case-sensitive).

        • regionName (string) --

          The Amazon Web Services Region name.

      • isTerminal (boolean) --

        A Boolean value indicating whether the operation is terminal.

      • operationDetails (string) --

        Details about the operation ( 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 ( 1479816991.349 ).

      • errorCode (string) --

        The error code.

      • errorDetails (string) --

        The error details.

CreateDistribution (updated) Link ¶
Changes (request, response)
Request
{'ipAddressType': {'ipv6'}}
Response
{'distribution': {'ipAddressType': {'ipv6'}}}

Creates an Amazon Lightsail content delivery network (CDN) distribution.

A distribution is a globally distributed network of caching servers that improve the performance of your website or web application hosted on a Lightsail instance. For more information, see Content delivery networks in Amazon Lightsail.

See also: AWS API Documentation

Request Syntax

client.create_distribution(
    distributionName='string',
    origin={
        'name': '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',
        'protocolPolicy': 'http-only'|'https-only',
        'responseTimeout': 123
    },
    defaultCacheBehavior={
        'behavior': 'dont-cache'|'cache'
    },
    cacheBehaviorSettings={
        'defaultTTL': 123,
        'minimumTTL': 123,
        'maximumTTL': 123,
        'allowedHTTPMethods': 'string',
        'cachedHTTPMethods': 'string',
        'forwardedCookies': {
            'option': 'none'|'allow-list'|'all',
            'cookiesAllowList': [
                'string',
            ]
        },
        'forwardedHeaders': {
            'option': 'none'|'allow-list'|'all',
            'headersAllowList': [
                'Accept'|'Accept-Charset'|'Accept-Datetime'|'Accept-Encoding'|'Accept-Language'|'Authorization'|'CloudFront-Forwarded-Proto'|'CloudFront-Is-Desktop-Viewer'|'CloudFront-Is-Mobile-Viewer'|'CloudFront-Is-SmartTV-Viewer'|'CloudFront-Is-Tablet-Viewer'|'CloudFront-Viewer-Country'|'Host'|'Origin'|'Referer',
            ]
        },
        'forwardedQueryStrings': {
            'option': True|False,
            'queryStringsAllowList': [
                'string',
            ]
        }
    },
    cacheBehaviors=[
        {
            'path': 'string',
            'behavior': 'dont-cache'|'cache'
        },
    ],
    bundleId='string',
    ipAddressType='dualstack'|'ipv4'|'ipv6',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    certificateName='string',
    viewerMinimumTlsProtocolVersion='TLSv1.1_2016'|'TLSv1.2_2018'|'TLSv1.2_2019'|'TLSv1.2_2021'
)
type distributionName

string

param distributionName

[REQUIRED]

The name for the distribution.

type origin

dict

param origin

[REQUIRED]

An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.

The distribution pulls, caches, and serves content from the origin.

  • name (string) --

    The name of the origin resource.

  • regionName (string) --

    The AWS Region name of the origin resource.

  • protocolPolicy (string) --

    The protocol that your Amazon Lightsail distribution uses when establishing a connection with your origin to pull content.

  • responseTimeout (integer) --

    The amount of time, in seconds, that the distribution waits for a response after forwarding a request to the origin. The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don't specify otherwise) is 30 seconds.

type defaultCacheBehavior

dict

param defaultCacheBehavior

[REQUIRED]

An object that describes the default cache behavior for the distribution.

  • behavior (string) --

    The cache behavior of the distribution.

    The following cache behaviors can be specified:

    • cache - This option is best for static sites. When specified, your distribution caches and serves your entire website as static content. This behavior is ideal for websites with static content that doesn't change depending on who views it, or for websites that don't use cookies, headers, or query strings to personalize content.

    • dont-cache - This option is best for sites that serve a mix of static and dynamic content. When specified, your distribution caches and serve only the content that is specified in the distribution's CacheBehaviorPerPath parameter. This behavior is ideal for websites or web applications that use cookies, headers, and query strings to personalize content for individual users.

type cacheBehaviorSettings

dict

param cacheBehaviorSettings

An object that describes the cache behavior settings for the distribution.

  • defaultTTL (integer) --

    The default amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the content has been updated.

    Note

    The value specified applies only when the origin does not add HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects.

  • minimumTTL (integer) --

    The minimum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.

    A value of 0 must be specified for minimumTTL if the distribution is configured to forward all headers to the origin.

  • maximumTTL (integer) --

    The maximum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.

    The value specified applies only when the origin adds HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects.

  • allowedHTTPMethods (string) --

    The HTTP methods that are processed and forwarded to the distribution's origin.

    You can specify the following options:

    • GET,HEAD - The distribution forwards the GET and HEAD methods.

    • GET,HEAD,OPTIONS - The distribution forwards the GET , HEAD , and OPTIONS methods.

    • GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE - The distribution forwards the GET , HEAD , OPTIONS , PUT , PATCH , POST , and DELETE methods.

    If you specify the third option, you might need to restrict access to your distribution's origin so users can't perform operations that you don't want them to. For example, you might not want users to have permission to delete objects from your origin.

  • cachedHTTPMethods (string) --

    The HTTP method responses that are cached by your distribution.

    You can specify the following options:

    • GET,HEAD - The distribution caches responses to the GET and HEAD methods.

    • GET,HEAD,OPTIONS - The distribution caches responses to the GET , HEAD , and OPTIONS methods.

  • forwardedCookies (dict) --

    An object that describes the cookies that are forwarded to the origin. Your content is cached based on the cookies that are forwarded.

    • option (string) --

      Specifies which cookies to forward to the distribution's origin for a cache behavior: all , none , or allow-list to forward only the cookies specified in the cookiesAllowList parameter.

    • cookiesAllowList (list) --

      The specific cookies to forward to your distribution's origin.

      • (string) --

  • forwardedHeaders (dict) --

    An object that describes the headers that are forwarded to the origin. Your content is cached based on the headers that are forwarded.

    • option (string) --

      The headers that you want your distribution to forward to your origin and base caching on.

      You can configure your distribution to do one of the following:

      • all - Forward all headers to your origin.

      • none - Forward only the default headers.

      • allow-list - Forward only the headers you specify using the headersAllowList parameter.

    • headersAllowList (list) --

      The specific headers to forward to your distribution's origin.

      • (string) --

  • forwardedQueryStrings (dict) --

    An object that describes the query strings that are forwarded to the origin. Your content is cached based on the query strings that are forwarded.

    • option (boolean) --

      Indicates whether the distribution forwards and caches based on query strings.

    • queryStringsAllowList (list) --

      The specific query strings that the distribution forwards to the origin.

      Your distribution will cache content based on the specified query strings.

      If the option parameter is true, then your distribution forwards all query strings, regardless of what you specify using the queryStringsAllowList parameter.

      • (string) --

type cacheBehaviors

list

param cacheBehaviors

An array of objects that describe the per-path cache behavior for the distribution.

  • (dict) --

    Describes the per-path cache behavior of an Amazon Lightsail content delivery network (CDN) distribution.

    A per-path cache behavior is used to override, or add an exception to, the default cache behavior of a distribution. For example, if the cacheBehavior is set to cache , then a per-path cache behavior can be used to specify a directory, file, or file type that your distribution will cache. Alternately, if the distribution's cacheBehavior is dont-cache , then a per-path cache behavior can be used to specify a directory, file, or file type that your distribution will not cache.

    • path (string) --

      The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard directories ( path/to/assets/* ), and file types ( *.html, *jpg, *js ). Directories and file paths are case-sensitive.

      Examples:

      • Specify the following to cache all files in the document root of an Apache web server running on a Lightsail instance. var/www/html/

      • Specify the following file to cache only the index page in the document root of an Apache web server. var/www/html/index.html

      • Specify the following to cache only the .html files in the document root of an Apache web server. var/www/html/*.html

      • Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the document root of an Apache web server. var/www/html/images/*.jpg var/www/html/images/*.png var/www/html/images/*.gif Specify the following to cache all files in the images sub-directory of the document root of an Apache web server. var/www/html/images/

    • behavior (string) --

      The cache behavior for the specified path.

      You can specify one of the following per-path cache behaviors:

      • cache - This behavior caches the specified path.

      • dont-cache - This behavior doesn't cache the specified path.

type bundleId

string

param bundleId

[REQUIRED]

The bundle ID to use for the distribution.

A distribution bundle describes the specifications of your distribution, such as the monthly cost and monthly network transfer quota.

Use the GetDistributionBundles action to get a list of distribution bundle IDs that you can specify.

type ipAddressType

string

param ipAddressType

The IP address type for the distribution.

The possible values are ipv4 for IPv4 only, and dualstack for IPv4 and IPv6.

The default value is dualstack .

type tags

list

param tags

The tag keys and optional values to add to the distribution during create.

Use the TagResource action to tag a resource after it's created.

  • (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: + - = . _ : / @

type certificateName

string

param certificateName

The name of the SSL/TLS certificate that you want to attach to the distribution.

Use the GetCertificates action to get a list of certificate names that you can specify.

type viewerMinimumTlsProtocolVersion

string

param viewerMinimumTlsProtocolVersion

The minimum TLS protocol version for the SSL/TLS certificate.

rtype

dict

returns

Response Syntax

{
    'distribution': {
        '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',
        'alternativeDomainNames': [
            'string',
        ],
        'status': 'string',
        'isEnabled': True|False,
        'domainName': 'string',
        'bundleId': 'string',
        'certificateName': 'string',
        'origin': {
            'name': 'string',
            'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
            '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',
            'protocolPolicy': 'http-only'|'https-only',
            'responseTimeout': 123
        },
        'originPublicDNS': 'string',
        'defaultCacheBehavior': {
            'behavior': 'dont-cache'|'cache'
        },
        'cacheBehaviorSettings': {
            'defaultTTL': 123,
            'minimumTTL': 123,
            'maximumTTL': 123,
            'allowedHTTPMethods': 'string',
            'cachedHTTPMethods': 'string',
            'forwardedCookies': {
                'option': 'none'|'allow-list'|'all',
                'cookiesAllowList': [
                    'string',
                ]
            },
            'forwardedHeaders': {
                'option': 'none'|'allow-list'|'all',
                'headersAllowList': [
                    'Accept'|'Accept-Charset'|'Accept-Datetime'|'Accept-Encoding'|'Accept-Language'|'Authorization'|'CloudFront-Forwarded-Proto'|'CloudFront-Is-Desktop-Viewer'|'CloudFront-Is-Mobile-Viewer'|'CloudFront-Is-SmartTV-Viewer'|'CloudFront-Is-Tablet-Viewer'|'CloudFront-Viewer-Country'|'Host'|'Origin'|'Referer',
                ]
            },
            'forwardedQueryStrings': {
                'option': True|False,
                'queryStringsAllowList': [
                    'string',
                ]
            }
        },
        'cacheBehaviors': [
            {
                'path': 'string',
                'behavior': 'dont-cache'|'cache'
            },
        ],
        'ableToUpdateBundle': True|False,
        'ipAddressType': 'dualstack'|'ipv4'|'ipv6',
        'tags': [
            {
                'key': 'string',
                'value': 'string'
            },
        ],
        'viewerMinimumTlsProtocolVersion': 'string'
    },
    'operation': {
        'id': 'string',
        'resourceName': 'string',
        'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
        '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'
        },
        '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'|'CreateDistribution'|'UpdateDistribution'|'DeleteDistribution'|'ResetDistributionCache'|'AttachCertificateToDistribution'|'DetachCertificateFromDistribution'|'UpdateDistributionBundle'|'SetIpAddressType'|'CreateCertificate'|'DeleteCertificate'|'CreateContainerService'|'UpdateContainerService'|'DeleteContainerService'|'CreateContainerServiceDeployment'|'CreateContainerServiceRegistryLogin'|'RegisterContainerImage'|'DeleteContainerImage'|'CreateBucket'|'DeleteBucket'|'CreateBucketAccessKey'|'DeleteBucketAccessKey'|'UpdateBucketBundle'|'UpdateBucket'|'SetResourceAccessForBucket'|'UpdateInstanceMetadataOptions'|'StartGUISession'|'StopGUISession'|'SetupInstanceHttps',
        'status': 'NotStarted'|'Started'|'Failed'|'Completed'|'Succeeded',
        'statusChangedAt': datetime(2015, 1, 1),
        'errorCode': 'string',
        'errorDetails': 'string'
    }
}

Response Structure

  • (dict) --

    • distribution (dict) --

      An object that describes the distribution created.

      • name (string) --

        The name of the distribution.

      • arn (string) --

        The Amazon Resource Name (ARN) of the distribution.

      • supportCode (string) --

        The support code. Include this code in your email to support when you have questions about your Lightsail distribution. This code enables our support team to look up your Lightsail information more easily.

      • createdAt (datetime) --

        The timestamp when the distribution was created.

      • location (dict) --

        An object that describes the location of the distribution, such as the Amazon Web Services Region and Availability Zone.

        Note

        Lightsail distributions are global resources that can reference an origin in any Amazon Web Services Region, and distribute its content globally. However, all distributions are located in the us-east-1 Region.

        • availabilityZone (string) --

          The Availability Zone. Follows the format us-east-2a (case-sensitive).

        • regionName (string) --

          The Amazon Web Services Region name.

      • resourceType (string) --

        The Lightsail resource type ( Distribution ).

      • alternativeDomainNames (list) --

        The alternate domain names of the distribution.

        • (string) --

      • status (string) --

        The status of the distribution.

      • isEnabled (boolean) --

        Indicates whether the distribution is enabled.

      • domainName (string) --

        The domain name of the distribution.

      • bundleId (string) --

        The ID of the bundle currently applied to the distribution.

      • certificateName (string) --

        The name of the SSL/TLS certificate attached to the distribution, if any.

      • origin (dict) --

        An object that describes the origin resource of the distribution, such as a Lightsail instance, bucket, or load balancer.

        The distribution pulls, caches, and serves content from the origin.

        • name (string) --

          The name of the origin resource.

        • resourceType (string) --

          The resource type of the origin resource (Instance ).

        • regionName (string) --

          The AWS Region name of the origin resource.

        • protocolPolicy (string) --

          The protocol that your Amazon Lightsail distribution uses when establishing a connection with your origin to pull content.

        • responseTimeout (integer) --

          The amount of time, in seconds, that the distribution waits for a response after forwarding a request to the origin. The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don't specify otherwise) is 30 seconds.

      • originPublicDNS (string) --

        The public DNS of the origin.

      • defaultCacheBehavior (dict) --

        An object that describes the default cache behavior of the distribution.

        • behavior (string) --

          The cache behavior of the distribution.

          The following cache behaviors can be specified:

          • cache - This option is best for static sites. When specified, your distribution caches and serves your entire website as static content. This behavior is ideal for websites with static content that doesn't change depending on who views it, or for websites that don't use cookies, headers, or query strings to personalize content.

          • dont-cache - This option is best for sites that serve a mix of static and dynamic content. When specified, your distribution caches and serve only the content that is specified in the distribution's CacheBehaviorPerPath parameter. This behavior is ideal for websites or web applications that use cookies, headers, and query strings to personalize content for individual users.

      • cacheBehaviorSettings (dict) --

        An object that describes the cache behavior settings of the distribution.

        • defaultTTL (integer) --

          The default amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the content has been updated.

          Note

          The value specified applies only when the origin does not add HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects.

        • minimumTTL (integer) --

          The minimum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.

          A value of 0 must be specified for minimumTTL if the distribution is configured to forward all headers to the origin.

        • maximumTTL (integer) --

          The maximum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.

          The value specified applies only when the origin adds HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects.

        • allowedHTTPMethods (string) --

          The HTTP methods that are processed and forwarded to the distribution's origin.

          You can specify the following options:

          • GET,HEAD - The distribution forwards the GET and HEAD methods.

          • GET,HEAD,OPTIONS - The distribution forwards the GET , HEAD , and OPTIONS methods.

          • GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE - The distribution forwards the GET , HEAD , OPTIONS , PUT , PATCH , POST , and DELETE methods.

          If you specify the third option, you might need to restrict access to your distribution's origin so users can't perform operations that you don't want them to. For example, you might not want users to have permission to delete objects from your origin.

        • cachedHTTPMethods (string) --

          The HTTP method responses that are cached by your distribution.

          You can specify the following options:

          • GET,HEAD - The distribution caches responses to the GET and HEAD methods.

          • GET,HEAD,OPTIONS - The distribution caches responses to the GET , HEAD , and OPTIONS methods.

        • forwardedCookies (dict) --

          An object that describes the cookies that are forwarded to the origin. Your content is cached based on the cookies that are forwarded.

          • option (string) --

            Specifies which cookies to forward to the distribution's origin for a cache behavior: all , none , or allow-list to forward only the cookies specified in the cookiesAllowList parameter.

          • cookiesAllowList (list) --

            The specific cookies to forward to your distribution's origin.

            • (string) --

        • forwardedHeaders (dict) --

          An object that describes the headers that are forwarded to the origin. Your content is cached based on the headers that are forwarded.

          • option (string) --

            The headers that you want your distribution to forward to your origin and base caching on.

            You can configure your distribution to do one of the following:

            • all - Forward all headers to your origin.

            • none - Forward only the default headers.

            • allow-list - Forward only the headers you specify using the headersAllowList parameter.

          • headersAllowList (list) --

            The specific headers to forward to your distribution's origin.

            • (string) --

        • forwardedQueryStrings (dict) --

          An object that describes the query strings that are forwarded to the origin. Your content is cached based on the query strings that are forwarded.

          • option (boolean) --

            Indicates whether the distribution forwards and caches based on query strings.

          • queryStringsAllowList (list) --

            The specific query strings that the distribution forwards to the origin.

            Your distribution will cache content based on the specified query strings.

            If the option parameter is true, then your distribution forwards all query strings, regardless of what you specify using the queryStringsAllowList parameter.

            • (string) --

      • cacheBehaviors (list) --

        An array of objects that describe the per-path cache behavior of the distribution.

        • (dict) --

          Describes the per-path cache behavior of an Amazon Lightsail content delivery network (CDN) distribution.

          A per-path cache behavior is used to override, or add an exception to, the default cache behavior of a distribution. For example, if the cacheBehavior is set to cache , then a per-path cache behavior can be used to specify a directory, file, or file type that your distribution will cache. Alternately, if the distribution's cacheBehavior is dont-cache , then a per-path cache behavior can be used to specify a directory, file, or file type that your distribution will not cache.

          • path (string) --

            The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard directories ( path/to/assets/* ), and file types ( *.html, *jpg, *js ). Directories and file paths are case-sensitive.

            Examples:

            • Specify the following to cache all files in the document root of an Apache web server running on a Lightsail instance. var/www/html/

            • Specify the following file to cache only the index page in the document root of an Apache web server. var/www/html/index.html

            • Specify the following to cache only the .html files in the document root of an Apache web server. var/www/html/*.html

            • Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the document root of an Apache web server. var/www/html/images/*.jpg var/www/html/images/*.png var/www/html/images/*.gif Specify the following to cache all files in the images sub-directory of the document root of an Apache web server. var/www/html/images/

          • behavior (string) --

            The cache behavior for the specified path.

            You can specify one of the following per-path cache behaviors:

            • cache - This behavior caches the specified path.

            • dont-cache - This behavior doesn't cache the specified path.

      • ableToUpdateBundle (boolean) --

        Indicates whether the bundle that is currently applied to your distribution, specified using the distributionName parameter, can be changed to another bundle.

        Use the UpdateDistributionBundle action to change your distribution's bundle.

      • ipAddressType (string) --

        The IP address type of the distribution.

        The possible values are ipv4 for IPv4 only, and dualstack for IPv4 and IPv6.

      • 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: + - = . _ : / @

      • viewerMinimumTlsProtocolVersion (string) --

        The minimum TLS protocol version that the distribution can use to communicate with viewers.

    • 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 ( 1479816991.349 ).

      • location (dict) --

        The Amazon Web Services Region and Availability Zone.

        • availabilityZone (string) --

          The Availability Zone. Follows the format us-east-2a (case-sensitive).

        • regionName (string) --

          The Amazon Web Services Region name.

      • isTerminal (boolean) --

        A Boolean value indicating whether the operation is terminal.

      • operationDetails (string) --

        Details about the operation ( 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 ( 1479816991.349 ).

      • errorCode (string) --

        The error code.

      • errorDetails (string) --

        The error details.

CreateInstances (updated) Link ¶
Changes (request)
{'ipAddressType': {'ipv6'}}

Creates one or more Amazon Lightsail instances.

The create instances operation supports tag-based access control via request tags. For more information, see the Lightsail Developer Guide.

See also: AWS API Documentation

Request Syntax

client.create_instances(
    instanceNames=[
        'string',
    ],
    availabilityZone='string',
    customImageName='string',
    blueprintId='string',
    bundleId='string',
    userData='string',
    keyPairName='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    addOns=[
        {
            'addOnType': 'AutoSnapshot'|'StopInstanceOnIdle',
            'autoSnapshotAddOnRequest': {
                'snapshotTimeOfDay': 'string'
            },
            'stopInstanceOnIdleRequest': {
                'threshold': 'string',
                'duration': 'string'
            }
        },
    ],
    ipAddressType='dualstack'|'ipv4'|'ipv6'
)
type instanceNames

list

param instanceNames

[REQUIRED]

The names to use for your new Lightsail instances. Separate multiple values using quotation marks and commas, for example: ["MyFirstInstance","MySecondInstance"]

  • (string) --

type availabilityZone

string

param availabilityZone

[REQUIRED]

The Availability Zone in which to create your instance. Use the following format: us-east-2a (case sensitive). You can get a list of Availability Zones by using the get regions operation. Be sure to add the include Availability Zones parameter to your request.

type customImageName

string

param customImageName

(Discontinued) The name for your custom image.

Note

In releases prior to June 12, 2017, this parameter was ignored by the API. It is now discontinued.

type blueprintId

string

param blueprintId

[REQUIRED]

The ID for a virtual private server image ( app_wordpress_x_x or app_lamp_x_x ). Use the get blueprints operation to return a list of available images (or blueprints ).

Note

Use active blueprints when creating new instances. Inactive blueprints are listed to support customers with existing instances and are not necessarily available to create new instances. Blueprints are marked inactive when they become outdated due to operating system updates or new application releases.

type bundleId

string

param bundleId

[REQUIRED]

The bundle of specification information for your virtual private server (or instance ), including the pricing plan ( medium_x_x ).

type userData

string

param userData

A launch script you can create that configures a server with additional user data. For example, you might want to run apt-get -y update .

Note

Depending on the machine image you choose, the command to get software on your instance varies. Amazon Linux and CentOS use yum , Debian and Ubuntu use apt-get , and FreeBSD uses pkg . For a complete list, see the Amazon Lightsail Developer Guide.

type keyPairName

string

param keyPairName

The name of your key pair.

type tags

list

param tags

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.

  • (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: + - = . _ : / @

type addOns

list

param addOns

An array of objects representing the add-ons to enable for the new instance.

  • (dict) --

    Describes a request to enable, modify, or disable an add-on for an Amazon Lightsail resource.

    Note

    An additional cost may be associated with enabling add-ons. For more information, see the Lightsail pricing page.

    • addOnType (string) -- [REQUIRED]

      The add-on type.

    • autoSnapshotAddOnRequest (dict) --

      An object that represents additional parameters when enabling or modifying the automatic snapshot add-on.

      • snapshotTimeOfDay (string) --

        The daily time when an automatic snapshot will be created.

        Constraints:

        • Must be in HH:00 format, and in an hourly increment.

        • Specified in Coordinated Universal Time (UTC).

        • The snapshot will be automatically created between the time specified and up to 45 minutes after.

    • stopInstanceOnIdleRequest (dict) --

      An object that represents additional parameters when enabling or modifying the StopInstanceOnIdle add-on.

      Warning

      This object only applies to Lightsail for Research resources.

      • threshold (string) --

        The value to compare with the duration.

      • duration (string) --

        The amount of idle time in minutes after which your virtual computer will automatically stop.

type ipAddressType

string

param ipAddressType

The IP address type for the instance.

The possible values are ipv4 for IPv4 only, ipv6 for IPv6 only, and dualstack for IPv4 and IPv6.

The default value is dualstack .

rtype

dict

returns

Response Syntax

{
    'operations': [
        {
            'id': 'string',
            'resourceName': 'string',
            'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
            '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'
            },
            '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'|'CreateDistribution'|'UpdateDistribution'|'DeleteDistribution'|'ResetDistributionCache'|'AttachCertificateToDistribution'|'DetachCertificateFromDistribution'|'UpdateDistributionBundle'|'SetIpAddressType'|'CreateCertificate'|'DeleteCertificate'|'CreateContainerService'|'UpdateContainerService'|'DeleteContainerService'|'CreateContainerServiceDeployment'|'CreateContainerServiceRegistryLogin'|'RegisterContainerImage'|'DeleteContainerImage'|'CreateBucket'|'DeleteBucket'|'CreateBucketAccessKey'|'DeleteBucketAccessKey'|'UpdateBucketBundle'|'UpdateBucket'|'SetResourceAccessForBucket'|'UpdateInstanceMetadataOptions'|'StartGUISession'|'StopGUISession'|'SetupInstanceHttps',
            'status': 'NotStarted'|'Started'|'Failed'|'Completed'|'Succeeded',
            'statusChangedAt': datetime(2015, 1, 1),
            'errorCode': 'string',
            'errorDetails': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • operations (list) --

      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.

      • (dict) --

        Describes the API operation.

        • 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 ( 1479816991.349 ).

        • location (dict) --

          The Amazon Web Services Region and Availability Zone.

          • availabilityZone (string) --

            The Availability Zone. Follows the format us-east-2a (case-sensitive).

          • regionName (string) --

            The Amazon Web Services Region name.

        • isTerminal (boolean) --

          A Boolean value indicating whether the operation is terminal.

        • operationDetails (string) --

          Details about the operation ( 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 ( 1479816991.349 ).

        • errorCode (string) --

          The error code.

        • errorDetails (string) --

          The error details.

CreateInstancesFromSnapshot (updated) Link ¶
Changes (request)
{'ipAddressType': {'ipv6'}}

Creates one or more new instances from a manual or automatic snapshot of an instance.

The create instances from snapshot operation supports tag-based access control via request tags and resource tags applied to the resource identified by instance snapshot name . For more information, see the Amazon Lightsail Developer Guide.

See also: AWS API Documentation

Request Syntax

client.create_instances_from_snapshot(
    instanceNames=[
        'string',
    ],
    attachedDiskMapping={
        'string': [
            {
                'originalDiskPath': 'string',
                'newDiskName': 'string'
            },
        ]
    },
    availabilityZone='string',
    instanceSnapshotName='string',
    bundleId='string',
    userData='string',
    keyPairName='string',
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    addOns=[
        {
            'addOnType': 'AutoSnapshot'|'StopInstanceOnIdle',
            'autoSnapshotAddOnRequest': {
                'snapshotTimeOfDay': 'string'
            },
            'stopInstanceOnIdleRequest': {
                'threshold': 'string',
                'duration': 'string'
            }
        },
    ],
    ipAddressType='dualstack'|'ipv4'|'ipv6',
    sourceInstanceName='string',
    restoreDate='string',
    useLatestRestorableAutoSnapshot=True|False
)
type instanceNames

list

param instanceNames

[REQUIRED]

The names for your new instances.

  • (string) --

type attachedDiskMapping

dict

param attachedDiskMapping

An object containing information about one or more disk mappings.

  • (string) --

    • (list) --

      • (dict) --

        Describes a block storage disk mapping.

        • originalDiskPath (string) --

          The original disk path exposed to the instance (for example, /dev/sdh ).

        • newDiskName (string) --

          The new disk name ( my-new-disk ).

type availabilityZone

string

param availabilityZone

[REQUIRED]

The Availability Zone where you want to create your instances. Use the following formatting: us-east-2a (case sensitive). You can get a list of Availability Zones by using the get regions operation. Be sure to add the include Availability Zones parameter to your request.

type instanceSnapshotName

string

param instanceSnapshotName

The name of the instance snapshot on which you are basing your new instances. Use the get instance snapshots operation to return information about your existing snapshots.

Constraint:

  • This parameter cannot be defined together with the source instance name parameter. The instance snapshot name and source instance name parameters are mutually exclusive.

type bundleId

string

param bundleId

[REQUIRED]

The bundle of specification information for your virtual private server (or instance ), including the pricing plan ( micro_x_x ).

type userData

string

param userData

You can create a launch script that configures a server with additional user data. For example, apt-get -y update .

Note

Depending on the machine image you choose, the command to get software on your instance varies. Amazon Linux and CentOS use yum , Debian and Ubuntu use apt-get , and FreeBSD uses pkg . For a complete list, see the Amazon Lightsail Developer Guide.

type keyPairName

string

param keyPairName

The name for your key pair.

type tags

list

param tags

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.

  • (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: + - = . _ : / @

type addOns

list

param addOns

An array of objects representing the add-ons to enable for the new instance.

  • (dict) --

    Describes a request to enable, modify, or disable an add-on for an Amazon Lightsail resource.

    Note

    An additional cost may be associated with enabling add-ons. For more information, see the Lightsail pricing page.

    • addOnType (string) -- [REQUIRED]

      The add-on type.

    • autoSnapshotAddOnRequest (dict) --

      An object that represents additional parameters when enabling or modifying the automatic snapshot add-on.

      • snapshotTimeOfDay (string) --

        The daily time when an automatic snapshot will be created.

        Constraints:

        • Must be in HH:00 format, and in an hourly increment.

        • Specified in Coordinated Universal Time (UTC).

        • The snapshot will be automatically created between the time specified and up to 45 minutes after.

    • stopInstanceOnIdleRequest (dict) --

      An object that represents additional parameters when enabling or modifying the StopInstanceOnIdle add-on.

      Warning

      This object only applies to Lightsail for Research resources.

      • threshold (string) --

        The value to compare with the duration.

      • duration (string) --

        The amount of idle time in minutes after which your virtual computer will automatically stop.

type ipAddressType

string

param ipAddressType

The IP address type for the instance.

The possible values are ipv4 for IPv4 only, ipv6 for IPv6 only, and dualstack for IPv4 and IPv6.

The default value is dualstack .

type sourceInstanceName

string

param sourceInstanceName

The name of the source instance from which the source automatic snapshot was created.

Constraints:

  • This parameter cannot be defined together with the instance snapshot name parameter. The source instance name and instance snapshot name parameters are mutually exclusive.

  • Define this parameter only when creating a new instance from an automatic snapshot. For more information, see the Amazon Lightsail Developer Guide.

type restoreDate

string

param restoreDate

The date of the automatic snapshot to use for the new instance. Use the get auto snapshots operation to identify the dates of the available automatic snapshots.

Constraints:

  • Must be specified in YYYY-MM-DD format.

  • This parameter cannot be defined together with the use latest restorable auto snapshot parameter. The restore date and use latest restorable auto snapshot parameters are mutually exclusive.

  • Define this parameter only when creating a new instance from an automatic snapshot. For more information, see the Amazon Lightsail Developer Guide.

type useLatestRestorableAutoSnapshot

boolean

param useLatestRestorableAutoSnapshot

A Boolean value to indicate whether to use the latest available automatic snapshot.

Constraints:

  • This parameter cannot be defined together with the restore date parameter. The use latest restorable auto snapshot and restore date parameters are mutually exclusive.

  • Define this parameter only when creating a new instance from an automatic snapshot. For more information, see the Amazon Lightsail Developer Guide.

rtype

dict

returns

Response Syntax

{
    'operations': [
        {
            'id': 'string',
            'resourceName': 'string',
            'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
            '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'
            },
            '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'|'CreateDistribution'|'UpdateDistribution'|'DeleteDistribution'|'ResetDistributionCache'|'AttachCertificateToDistribution'|'DetachCertificateFromDistribution'|'UpdateDistributionBundle'|'SetIpAddressType'|'CreateCertificate'|'DeleteCertificate'|'CreateContainerService'|'UpdateContainerService'|'DeleteContainerService'|'CreateContainerServiceDeployment'|'CreateContainerServiceRegistryLogin'|'RegisterContainerImage'|'DeleteContainerImage'|'CreateBucket'|'DeleteBucket'|'CreateBucketAccessKey'|'DeleteBucketAccessKey'|'UpdateBucketBundle'|'UpdateBucket'|'SetResourceAccessForBucket'|'UpdateInstanceMetadataOptions'|'StartGUISession'|'StopGUISession'|'SetupInstanceHttps',
            'status': 'NotStarted'|'Started'|'Failed'|'Completed'|'Succeeded',
            'statusChangedAt': datetime(2015, 1, 1),
            'errorCode': 'string',
            'errorDetails': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • operations (list) --

      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.

      • (dict) --

        Describes the API operation.

        • 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 ( 1479816991.349 ).

        • location (dict) --

          The Amazon Web Services Region and Availability Zone.

          • availabilityZone (string) --

            The Availability Zone. Follows the format us-east-2a (case-sensitive).

          • regionName (string) --

            The Amazon Web Services Region name.

        • isTerminal (boolean) --

          A Boolean value indicating whether the operation is terminal.

        • operationDetails (string) --

          Details about the operation ( 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 ( 1479816991.349 ).

        • errorCode (string) --

          The error code.

        • errorDetails (string) --

          The error details.

CreateLoadBalancer (updated) Link ¶
Changes (request)
{'ipAddressType': {'ipv6'}}

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 5 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.

See also: AWS API Documentation

Request Syntax

client.create_load_balancer(
    loadBalancerName='string',
    instancePort=123,
    healthCheckPath='string',
    certificateName='string',
    certificateDomainName='string',
    certificateAlternativeNames=[
        'string',
    ],
    tags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ],
    ipAddressType='dualstack'|'ipv4'|'ipv6',
    tlsPolicyName='string'
)
type loadBalancerName

string

param loadBalancerName

[REQUIRED]

The name of your load balancer.

type instancePort

integer

param instancePort

[REQUIRED]

The instance port where you're creating your load balancer.

type healthCheckPath

string

param healthCheckPath

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.

type certificateName

string

param certificateName

The name of the SSL/TLS certificate.

If you specify certificateName , then certificateDomainName is required (and vice-versa).

type certificateDomainName

string

param certificateDomainName

The domain name with which your certificate is associated ( example.com ).

If you specify certificateDomainName , then certificateName is required (and vice-versa).

type certificateAlternativeNames

list

param certificateAlternativeNames

The optional alternative domains and subdomains to use with your SSL/TLS certificate ( www.example.com , example.com , m.example.com , blog.example.com ).

  • (string) --

type tags

list

param tags

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.

  • (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: + - = . _ : / @

type ipAddressType

string

param ipAddressType

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 .

type tlsPolicyName

string

param tlsPolicyName

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 .

rtype

dict

returns

Response Syntax

{
    'operations': [
        {
            'id': 'string',
            'resourceName': 'string',
            'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
            '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'
            },
            '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'|'CreateDistribution'|'UpdateDistribution'|'DeleteDistribution'|'ResetDistributionCache'|'AttachCertificateToDistribution'|'DetachCertificateFromDistribution'|'UpdateDistributionBundle'|'SetIpAddressType'|'CreateCertificate'|'DeleteCertificate'|'CreateContainerService'|'UpdateContainerService'|'DeleteContainerService'|'CreateContainerServiceDeployment'|'CreateContainerServiceRegistryLogin'|'RegisterContainerImage'|'DeleteContainerImage'|'CreateBucket'|'DeleteBucket'|'CreateBucketAccessKey'|'DeleteBucketAccessKey'|'UpdateBucketBundle'|'UpdateBucket'|'SetResourceAccessForBucket'|'UpdateInstanceMetadataOptions'|'StartGUISession'|'StopGUISession'|'SetupInstanceHttps',
            'status': 'NotStarted'|'Started'|'Failed'|'Completed'|'Succeeded',
            'statusChangedAt': datetime(2015, 1, 1),
            'errorCode': 'string',
            'errorDetails': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • operations (list) --

      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.

      • (dict) --

        Describes the API operation.

        • 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 ( 1479816991.349 ).

        • location (dict) --

          The Amazon Web Services Region and Availability Zone.

          • availabilityZone (string) --

            The Availability Zone. Follows the format us-east-2a (case-sensitive).

          • regionName (string) --

            The Amazon Web Services Region name.

        • isTerminal (boolean) --

          A Boolean value indicating whether the operation is terminal.

        • operationDetails (string) --

          Details about the operation ( 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 ( 1479816991.349 ).

        • errorCode (string) --

          The error code.

        • errorDetails (string) --

          The error details.

GetDistributions (updated) Link ¶
Changes (response)
{'distributions': {'ipAddressType': {'ipv6'}}}

Returns information about one or more of your Amazon Lightsail content delivery network (CDN) distributions.

See also: AWS API Documentation

Request Syntax

client.get_distributions(
    distributionName='string',
    pageToken='string'
)
type distributionName

string

param distributionName

The name of the distribution for which to return information.

When omitted, the response includes all of your distributions in the Amazon Web Services Region where the request is made.

type pageToken

string

param pageToken

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

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

rtype

dict

returns

Response Syntax

{
    'distributions': [
        {
            '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',
            'alternativeDomainNames': [
                'string',
            ],
            'status': 'string',
            'isEnabled': True|False,
            'domainName': 'string',
            'bundleId': 'string',
            'certificateName': 'string',
            'origin': {
                'name': 'string',
                'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
                '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',
                'protocolPolicy': 'http-only'|'https-only',
                'responseTimeout': 123
            },
            'originPublicDNS': 'string',
            'defaultCacheBehavior': {
                'behavior': 'dont-cache'|'cache'
            },
            'cacheBehaviorSettings': {
                'defaultTTL': 123,
                'minimumTTL': 123,
                'maximumTTL': 123,
                'allowedHTTPMethods': 'string',
                'cachedHTTPMethods': 'string',
                'forwardedCookies': {
                    'option': 'none'|'allow-list'|'all',
                    'cookiesAllowList': [
                        'string',
                    ]
                },
                'forwardedHeaders': {
                    'option': 'none'|'allow-list'|'all',
                    'headersAllowList': [
                        'Accept'|'Accept-Charset'|'Accept-Datetime'|'Accept-Encoding'|'Accept-Language'|'Authorization'|'CloudFront-Forwarded-Proto'|'CloudFront-Is-Desktop-Viewer'|'CloudFront-Is-Mobile-Viewer'|'CloudFront-Is-SmartTV-Viewer'|'CloudFront-Is-Tablet-Viewer'|'CloudFront-Viewer-Country'|'Host'|'Origin'|'Referer',
                    ]
                },
                'forwardedQueryStrings': {
                    'option': True|False,
                    'queryStringsAllowList': [
                        'string',
                    ]
                }
            },
            'cacheBehaviors': [
                {
                    'path': 'string',
                    'behavior': 'dont-cache'|'cache'
                },
            ],
            'ableToUpdateBundle': True|False,
            'ipAddressType': 'dualstack'|'ipv4'|'ipv6',
            'tags': [
                {
                    'key': 'string',
                    'value': 'string'
                },
            ],
            'viewerMinimumTlsProtocolVersion': 'string'
        },
    ],
    'nextPageToken': 'string'
}

Response Structure

  • (dict) --

    • distributions (list) --

      An array of objects that describe your distributions.

      • (dict) --

        Describes an Amazon Lightsail content delivery network (CDN) distribution.

        • name (string) --

          The name of the distribution.

        • arn (string) --

          The Amazon Resource Name (ARN) of the distribution.

        • supportCode (string) --

          The support code. Include this code in your email to support when you have questions about your Lightsail distribution. This code enables our support team to look up your Lightsail information more easily.

        • createdAt (datetime) --

          The timestamp when the distribution was created.

        • location (dict) --

          An object that describes the location of the distribution, such as the Amazon Web Services Region and Availability Zone.

          Note

          Lightsail distributions are global resources that can reference an origin in any Amazon Web Services Region, and distribute its content globally. However, all distributions are located in the us-east-1 Region.

          • availabilityZone (string) --

            The Availability Zone. Follows the format us-east-2a (case-sensitive).

          • regionName (string) --

            The Amazon Web Services Region name.

        • resourceType (string) --

          The Lightsail resource type ( Distribution ).

        • alternativeDomainNames (list) --

          The alternate domain names of the distribution.

          • (string) --

        • status (string) --

          The status of the distribution.

        • isEnabled (boolean) --

          Indicates whether the distribution is enabled.

        • domainName (string) --

          The domain name of the distribution.

        • bundleId (string) --

          The ID of the bundle currently applied to the distribution.

        • certificateName (string) --

          The name of the SSL/TLS certificate attached to the distribution, if any.

        • origin (dict) --

          An object that describes the origin resource of the distribution, such as a Lightsail instance, bucket, or load balancer.

          The distribution pulls, caches, and serves content from the origin.

          • name (string) --

            The name of the origin resource.

          • resourceType (string) --

            The resource type of the origin resource (Instance ).

          • regionName (string) --

            The AWS Region name of the origin resource.

          • protocolPolicy (string) --

            The protocol that your Amazon Lightsail distribution uses when establishing a connection with your origin to pull content.

          • responseTimeout (integer) --

            The amount of time, in seconds, that the distribution waits for a response after forwarding a request to the origin. The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if you don't specify otherwise) is 30 seconds.

        • originPublicDNS (string) --

          The public DNS of the origin.

        • defaultCacheBehavior (dict) --

          An object that describes the default cache behavior of the distribution.

          • behavior (string) --

            The cache behavior of the distribution.

            The following cache behaviors can be specified:

            • cache - This option is best for static sites. When specified, your distribution caches and serves your entire website as static content. This behavior is ideal for websites with static content that doesn't change depending on who views it, or for websites that don't use cookies, headers, or query strings to personalize content.

            • dont-cache - This option is best for sites that serve a mix of static and dynamic content. When specified, your distribution caches and serve only the content that is specified in the distribution's CacheBehaviorPerPath parameter. This behavior is ideal for websites or web applications that use cookies, headers, and query strings to personalize content for individual users.

        • cacheBehaviorSettings (dict) --

          An object that describes the cache behavior settings of the distribution.

          • defaultTTL (integer) --

            The default amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the content has been updated.

            Note

            The value specified applies only when the origin does not add HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects.

          • minimumTTL (integer) --

            The minimum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.

            A value of 0 must be specified for minimumTTL if the distribution is configured to forward all headers to the origin.

          • maximumTTL (integer) --

            The maximum amount of time that objects stay in the distribution's cache before the distribution forwards another request to the origin to determine whether the object has been updated.

            The value specified applies only when the origin adds HTTP headers such as Cache-Control max-age , Cache-Control s-maxage , and Expires to objects.

          • allowedHTTPMethods (string) --

            The HTTP methods that are processed and forwarded to the distribution's origin.

            You can specify the following options:

            • GET,HEAD - The distribution forwards the GET and HEAD methods.

            • GET,HEAD,OPTIONS - The distribution forwards the GET , HEAD , and OPTIONS methods.

            • GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE - The distribution forwards the GET , HEAD , OPTIONS , PUT , PATCH , POST , and DELETE methods.

            If you specify the third option, you might need to restrict access to your distribution's origin so users can't perform operations that you don't want them to. For example, you might not want users to have permission to delete objects from your origin.

          • cachedHTTPMethods (string) --

            The HTTP method responses that are cached by your distribution.

            You can specify the following options:

            • GET,HEAD - The distribution caches responses to the GET and HEAD methods.

            • GET,HEAD,OPTIONS - The distribution caches responses to the GET , HEAD , and OPTIONS methods.

          • forwardedCookies (dict) --

            An object that describes the cookies that are forwarded to the origin. Your content is cached based on the cookies that are forwarded.

            • option (string) --

              Specifies which cookies to forward to the distribution's origin for a cache behavior: all , none , or allow-list to forward only the cookies specified in the cookiesAllowList parameter.

            • cookiesAllowList (list) --

              The specific cookies to forward to your distribution's origin.

              • (string) --

          • forwardedHeaders (dict) --

            An object that describes the headers that are forwarded to the origin. Your content is cached based on the headers that are forwarded.

            • option (string) --

              The headers that you want your distribution to forward to your origin and base caching on.

              You can configure your distribution to do one of the following:

              • all - Forward all headers to your origin.

              • none - Forward only the default headers.

              • allow-list - Forward only the headers you specify using the headersAllowList parameter.

            • headersAllowList (list) --

              The specific headers to forward to your distribution's origin.

              • (string) --

          • forwardedQueryStrings (dict) --

            An object that describes the query strings that are forwarded to the origin. Your content is cached based on the query strings that are forwarded.

            • option (boolean) --

              Indicates whether the distribution forwards and caches based on query strings.

            • queryStringsAllowList (list) --

              The specific query strings that the distribution forwards to the origin.

              Your distribution will cache content based on the specified query strings.

              If the option parameter is true, then your distribution forwards all query strings, regardless of what you specify using the queryStringsAllowList parameter.

              • (string) --

        • cacheBehaviors (list) --

          An array of objects that describe the per-path cache behavior of the distribution.

          • (dict) --

            Describes the per-path cache behavior of an Amazon Lightsail content delivery network (CDN) distribution.

            A per-path cache behavior is used to override, or add an exception to, the default cache behavior of a distribution. For example, if the cacheBehavior is set to cache , then a per-path cache behavior can be used to specify a directory, file, or file type that your distribution will cache. Alternately, if the distribution's cacheBehavior is dont-cache , then a per-path cache behavior can be used to specify a directory, file, or file type that your distribution will not cache.

            • path (string) --

              The path to a directory or file to cached, or not cache. Use an asterisk symbol to specify wildcard directories ( path/to/assets/* ), and file types ( *.html, *jpg, *js ). Directories and file paths are case-sensitive.

              Examples:

              • Specify the following to cache all files in the document root of an Apache web server running on a Lightsail instance. var/www/html/

              • Specify the following file to cache only the index page in the document root of an Apache web server. var/www/html/index.html

              • Specify the following to cache only the .html files in the document root of an Apache web server. var/www/html/*.html

              • Specify the following to cache only the .jpg, .png, and .gif files in the images sub-directory of the document root of an Apache web server. var/www/html/images/*.jpg var/www/html/images/*.png var/www/html/images/*.gif Specify the following to cache all files in the images sub-directory of the document root of an Apache web server. var/www/html/images/

            • behavior (string) --

              The cache behavior for the specified path.

              You can specify one of the following per-path cache behaviors:

              • cache - This behavior caches the specified path.

              • dont-cache - This behavior doesn't cache the specified path.

        • ableToUpdateBundle (boolean) --

          Indicates whether the bundle that is currently applied to your distribution, specified using the distributionName parameter, can be changed to another bundle.

          Use the UpdateDistributionBundle action to change your distribution's bundle.

        • ipAddressType (string) --

          The IP address type of the distribution.

          The possible values are ipv4 for IPv4 only, and dualstack for IPv4 and IPv6.

        • 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: + - = . _ : / @

        • viewerMinimumTlsProtocolVersion (string) --

          The minimum TLS protocol version that the distribution can use to communicate with viewers.

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

GetInstance (updated) Link ¶
Changes (response)
{'instance': {'ipAddressType': {'ipv6'},
              'networking': {'ports': {'protocol': {'icmpv6'}}}}}

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'
)
type instanceName

string

param instanceName

[REQUIRED]

The name of the instance.

rtype

dict

returns

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'|'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'
            },
        ],
        'blueprintId': 'string',
        'blueprintName': 'string',
        'bundleId': 'string',
        'addOns': [
            {
                'name': 'string',
                'status': 'string',
                'snapshotTimeOfDay': 'string',
                'nextSnapshotTimeOfDay': 'string',
                'threshold': 'string',
                'duration': 'string'
            },
        ],
        'isStaticIp': True|False,
        'privateIpAddress': 'string',
        'publicIpAddress': 'string',
        'ipv6Addresses': [
            'string',
        ],
        'ipAddressType': 'dualstack'|'ipv4'|'ipv6',
        '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'|'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'
                        },
                    ],
                    'addOns': [
                        {
                            'name': 'string',
                            'status': 'string',
                            'snapshotTimeOfDay': 'string',
                            'nextSnapshotTimeOfDay': 'string',
                            'threshold': 'string',
                            'duration': '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,
                    'autoMountStatus': 'Failed'|'Pending'|'Mounted'|'NotMounted'
                },
            ],
            'ramSizeInGb': ...
        },
        'networking': {
            'monthlyTransfer': {
                'gbPerMonthAllocated': 123
            },
            'ports': [
                {
                    'fromPort': 123,
                    'toPort': 123,
                    'protocol': 'tcp'|'all'|'udp'|'icmp'|'icmpv6',
                    'accessFrom': 'string',
                    'accessType': 'Public'|'Private',
                    'commonName': 'string',
                    'accessDirection': 'inbound'|'outbound',
                    'cidrs': [
                        'string',
                    ],
                    'ipv6Cidrs': [
                        'string',
                    ],
                    'cidrListAliases': [
                        'string',
                    ]
                },
            ]
        },
        'state': {
            'code': 123,
            'name': 'string'
        },
        'username': 'string',
        'sshKeyName': 'string',
        'metadataOptions': {
            'state': 'pending'|'applied',
            'httpTokens': 'optional'|'required',
            'httpEndpoint': 'disabled'|'enabled',
            'httpPutResponseHopLimit': 123,
            'httpProtocolIpv6': 'disabled'|'enabled'
        }
    }
}

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 ( Amazon_Linux_2023-1 ).

      • arn (string) --

        The Amazon Resource Name (ARN) of the instance ( 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 ( 1479734909.17 ) in Unix time format.

      • 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 Amazon Web Services 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 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: + - = . _ : / @

      • blueprintId (string) --

        The blueprint ID ( amazon_linux_2023 ).

      • blueprintName (string) --

        The friendly name of the blueprint ( Amazon Linux 2023 ).

      • bundleId (string) --

        The bundle for the instance ( micro_x_x ).

      • 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.

          • threshold (string) --

            The trigger threshold of the action.

            Warning

            This add-on only applies to Lightsail for Research resources.

          • duration (string) --

            The amount of idle time in minutes after which your virtual computer will automatically stop.

            Warning

            This add-on only applies to Lightsail for Research resources.

      • 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.

      • ipv6Addresses (list) --

        The IPv6 addresses of the instance.

        • (string) --

      • ipAddressType (string) --

        The IP address type of the instance.

        The possible values are ipv4 for IPv4 only, ipv6 for IPv6 only, and dualstack for IPv4 and IPv6.

      • 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 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 Amazon Web Services Region name.

            • resourceType (string) --

              The Lightsail resource type ( Disk ).

            • 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: + - = . _ : / @

            • 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.

                • threshold (string) --

                  The trigger threshold of the action.

                  Warning

                  This add-on only applies to Lightsail for Research resources.

                • duration (string) --

                  The amount of idle time in minutes after which your virtual computer will automatically stop.

                  Warning

                  This add-on only applies to Lightsail for Research resources.

            • 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) --

              (Discontinued) The attachment state of the disk.

              Note

              In releases prior to November 14, 2017, this parameter returned attached for system disks in the API response. It is now discontinued, but still included in the response. Use isAttached instead.

            • gbInUse (integer) --

              (Discontinued) The number of GB in use by the disk.

              Note

              In releases prior to November 14, 2017, this parameter was not included in the API response. It is now discontinued.

            • autoMountStatus (string) --

              The status of automatically mounting a storage disk to a virtual computer.

              Warning

              This parameter only applies to Lightsail for Research resources.

        • ramSizeInGb (float) --

          The amount of RAM in GB on the instance ( 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 - The ICMP type for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

              • ICMPv6 - The ICMP type for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

            • toPort (integer) --

              The last port in a range of open ports on an instance.

              Allowed ports:

              • TCP and UDP - 0 to 65535

              • ICMP - The ICMP code for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

              • ICMPv6 - The ICMP code for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

            • 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. When you specify icmp as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

              • icmp6 - Internet Control Message Protocol (ICMP) for IPv6. When you specify icmp6 as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

            • 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 ).

              Note

              Lightsail currently supports only inbound access direction.

            • cidrs (list) --

              The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

              Note

              The ipv6Cidrs parameter lists the IPv6 addresses that are allowed to connect to an instance.

              For more information about CIDR block notation, see Classless Inter-Domain Routing on Wikipedia .

              • (string) --

            • ipv6Cidrs (list) --

              The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol. Only devices with an IPv6 address can connect to an instance through IPv6; otherwise, IPv4 should be used.

              Note

              The cidrs parameter lists the IPv4 addresses that are allowed to connect to an instance.

              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 ( running ) for the instance.

        • code (integer) --

          The status code for the instance.

        • name (string) --

          The state of the instance ( running or pending ).

      • username (string) --

        The user name for connecting to the instance ( ec2-user ).

      • sshKeyName (string) --

        The name of the SSH key being used to connect to the instance ( LightsailDefaultKeyPair ).

      • metadataOptions (dict) --

        The metadata options for the Amazon Lightsail instance.

        • state (string) --

          The state of the metadata option changes.

          The following states are possible:

          • pending - The metadata options are being updated. The instance is not yet ready to process metadata traffic with the new selection.

          • applied - The metadata options have been successfully applied to the instance.

        • httpTokens (string) --

          The state of token usage for your instance metadata requests.

          If the state is optional , you can choose whether to retrieve instance metadata with a signed token header on your request. If you retrieve the IAM role credentials without a token, the version 1.0 role credentials are returned. If you retrieve the IAM role credentials by using a valid signed token, the version 2.0 role credentials are returned.

          If the state is required , you must send a signed token header with all instance metadata retrieval requests. In this state, retrieving the IAM role credential always returns the version 2.0 credentials. The version 1.0 credentials are not available.

          Warning

          Not all instance blueprints in Lightsail support version 2.0 credentials. Use the MetadataNoToken instance metric to track the number of calls to the instance metadata service that are using version 1.0 credentials. For more information, see Viewing instance metrics in Amazon Lightsail in the Amazon Lightsail Developer Guide .

        • httpEndpoint (string) --

          Indicates whether the HTTP metadata endpoint on your instances is enabled or disabled.

          If the value is disabled , you cannot access your instance metadata.

        • httpPutResponseHopLimit (integer) --

          The desired HTTP PUT response hop limit for instance metadata requests. A larger number means that the instance metadata requests can travel farther.

        • httpProtocolIpv6 (string) --

          Indicates whether the IPv6 endpoint for the instance metadata service is enabled or disabled.

GetInstancePortStates (updated) Link ¶
Changes (response)
{'portStates': {'protocol': {'icmpv6'}}}

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'
)
type instanceName

string

param instanceName

[REQUIRED]

The name of the instance for which to return firewall port states.

rtype

dict

returns

Response Syntax

{
    'portStates': [
        {
            'fromPort': 123,
            'toPort': 123,
            'protocol': 'tcp'|'all'|'udp'|'icmp'|'icmpv6',
            'state': 'open'|'closed',
            'cidrs': [
                'string',
            ],
            'ipv6Cidrs': [
                '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 - The ICMP type for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

          • ICMPv6 - The ICMP type for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

        • toPort (integer) --

          The last port in a range of open ports on an instance.

          Allowed ports:

          • TCP and UDP - 0 to 65535

          • ICMP - The ICMP code for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

          • ICMPv6 - The ICMP code for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

        • 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. When you specify icmp as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

          • icmp6 - Internet Control Message Protocol (ICMP) for IPv6. When you specify icmp6 as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

        • state (string) --

          Specifies whether the instance port is open or closed .

          Note

          The port state for Lightsail instances is always open .

        • cidrs (list) --

          The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

          Note

          The ipv6Cidrs parameter lists the IPv6 addresses that are allowed to connect to an instance.

          For more information about CIDR block notation, see Classless Inter-Domain Routing on Wikipedia .

          • (string) --

        • ipv6Cidrs (list) --

          The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol. Only devices with an IPv6 address can connect to an instance through IPv6; otherwise, IPv4 should be used.

          Note

          The cidrs parameter lists the IPv4 addresses that are allowed to connect to an instance.

          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) --

GetInstances (updated) Link ¶
Changes (response)
{'instances': {'ipAddressType': {'ipv6'},
               'networking': {'ports': {'protocol': {'icmpv6'}}}}}

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

See also: AWS API Documentation

Request Syntax

client.get_instances(
    pageToken='string'
)
type pageToken

string

param pageToken

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.

rtype

dict

returns

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'|'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'
                },
            ],
            'blueprintId': 'string',
            'blueprintName': 'string',
            'bundleId': 'string',
            'addOns': [
                {
                    'name': 'string',
                    'status': 'string',
                    'snapshotTimeOfDay': 'string',
                    'nextSnapshotTimeOfDay': 'string',
                    'threshold': 'string',
                    'duration': 'string'
                },
            ],
            'isStaticIp': True|False,
            'privateIpAddress': 'string',
            'publicIpAddress': 'string',
            'ipv6Addresses': [
                'string',
            ],
            'ipAddressType': 'dualstack'|'ipv4'|'ipv6',
            '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'|'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'
                            },
                        ],
                        'addOns': [
                            {
                                'name': 'string',
                                'status': 'string',
                                'snapshotTimeOfDay': 'string',
                                'nextSnapshotTimeOfDay': 'string',
                                'threshold': 'string',
                                'duration': '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,
                        'autoMountStatus': 'Failed'|'Pending'|'Mounted'|'NotMounted'
                    },
                ],
                'ramSizeInGb': ...
            },
            'networking': {
                'monthlyTransfer': {
                    'gbPerMonthAllocated': 123
                },
                'ports': [
                    {
                        'fromPort': 123,
                        'toPort': 123,
                        'protocol': 'tcp'|'all'|'udp'|'icmp'|'icmpv6',
                        'accessFrom': 'string',
                        'accessType': 'Public'|'Private',
                        'commonName': 'string',
                        'accessDirection': 'inbound'|'outbound',
                        'cidrs': [
                            'string',
                        ],
                        'ipv6Cidrs': [
                            'string',
                        ],
                        'cidrListAliases': [
                            'string',
                        ]
                    },
                ]
            },
            'state': {
                'code': 123,
                'name': 'string'
            },
            'username': 'string',
            'sshKeyName': 'string',
            'metadataOptions': {
                'state': 'pending'|'applied',
                'httpTokens': 'optional'|'required',
                'httpEndpoint': 'disabled'|'enabled',
                'httpPutResponseHopLimit': 123,
                'httpProtocolIpv6': 'disabled'|'enabled'
            }
        },
    ],
    '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 ( Amazon_Linux_2023-1 ).

        • arn (string) --

          The Amazon Resource Name (ARN) of the instance ( 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 ( 1479734909.17 ) in Unix time format.

        • 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 Amazon Web Services 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 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: + - = . _ : / @

        • blueprintId (string) --

          The blueprint ID ( amazon_linux_2023 ).

        • blueprintName (string) --

          The friendly name of the blueprint ( Amazon Linux 2023 ).

        • bundleId (string) --

          The bundle for the instance ( micro_x_x ).

        • 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.

            • threshold (string) --

              The trigger threshold of the action.

              Warning

              This add-on only applies to Lightsail for Research resources.

            • duration (string) --

              The amount of idle time in minutes after which your virtual computer will automatically stop.

              Warning

              This add-on only applies to Lightsail for Research resources.

        • 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.

        • ipv6Addresses (list) --

          The IPv6 addresses of the instance.

          • (string) --

        • ipAddressType (string) --

          The IP address type of the instance.

          The possible values are ipv4 for IPv4 only, ipv6 for IPv6 only, and dualstack for IPv4 and IPv6.

        • 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 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 Amazon Web Services Region name.

              • resourceType (string) --

                The Lightsail resource type ( Disk ).

              • 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: + - = . _ : / @

              • 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.

                  • threshold (string) --

                    The trigger threshold of the action.

                    Warning

                    This add-on only applies to Lightsail for Research resources.

                  • duration (string) --

                    The amount of idle time in minutes after which your virtual computer will automatically stop.

                    Warning

                    This add-on only applies to Lightsail for Research resources.

              • 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) --

                (Discontinued) The attachment state of the disk.

                Note

                In releases prior to November 14, 2017, this parameter returned attached for system disks in the API response. It is now discontinued, but still included in the response. Use isAttached instead.

              • gbInUse (integer) --

                (Discontinued) The number of GB in use by the disk.

                Note

                In releases prior to November 14, 2017, this parameter was not included in the API response. It is now discontinued.

              • autoMountStatus (string) --

                The status of automatically mounting a storage disk to a virtual computer.

                Warning

                This parameter only applies to Lightsail for Research resources.

          • ramSizeInGb (float) --

            The amount of RAM in GB on the instance ( 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 - The ICMP type for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

                • ICMPv6 - The ICMP type for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

              • toPort (integer) --

                The last port in a range of open ports on an instance.

                Allowed ports:

                • TCP and UDP - 0 to 65535

                • ICMP - The ICMP code for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

                • ICMPv6 - The ICMP code for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

              • 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. When you specify icmp as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

                • icmp6 - Internet Control Message Protocol (ICMP) for IPv6. When you specify icmp6 as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

              • 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 ).

                Note

                Lightsail currently supports only inbound access direction.

              • cidrs (list) --

                The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

                Note

                The ipv6Cidrs parameter lists the IPv6 addresses that are allowed to connect to an instance.

                For more information about CIDR block notation, see Classless Inter-Domain Routing on Wikipedia .

                • (string) --

              • ipv6Cidrs (list) --

                The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol. Only devices with an IPv6 address can connect to an instance through IPv6; otherwise, IPv4 should be used.

                Note

                The cidrs parameter lists the IPv4 addresses that are allowed to connect to an instance.

                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 ( running ) for the instance.

          • code (integer) --

            The status code for the instance.

          • name (string) --

            The state of the instance ( running or pending ).

        • username (string) --

          The user name for connecting to the instance ( ec2-user ).

        • sshKeyName (string) --

          The name of the SSH key being used to connect to the instance ( LightsailDefaultKeyPair ).

        • metadataOptions (dict) --

          The metadata options for the Amazon Lightsail instance.

          • state (string) --

            The state of the metadata option changes.

            The following states are possible:

            • pending - The metadata options are being updated. The instance is not yet ready to process metadata traffic with the new selection.

            • applied - The metadata options have been successfully applied to the instance.

          • httpTokens (string) --

            The state of token usage for your instance metadata requests.

            If the state is optional , you can choose whether to retrieve instance metadata with a signed token header on your request. If you retrieve the IAM role credentials without a token, the version 1.0 role credentials are returned. If you retrieve the IAM role credentials by using a valid signed token, the version 2.0 role credentials are returned.

            If the state is required , you must send a signed token header with all instance metadata retrieval requests. In this state, retrieving the IAM role credential always returns the version 2.0 credentials. The version 1.0 credentials are not available.

            Warning

            Not all instance blueprints in Lightsail support version 2.0 credentials. Use the MetadataNoToken instance metric to track the number of calls to the instance metadata service that are using version 1.0 credentials. For more information, see Viewing instance metrics in Amazon Lightsail in the Amazon Lightsail Developer Guide .

          • httpEndpoint (string) --

            Indicates whether the HTTP metadata endpoint on your instances is enabled or disabled.

            If the value is disabled , you cannot access your instance metadata.

          • httpPutResponseHopLimit (integer) --

            The desired HTTP PUT response hop limit for instance metadata requests. A larger number means that the instance metadata requests can travel farther.

          • httpProtocolIpv6 (string) --

            Indicates whether the IPv6 endpoint for the instance metadata service is enabled or disabled.

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

GetLoadBalancer (updated) Link ¶
Changes (response)
{'loadBalancer': {'ipAddressType': {'ipv6'}}}

Returns information about the specified Lightsail load balancer.

See also: AWS API Documentation

Request Syntax

client.get_load_balancer(
    loadBalancerName='string'
)
type loadBalancerName

string

param loadBalancerName

[REQUIRED]

The name of the load balancer.

rtype

dict

returns

Response Syntax

{
    'loadBalancer': {
        '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'|'ipv6',
        'httpsRedirectionEnabled': True|False,
        'tlsPolicyName': 'string'
    }
}

Response Structure

  • (dict) --

    • loadBalancer (dict) --

      An object containing information about your 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 just HTTP .

      • 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 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.

      • 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, ipv6 for IPv6 only, and dualstack 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.

GetLoadBalancers (updated) Link ¶
Changes (response)
{'loadBalancers': {'ipAddressType': {'ipv6'}}}

Returns information about all load balancers in an account.

See also: AWS API Documentation

Request Syntax

client.get_load_balancers(
    pageToken='string'
)
type pageToken

string

param pageToken

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.

rtype

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'|'ipv6',
            '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 just HTTP .

        • 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 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.

        • 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, ipv6 for IPv6 only, and dualstack 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 the pageToken parameter.

OpenInstancePublicPorts (updated) Link ¶
Changes (request)
{'portInfo': {'protocol': {'icmpv6'}}}

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 Amazon Lightsail Developer Guide.

See also: AWS API Documentation

Request Syntax

client.open_instance_public_ports(
    portInfo={
        'fromPort': 123,
        'toPort': 123,
        'protocol': 'tcp'|'all'|'udp'|'icmp'|'icmpv6',
        'cidrs': [
            'string',
        ],
        'ipv6Cidrs': [
            'string',
        ],
        'cidrListAliases': [
            'string',
        ]
    },
    instanceName='string'
)
type portInfo

dict

param portInfo

[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 - The ICMP type for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

    • ICMPv6 - The ICMP type for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

  • toPort (integer) --

    The last port in a range of open ports on an instance.

    Allowed ports:

    • TCP and UDP - 0 to 65535

    • ICMP - The ICMP code for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

    • ICMPv6 - The ICMP code for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

  • 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. When you specify icmp as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

    • icmp6 - Internet Control Message Protocol (ICMP) for IPv6. When you specify icmp6 as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

  • cidrs (list) --

    The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

    Note

    The ipv6Cidrs parameter lists the IPv6 addresses that are allowed to connect to an instance.

    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) --

  • ipv6Cidrs (list) --

    The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol. Only devices with an IPv6 address can connect to an instance through IPv6; otherwise, IPv4 should be used.

    Note

    The cidrs parameter lists the IPv4 addresses that are allowed to connect to an instance.

    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) --

type instanceName

string

param instanceName

[REQUIRED]

The name of the instance for which to open ports.

rtype

dict

returns

Response Syntax

{
    'operation': {
        'id': 'string',
        'resourceName': 'string',
        'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
        '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'
        },
        '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'|'CreateDistribution'|'UpdateDistribution'|'DeleteDistribution'|'ResetDistributionCache'|'AttachCertificateToDistribution'|'DetachCertificateFromDistribution'|'UpdateDistributionBundle'|'SetIpAddressType'|'CreateCertificate'|'DeleteCertificate'|'CreateContainerService'|'UpdateContainerService'|'DeleteContainerService'|'CreateContainerServiceDeployment'|'CreateContainerServiceRegistryLogin'|'RegisterContainerImage'|'DeleteContainerImage'|'CreateBucket'|'DeleteBucket'|'CreateBucketAccessKey'|'DeleteBucketAccessKey'|'UpdateBucketBundle'|'UpdateBucket'|'SetResourceAccessForBucket'|'UpdateInstanceMetadataOptions'|'StartGUISession'|'StopGUISession'|'SetupInstanceHttps',
        '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 ( 1479816991.349 ).

      • location (dict) --

        The Amazon Web Services Region and Availability Zone.

        • availabilityZone (string) --

          The Availability Zone. Follows the format us-east-2a (case-sensitive).

        • regionName (string) --

          The Amazon Web Services Region name.

      • isTerminal (boolean) --

        A Boolean value indicating whether the operation is terminal.

      • operationDetails (string) --

        Details about the operation ( 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 ( 1479816991.349 ).

      • errorCode (string) --

        The error code.

      • errorDetails (string) --

        The error details.

PutInstancePublicPorts (updated) Link ¶
Changes (request)
{'portInfos': {'protocol': {'icmpv6'}}}

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 Amazon Lightsail Developer Guide.

See also: AWS API Documentation

Request Syntax

client.put_instance_public_ports(
    portInfos=[
        {
            'fromPort': 123,
            'toPort': 123,
            'protocol': 'tcp'|'all'|'udp'|'icmp'|'icmpv6',
            'cidrs': [
                'string',
            ],
            'ipv6Cidrs': [
                'string',
            ],
            'cidrListAliases': [
                'string',
            ]
        },
    ],
    instanceName='string'
)
type portInfos

list

param portInfos

[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 - The ICMP type for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

      • ICMPv6 - The ICMP type for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

    • toPort (integer) --

      The last port in a range of open ports on an instance.

      Allowed ports:

      • TCP and UDP - 0 to 65535

      • ICMP - The ICMP code for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. For more information, see Control Messages on Wikipedia .

      • ICMPv6 - The ICMP code for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code). For more information, see Internet Control Message Protocol for IPv6.

    • 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. When you specify icmp as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

      • icmp6 - Internet Control Message Protocol (ICMP) for IPv6. When you specify icmp6 as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

    • cidrs (list) --

      The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

      Note

      The ipv6Cidrs parameter lists the IPv6 addresses that are allowed to connect to an instance.

      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) --

    • ipv6Cidrs (list) --

      The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol. Only devices with an IPv6 address can connect to an instance through IPv6; otherwise, IPv4 should be used.

      Note

      The cidrs parameter lists the IPv4 addresses that are allowed to connect to an instance.

      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) --

type instanceName

string

param instanceName

[REQUIRED]

The name of the instance for which to open ports.

rtype

dict

returns

Response Syntax

{
    'operation': {
        'id': 'string',
        'resourceName': 'string',
        'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
        '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'
        },
        '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'|'CreateDistribution'|'UpdateDistribution'|'DeleteDistribution'|'ResetDistributionCache'|'AttachCertificateToDistribution'|'DetachCertificateFromDistribution'|'UpdateDistributionBundle'|'SetIpAddressType'|'CreateCertificate'|'DeleteCertificate'|'CreateContainerService'|'UpdateContainerService'|'DeleteContainerService'|'CreateContainerServiceDeployment'|'CreateContainerServiceRegistryLogin'|'RegisterContainerImage'|'DeleteContainerImage'|'CreateBucket'|'DeleteBucket'|'CreateBucketAccessKey'|'DeleteBucketAccessKey'|'UpdateBucketBundle'|'UpdateBucket'|'SetResourceAccessForBucket'|'UpdateInstanceMetadataOptions'|'StartGUISession'|'StopGUISession'|'SetupInstanceHttps',
        '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 ( 1479816991.349 ).

      • location (dict) --

        The Amazon Web Services Region and Availability Zone.

        • availabilityZone (string) --

          The Availability Zone. Follows the format us-east-2a (case-sensitive).

        • regionName (string) --

          The Amazon Web Services Region name.

      • isTerminal (boolean) --

        A Boolean value indicating whether the operation is terminal.

      • operationDetails (string) --

        Details about the operation ( 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 ( 1479816991.349 ).

      • errorCode (string) --

        The error code.

      • errorDetails (string) --

        The error details.

SetIpAddressType (updated) Link ¶
Changes (request)
{'acceptBundleUpdate': 'boolean', 'ipAddressType': {'ipv6'}}

Sets the IP address type for an Amazon Lightsail resource.

Use this action to enable dual-stack for a resource, which enables IPv4 and IPv6 for the specified resource. Alternately, you can use this action to disable dual-stack, and enable IPv4 only.

See also: AWS API Documentation

Request Syntax

client.set_ip_address_type(
    resourceType='ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
    resourceName='string',
    ipAddressType='dualstack'|'ipv4'|'ipv6',
    acceptBundleUpdate=True|False
)
type resourceType

string

param resourceType

[REQUIRED]

The resource type.

The resource values are Distribution , Instance , and LoadBalancer .

Note

Distribution-related APIs are available only in the N. Virginia ( us-east-1 ) Amazon Web Services Region. Set your Amazon Web Services Region configuration to us-east-1 to create, view, or edit distributions.

type resourceName

string

param resourceName

[REQUIRED]

The name of the resource for which to set the IP address type.

type ipAddressType

string

param ipAddressType

[REQUIRED]

The IP address type to set for the specified resource.

The possible values are ipv4 for IPv4 only, ipv6 for IPv6 only, and dualstack for IPv4 and IPv6.

type acceptBundleUpdate

boolean

param acceptBundleUpdate

Required parameter to accept the instance bundle update when changing to, and from, IPv6-only.

Note

An instance bundle will change when switching from dual-stack or ipv4 , to ipv6 . It also changes when switching from ipv6 , to dual-stack or ipv4 .

You must include this parameter in the command to update the bundle. For example, if you switch from dual-stack to ipv6 , the bundle will be updated, and billing for the IPv6-only instance bundle begins immediately.

rtype

dict

returns

Response Syntax

{
    'operations': [
        {
            'id': 'string',
            'resourceName': 'string',
            'resourceType': 'ContainerService'|'Instance'|'StaticIp'|'KeyPair'|'InstanceSnapshot'|'Domain'|'PeeredVpc'|'LoadBalancer'|'LoadBalancerTlsCertificate'|'Disk'|'DiskSnapshot'|'RelationalDatabase'|'RelationalDatabaseSnapshot'|'ExportSnapshotRecord'|'CloudFormationStackRecord'|'Alarm'|'ContactMethod'|'Distribution'|'Certificate'|'Bucket',
            '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'
            },
            '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'|'CreateDistribution'|'UpdateDistribution'|'DeleteDistribution'|'ResetDistributionCache'|'AttachCertificateToDistribution'|'DetachCertificateFromDistribution'|'UpdateDistributionBundle'|'SetIpAddressType'|'CreateCertificate'|'DeleteCertificate'|'CreateContainerService'|'UpdateContainerService'|'DeleteContainerService'|'CreateContainerServiceDeployment'|'CreateContainerServiceRegistryLogin'|'RegisterContainerImage'|'DeleteContainerImage'|'CreateBucket'|'DeleteBucket'|'CreateBucketAccessKey'|'DeleteBucketAccessKey'|'UpdateBucketBundle'|'UpdateBucket'|'SetResourceAccessForBucket'|'UpdateInstanceMetadataOptions'|'StartGUISession'|'StopGUISession'|'SetupInstanceHttps',
            'status': 'NotStarted'|'Started'|'Failed'|'Completed'|'Succeeded',
            'statusChangedAt': datetime(2015, 1, 1),
            'errorCode': 'string',
            'errorDetails': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • operations (list) --

      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.

      • (dict) --

        Describes the API operation.

        • 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 ( 1479816991.349 ).

        • location (dict) --

          The Amazon Web Services Region and Availability Zone.

          • availabilityZone (string) --

            The Availability Zone. Follows the format us-east-2a (case-sensitive).

          • regionName (string) --

            The Amazon Web Services Region name.

        • isTerminal (boolean) --

          A Boolean value indicating whether the operation is terminal.

        • operationDetails (string) --

          Details about the operation ( 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 ( 1479816991.349 ).

        • errorCode (string) --

          The error code.

        • errorDetails (string) --

          The error details.