You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::Lightsail::Client

Inherits:
Seahorse::Client::Base show all
Defined in:
(unknown)

Overview

An API client for Amazon Lightsail. To construct a client, you need to configure a :region and :credentials.

lightsail = Aws::Lightsail::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

See #initialize for a full list of supported configuration options.

Region

You can configure a default region in the following locations:

  • ENV['AWS_REGION']
  • Aws.config[:region]

Go here for a list of supported regions.

Credentials

Default credentials are loaded automatically from the following locations:

  • ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY']
  • Aws.config[:credentials]
  • The shared credentials ini file at ~/.aws/credentials (more information)
  • From an instance profile when running on EC2

You can also construct a credentials object from one of the following classes:

Alternatively, you configure credentials with :access_key_id and :secret_access_key:

# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))

Aws::Lightsail::Client.new(
  access_key_id: creds['access_key_id'],
  secret_access_key: creds['secret_access_key']
)

Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

Constructor collapse

API Operations collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Base

add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options = {}) ⇒ Aws::Lightsail::Client

Constructs an API client.

Options Hash (options):

  • :access_key_id (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types. See Plugins::ParamConverter for more details.

  • :credentials (required, Credentials)

    Your AWS credentials. The following locations will be searched in order for credentials:

    • :access_key_id, :secret_access_key, and :session_token options
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • HOME/.aws/credentials shared credentials file
    • EC2 instance profile credentials See Plugins::RequestSigner for more details.
  • :endpoint (String)

    A default endpoint is constructed from the :region. See Plugins::RegionalEndpoint for more details.

  • :http_continue_timeout (Float) — default: 1

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_idle_timeout (Integer) — default: 5

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_open_timeout (Integer) — default: 15

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_proxy (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_read_timeout (Integer) — default: 60

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_wire_trace (Boolean) — default: false

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the logger at. See Plugins::Logging for more details.

  • :log_formatter (Logging::LogFormatter)

    The log formatter. Defaults to Seahorse::Client::Logging::Formatter.default. See Plugins::Logging for more details.

  • :logger (Logger) — default: nil

    The Logger instance to send log messages to. If this option is not set, logging will be disabled. See Plugins::Logging for more details.

  • :profile (String)

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used. See Plugins::RequestSigner for more details.

  • :raise_response_errors (Boolean) — default: true

    When true, response errors are raised. See Seahorse::Client::Plugins::RaiseResponseErrors for more details.

  • :region (required, String)

    The AWS region to connect to. The region is used to construct the client endpoint. Defaults to ENV['AWS_REGION']. Also checks AMAZON_REGION and AWS_DEFAULT_REGION. See Plugins::RegionalEndpoint for more details.

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials. See Plugins::RetryErrors for more details.

  • :secret_access_key (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :session_token (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :simple_json (Boolean) — default: false

    Disables request parameter conversion, validation, and formatting. Also disable response data type conversions. This option is useful when you want to ensure the highest level of performance by avoiding overhead of walking request parameters and response data structures.

    When :simple_json is enabled, the request parameters hash must be formatted exactly as the DynamoDB API expects. See Plugins::Protocols::JsonRpc for more details.

  • :ssl_ca_bundle (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_directory (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_store (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_verify_peer (Boolean) — default: true

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled. See Plugins::StubResponses for more details.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request. See Plugins::ParamValidator for more details.

Instance Method Details

#allocate_static_ip(options = {}) ⇒ Types::AllocateStaticIpResult

Allocates a static IP address.

Examples:

Request syntax with placeholder values


resp = client.allocate_static_ip({
  static_ip_name: "ResourceName", # required
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :static_ip_name (required, String)

    The name of the static IP address.

Returns:

See Also:

#attach_static_ip(options = {}) ⇒ Types::AttachStaticIpResult

Attaches a static IP address to a specific Amazon Lightsail instance.

Examples:

Request syntax with placeholder values


resp = client.attach_static_ip({
  static_ip_name: "ResourceName", # required
  instance_name: "ResourceName", # required
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :static_ip_name (required, String)

    The name of the static IP.

  • :instance_name (required, String)

    The instance name to which you want to attach the static IP address.

Returns:

See Also:

#close_instance_public_ports(options = {}) ⇒ Types::CloseInstancePublicPortsResult

Closes the public ports on a specific Amazon Lightsail instance.

Examples:

Request syntax with placeholder values


resp = client.close_instance_public_ports({
  port_info: { # required
    from_port: 1,
    to_port: 1,
    protocol: "tcp", # accepts tcp, all, udp
  },
  instance_name: "ResourceName", # required
})

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Options Hash (options):

  • :port_info (required, Types::PortInfo)

    Information about the public port you are trying to close.

  • :instance_name (required, String)

    The name of the instance on which you\'re attempting to close the public ports.

Returns:

See Also:

#create_domain(options = {}) ⇒ Types::CreateDomainResult

Creates a domain resource for the specified domain (e.g., example.com).

Examples:

Request syntax with placeholder values


resp = client.create_domain({
  domain_name: "DomainName", # required
})

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Options Hash (options):

  • :domain_name (required, String)

    The domain name to manage (e.g., example.com).

    You cannot register a new domain name using Lightsail. You must register a domain name using Amazon Route 53 or another domain name registrar. If you have already registered your domain, you can enter its name in this parameter to manage the DNS records for that domain.

Returns:

See Also:

#create_domain_entry(options = {}) ⇒ Types::CreateDomainEntryResult

Creates one of the following entry records associated with the domain: A record, CNAME record, TXT record, or MX record.

Examples:

Request syntax with placeholder values


resp = client.create_domain_entry({
  domain_name: "DomainName", # required
  domain_entry: { # required
    id: "NonEmptyString",
    name: "DomainName",
    target: "string",
    type: "DomainEntryType",
    options: {
      "DomainEntryOptionsKeys" => "string",
    },
  },
})

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Options Hash (options):

  • :domain_name (required, String)

    The domain name (e.g., example.com) for which you want to create the domain entry.

  • :domain_entry (required, Types::DomainEntry)

    An array of key-value pairs containing information about the domain entry request.

Returns:

See Also:

#create_instance_snapshot(options = {}) ⇒ Types::CreateInstanceSnapshotResult

Creates a snapshot of a specific virtual private server, or instance. You can use a snapshot to create a new instance that is based on that snapshot.

Examples:

Request syntax with placeholder values


resp = client.create_instance_snapshot({
  instance_snapshot_name: "ResourceName", # required
  instance_name: "ResourceName", # required
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :instance_snapshot_name (required, String)

    The name for your new snapshot.

  • :instance_name (required, String)

    The Lightsail instance on which to base your snapshot.

Returns:

See Also:

#create_instances(options = {}) ⇒ Types::CreateInstancesResult

Creates one or more Amazon Lightsail virtual private servers, or instances.

Examples:

Request syntax with placeholder values


resp = client.create_instances({
  instance_names: ["string"], # required
  availability_zone: "string", # required
  custom_image_name: "ResourceName",
  blueprint_id: "NonEmptyString", # required
  bundle_id: "NonEmptyString", # required
  user_data: "string",
  key_pair_name: "ResourceName",
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :instance_names (required, Array<String>)

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

  • :availability_zone (required, String)

    The Availability Zone in which to create your instance. Use the following format: us-east-1a (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.

  • :custom_image_name (String) — default: Deprecated

    The name for your custom image.

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

  • :blueprint_id (required, String)

    The ID for a virtual private server image (e.g., app_wordpress_4_4 or app_lamp_7_0). Use the get blueprints operation to return a list of available images (or blueprints).

  • :bundle_id (required, String)

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

  • :user_data (String)

    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.

    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 Dev Guide.

  • :key_pair_name (String)

    The name of your key pair.

Returns:

See Also:

#create_instances_from_snapshot(options = {}) ⇒ Types::CreateInstancesFromSnapshotResult

Uses a specific snapshot as a blueprint for creating one or more new instances that are based on that identical configuration.

Examples:

Request syntax with placeholder values


resp = client.create_instances_from_snapshot({
  instance_names: ["string"], # required
  availability_zone: "string", # required
  instance_snapshot_name: "ResourceName", # required
  bundle_id: "NonEmptyString", # required
  user_data: "string",
  key_pair_name: "ResourceName",
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :instance_names (required, Array<String>)

    The names for your new instances.

  • :availability_zone (required, String)

    The Availability Zone where you want to create your instances. Use the following formatting: us-east-1a (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.

  • :instance_snapshot_name (required, String)

    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.

  • :bundle_id (required, String)

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

  • :user_data (String)

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

    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 Dev Guide.

  • :key_pair_name (String)

    The name for your key pair.

Returns:

See Also:

#create_key_pair(options = {}) ⇒ Types::CreateKeyPairResult

Creates sn SSH key pair.

Examples:

Request syntax with placeholder values


resp = client.create_key_pair({
  key_pair_name: "ResourceName", # required
})

Response structure


resp.key_pair.name #=> String
resp.key_pair.arn #=> String
resp.key_pair.support_code #=> String
resp.key_pair.created_at #=> Time
resp.key_pair.location.availability_zone #=> String
resp.key_pair.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.key_pair.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.key_pair.fingerprint #=> String
resp.public_key_base_64 #=> String
resp.private_key_base_64 #=> String
resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Options Hash (options):

  • :key_pair_name (required, String)

    The name for your new key pair.

Returns:

See Also:

#delete_domain(options = {}) ⇒ Types::DeleteDomainResult

Deletes the specified domain recordset and all of its domain records.

Examples:

Request syntax with placeholder values


resp = client.delete_domain({
  domain_name: "DomainName", # required
})

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Options Hash (options):

  • :domain_name (required, String)

    The specific domain name to delete.

Returns:

See Also:

#delete_domain_entry(options = {}) ⇒ Types::DeleteDomainEntryResult

Deletes a specific domain entry.

Examples:

Request syntax with placeholder values


resp = client.delete_domain_entry({
  domain_name: "DomainName", # required
  domain_entry: { # required
    id: "NonEmptyString",
    name: "DomainName",
    target: "string",
    type: "DomainEntryType",
    options: {
      "DomainEntryOptionsKeys" => "string",
    },
  },
})

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Options Hash (options):

  • :domain_name (required, String)

    The name of the domain entry to delete.

  • :domain_entry (required, Types::DomainEntry)

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

Returns:

See Also:

#delete_instance(options = {}) ⇒ Types::DeleteInstanceResult

Deletes a specific Amazon Lightsail virtual private server, or instance.

Examples:

Request syntax with placeholder values


resp = client.delete_instance({
  instance_name: "ResourceName", # required
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :instance_name (required, String)

    The name of the instance to delete.

Returns:

See Also:

#delete_instance_snapshot(options = {}) ⇒ Types::DeleteInstanceSnapshotResult

Deletes a specific snapshot of a virtual private server (or instance).

Examples:

Request syntax with placeholder values


resp = client.delete_instance_snapshot({
  instance_snapshot_name: "ResourceName", # required
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :instance_snapshot_name (required, String)

    The name of the snapshot to delete.

Returns:

See Also:

#delete_key_pair(options = {}) ⇒ Types::DeleteKeyPairResult

Deletes a specific SSH key pair.

Examples:

Request syntax with placeholder values


resp = client.delete_key_pair({
  key_pair_name: "ResourceName", # required
})

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Options Hash (options):

  • :key_pair_name (required, String)

    The name of the key pair to delete.

Returns:

See Also:

#detach_static_ip(options = {}) ⇒ Types::DetachStaticIpResult

Detaches a static IP from the Amazon Lightsail instance to which it is attached.

Examples:

Request syntax with placeholder values


resp = client.detach_static_ip({
  static_ip_name: "ResourceName", # required
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :static_ip_name (required, String)

    The name of the static IP to detach from the instance.

Returns:

See Also:

#download_default_key_pair(options = {}) ⇒ Types::DownloadDefaultKeyPairResult

Downloads the default SSH key pair from the user's account.

Examples:

Request syntax with placeholder values


resp = client.download_default_key_pair()

Response structure


resp.public_key_base_64 #=> String
resp.private_key_base_64 #=> String

Returns:

See Also:

#get_active_names(options = {}) ⇒ Types::GetActiveNamesResult

Returns the names of all active (not deleted) resources.

Examples:

Request syntax with placeholder values


resp = client.get_active_names({
  page_token: "string",
})

Response structure


resp.active_names #=> Array
resp.active_names[0] #=> String
resp.next_page_token #=> String

Options Hash (options):

  • :page_token (String)

    A token used for paginating results from your get active names request.

Returns:

See Also:

#get_blueprints(options = {}) ⇒ Types::GetBlueprintsResult

Returns the list of available instance images, or blueprints. You can use a blueprint to create a new virtual private server already running a specific operating system, as well as a preinstalled app or development stack. The software each instance is running depends on the blueprint image you choose.

Examples:

Request syntax with placeholder values


resp = client.get_blueprints({
  include_inactive: false,
  page_token: "string",
})

Response structure


resp.blueprints #=> Array
resp.blueprints[0].blueprint_id #=> String
resp.blueprints[0].name #=> String
resp.blueprints[0].group #=> String
resp.blueprints[0].type #=> String, one of "os", "app"
resp.blueprints[0].description #=> String
resp.blueprints[0].is_active #=> true/false
resp.blueprints[0].min_power #=> Integer
resp.blueprints[0].version #=> String
resp.blueprints[0].version_code #=> String
resp.blueprints[0].product_url #=> String
resp.blueprints[0].license_url #=> String
resp.next_page_token #=> String

Options Hash (options):

  • :include_inactive (Boolean)

    A Boolean value indicating whether to include inactive results in your request.

  • :page_token (String)

    A token used for advancing to the next page of results from your get blueprints request.

Returns:

See Also:

#get_bundles(options = {}) ⇒ Types::GetBundlesResult

Returns the list of bundles that are available for purchase. A bundle describes the specs for your virtual private server (or instance).

Examples:

Request syntax with placeholder values


resp = client.get_bundles({
  include_inactive: false,
  page_token: "string",
})

Response structure


resp.bundles #=> Array
resp.bundles[0].price #=> Float
resp.bundles[0].cpu_count #=> Integer
resp.bundles[0].disk_size_in_gb #=> Integer
resp.bundles[0].bundle_id #=> String
resp.bundles[0].instance_type #=> String
resp.bundles[0].is_active #=> true/false
resp.bundles[0].name #=> String
resp.bundles[0].power #=> Integer
resp.bundles[0].ram_size_in_gb #=> Float
resp.bundles[0].transfer_per_month_in_gb #=> Integer
resp.next_page_token #=> String

Options Hash (options):

  • :include_inactive (Boolean)

    A Boolean value that indicates whether to include inactive bundle results in your request.

  • :page_token (String)

    A token used for advancing to the next page of results from your get bundles request.

Returns:

See Also:

#get_domain(options = {}) ⇒ Types::GetDomainResult

Returns information about a specific domain recordset.

Examples:

Request syntax with placeholder values


resp = client.get_domain({
  domain_name: "DomainName", # required
})

Response structure


resp.domain.name #=> String
resp.domain.arn #=> String
resp.domain.support_code #=> String
resp.domain.created_at #=> Time
resp.domain.location.availability_zone #=> String
resp.domain.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.domain.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.domain.domain_entries #=> Array
resp.domain.domain_entries[0].id #=> String
resp.domain.domain_entries[0].name #=> String
resp.domain.domain_entries[0].target #=> String
resp.domain.domain_entries[0].type #=> String
resp.domain.domain_entries[0].options #=> Hash
resp.domain.domain_entries[0].options["DomainEntryOptionsKeys"] #=> String

Options Hash (options):

  • :domain_name (required, String)

    The domain name for which your want to return information about.

Returns:

See Also:

#get_domains(options = {}) ⇒ Types::GetDomainsResult

Returns a list of all domains in the user's account.

Examples:

Request syntax with placeholder values


resp = client.get_domains({
  page_token: "string",
})

Response structure


resp.domains #=> Array
resp.domains[0].name #=> String
resp.domains[0].arn #=> String
resp.domains[0].support_code #=> String
resp.domains[0].created_at #=> Time
resp.domains[0].location.availability_zone #=> String
resp.domains[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.domains[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.domains[0].domain_entries #=> Array
resp.domains[0].domain_entries[0].id #=> String
resp.domains[0].domain_entries[0].name #=> String
resp.domains[0].domain_entries[0].target #=> String
resp.domains[0].domain_entries[0].type #=> String
resp.domains[0].domain_entries[0].options #=> Hash
resp.domains[0].domain_entries[0].options["DomainEntryOptionsKeys"] #=> String
resp.next_page_token #=> String

Options Hash (options):

  • :page_token (String)

    A token used for advancing to the next page of results from your get domains request.

Returns:

See Also:

#get_instance(options = {}) ⇒ Types::GetInstanceResult

Returns information about a specific Amazon Lightsail instance, which is a virtual private server.

Examples:

Request syntax with placeholder values


resp = client.get_instance({
  instance_name: "ResourceName", # required
})

Response structure


resp.instance.name #=> String
resp.instance.arn #=> String
resp.instance.support_code #=> String
resp.instance.created_at #=> Time
resp.instance.location.availability_zone #=> String
resp.instance.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.instance.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.instance.blueprint_id #=> String
resp.instance.blueprint_name #=> String
resp.instance.bundle_id #=> String
resp.instance.is_static_ip #=> true/false
resp.instance.private_ip_address #=> String
resp.instance.public_ip_address #=> String
resp.instance.ipv6_address #=> String
resp.instance.hardware.cpu_count #=> Integer
resp.instance.hardware.disks #=> Array
resp.instance.hardware.disks[0].name #=> String
resp.instance.hardware.disks[0].arn #=> String
resp.instance.hardware.disks[0].support_code #=> String
resp.instance.hardware.disks[0].created_at #=> Time
resp.instance.hardware.disks[0].location.availability_zone #=> String
resp.instance.hardware.disks[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.instance.hardware.disks[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.instance.hardware.disks[0].size_in_gb #=> Integer
resp.instance.hardware.disks[0].gb_in_use #=> Integer
resp.instance.hardware.disks[0].is_system_disk #=> true/false
resp.instance.hardware.disks[0].iops #=> Integer
resp.instance.hardware.disks[0].path #=> String
resp.instance.hardware.disks[0].attached_to #=> String
resp.instance.hardware.disks[0].is_attached #=> true/false
resp.instance.hardware.disks[0].attachment_state #=> String
resp.instance.hardware.ram_size_in_gb #=> Float
resp.instance.networking.monthly_transfer.gb_per_month_allocated #=> Integer
resp.instance.networking.ports #=> Array
resp.instance.networking.ports[0].from_port #=> Integer
resp.instance.networking.ports[0].to_port #=> Integer
resp.instance.networking.ports[0].protocol #=> String, one of "tcp", "all", "udp"
resp.instance.networking.ports[0].access_from #=> String
resp.instance.networking.ports[0].access_type #=> String, one of "Public", "Private"
resp.instance.networking.ports[0].common_name #=> String
resp.instance.networking.ports[0].access_direction #=> String, one of "inbound", "outbound"
resp.instance.state.code #=> Integer
resp.instance.state.name #=> String
resp.instance.username #=> String
resp.instance.ssh_key_name #=> String

Options Hash (options):

  • :instance_name (required, String)

    The name of the instance.

Returns:

See Also:

#get_instance_access_details(options = {}) ⇒ Types::GetInstanceAccessDetailsResult

Returns temporary SSH keys you can use to connect to a specific virtual private server, or instance.

Examples:

Request syntax with placeholder values


resp = client.get_instance_access_details({
  instance_name: "ResourceName", # required
  protocol: "ssh", # accepts ssh, rdp
})

Response structure


resp.access_details.cert_key #=> String
resp.access_details.expires_at #=> Time
resp.access_details.ip_address #=> String
resp.access_details.password #=> String
resp.access_details.private_key #=> String
resp.access_details.protocol #=> String, one of "ssh", "rdp"
resp.access_details.instance_name #=> String
resp.access_details.username #=> String

Options Hash (options):

  • :instance_name (required, String)

    The name of the instance to access.

  • :protocol (String)

    The protocol to use to connect to your instance. Defaults to ssh.

Returns:

See Also:

#get_instance_metric_data(options = {}) ⇒ Types::GetInstanceMetricDataResult

Returns the data points for the specified Amazon Lightsail instance metric, given an instance name.

Examples:

Request syntax with placeholder values


resp = client.get_instance_metric_data({
  instance_name: "ResourceName", # required
  metric_name: "CPUUtilization", # required, accepts CPUUtilization, NetworkIn, NetworkOut, StatusCheckFailed, StatusCheckFailed_Instance, StatusCheckFailed_System
  period: 1, # required
  start_time: Time.now, # required
  end_time: Time.now, # required
  unit: "Seconds", # required, accepts Seconds, Microseconds, Milliseconds, Bytes, Kilobytes, Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits, Terabits, Percent, Count, Bytes/Second, Kilobytes/Second, Megabytes/Second, Gigabytes/Second, Terabytes/Second, Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second, Terabits/Second, Count/Second, None
  statistics: ["Minimum"], # required, accepts Minimum, Maximum, Sum, Average, SampleCount
})

Response structure


resp.metric_name #=> String, one of "CPUUtilization", "NetworkIn", "NetworkOut", "StatusCheckFailed", "StatusCheckFailed_Instance", "StatusCheckFailed_System"
resp.metric_data #=> Array
resp.metric_data[0].average #=> Float
resp.metric_data[0].maximum #=> Float
resp.metric_data[0].minimum #=> Float
resp.metric_data[0].sample_count #=> Float
resp.metric_data[0].sum #=> Float
resp.metric_data[0].timestamp #=> Time
resp.metric_data[0].unit #=> String, one of "Seconds", "Microseconds", "Milliseconds", "Bytes", "Kilobytes", "Megabytes", "Gigabytes", "Terabytes", "Bits", "Kilobits", "Megabits", "Gigabits", "Terabits", "Percent", "Count", "Bytes/Second", "Kilobytes/Second", "Megabytes/Second", "Gigabytes/Second", "Terabytes/Second", "Bits/Second", "Kilobits/Second", "Megabits/Second", "Gigabits/Second", "Terabits/Second", "Count/Second", "None"

Options Hash (options):

  • :instance_name (required, String)

    The name of the instance for which you want to get metrics data.

  • :metric_name (required, String)

    The metric name to get data about.

  • :period (required, Integer)

    The time period for which you are requesting data.

  • :start_time (required, Time)

    The start time of the time period.

  • :end_time (required, Time)

    The end time of the time period.

  • :unit (required, String)

    The unit. The list of valid values is below.

  • :statistics (required, Array<String>)

    The instance statistics.

Returns:

See Also:

#get_instance_port_states(options = {}) ⇒ Types::GetInstancePortStatesResult

Returns the port states for a specific virtual private server, or instance.

Examples:

Request syntax with placeholder values


resp = client.get_instance_port_states({
  instance_name: "ResourceName", # required
})

Response structure


resp.port_states #=> Array
resp.port_states[0].from_port #=> Integer
resp.port_states[0].to_port #=> Integer
resp.port_states[0].protocol #=> String, one of "tcp", "all", "udp"
resp.port_states[0].state #=> String, one of "open", "closed"

Options Hash (options):

  • :instance_name (required, String)

    The name of the instance.

Returns:

See Also:

#get_instance_snapshot(options = {}) ⇒ Types::GetInstanceSnapshotResult

Returns information about a specific instance snapshot.

Examples:

Request syntax with placeholder values


resp = client.get_instance_snapshot({
  instance_snapshot_name: "ResourceName", # required
})

Response structure


resp.instance_snapshot.name #=> String
resp.instance_snapshot.arn #=> String
resp.instance_snapshot.support_code #=> String
resp.instance_snapshot.created_at #=> Time
resp.instance_snapshot.location.availability_zone #=> String
resp.instance_snapshot.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.instance_snapshot.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.instance_snapshot.state #=> String, one of "pending", "error", "available"
resp.instance_snapshot.progress #=> String
resp.instance_snapshot.from_instance_name #=> String
resp.instance_snapshot.from_instance_arn #=> String
resp.instance_snapshot.from_blueprint_id #=> String
resp.instance_snapshot.from_bundle_id #=> String
resp.instance_snapshot.size_in_gb #=> Integer

Options Hash (options):

  • :instance_snapshot_name (required, String)

    The name of the snapshot for which you are requesting information.

Returns:

See Also:

#get_instance_snapshots(options = {}) ⇒ Types::GetInstanceSnapshotsResult

Returns all instance snapshots for the user's account.

Examples:

Request syntax with placeholder values


resp = client.get_instance_snapshots({
  page_token: "string",
})

Response structure


resp.instance_snapshots #=> Array
resp.instance_snapshots[0].name #=> String
resp.instance_snapshots[0].arn #=> String
resp.instance_snapshots[0].support_code #=> String
resp.instance_snapshots[0].created_at #=> Time
resp.instance_snapshots[0].location.availability_zone #=> String
resp.instance_snapshots[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.instance_snapshots[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.instance_snapshots[0].state #=> String, one of "pending", "error", "available"
resp.instance_snapshots[0].progress #=> String
resp.instance_snapshots[0].from_instance_name #=> String
resp.instance_snapshots[0].from_instance_arn #=> String
resp.instance_snapshots[0].from_blueprint_id #=> String
resp.instance_snapshots[0].from_bundle_id #=> String
resp.instance_snapshots[0].size_in_gb #=> Integer
resp.next_page_token #=> String

Options Hash (options):

  • :page_token (String)

    A token used for advancing to the next page of results from your get instance snapshots request.

Returns:

See Also:

#get_instance_state(options = {}) ⇒ Types::GetInstanceStateResult

Returns the state of a specific instance. Works on one instance at a time.

Examples:

Request syntax with placeholder values


resp = client.get_instance_state({
  instance_name: "ResourceName", # required
})

Response structure


resp.state.code #=> Integer
resp.state.name #=> String

Options Hash (options):

  • :instance_name (required, String)

    The name of the instance to get state information about.

Returns:

See Also:

#get_instances(options = {}) ⇒ Types::GetInstancesResult

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

Examples:

Request syntax with placeholder values


resp = client.get_instances({
  page_token: "string",
})

Response structure


resp.instances #=> Array
resp.instances[0].name #=> String
resp.instances[0].arn #=> String
resp.instances[0].support_code #=> String
resp.instances[0].created_at #=> Time
resp.instances[0].location.availability_zone #=> String
resp.instances[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.instances[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.instances[0].blueprint_id #=> String
resp.instances[0].blueprint_name #=> String
resp.instances[0].bundle_id #=> String
resp.instances[0].is_static_ip #=> true/false
resp.instances[0].private_ip_address #=> String
resp.instances[0].public_ip_address #=> String
resp.instances[0].ipv6_address #=> String
resp.instances[0].hardware.cpu_count #=> Integer
resp.instances[0].hardware.disks #=> Array
resp.instances[0].hardware.disks[0].name #=> String
resp.instances[0].hardware.disks[0].arn #=> String
resp.instances[0].hardware.disks[0].support_code #=> String
resp.instances[0].hardware.disks[0].created_at #=> Time
resp.instances[0].hardware.disks[0].location.availability_zone #=> String
resp.instances[0].hardware.disks[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.instances[0].hardware.disks[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.instances[0].hardware.disks[0].size_in_gb #=> Integer
resp.instances[0].hardware.disks[0].gb_in_use #=> Integer
resp.instances[0].hardware.disks[0].is_system_disk #=> true/false
resp.instances[0].hardware.disks[0].iops #=> Integer
resp.instances[0].hardware.disks[0].path #=> String
resp.instances[0].hardware.disks[0].attached_to #=> String
resp.instances[0].hardware.disks[0].is_attached #=> true/false
resp.instances[0].hardware.disks[0].attachment_state #=> String
resp.instances[0].hardware.ram_size_in_gb #=> Float
resp.instances[0].networking.monthly_transfer.gb_per_month_allocated #=> Integer
resp.instances[0].networking.ports #=> Array
resp.instances[0].networking.ports[0].from_port #=> Integer
resp.instances[0].networking.ports[0].to_port #=> Integer
resp.instances[0].networking.ports[0].protocol #=> String, one of "tcp", "all", "udp"
resp.instances[0].networking.ports[0].access_from #=> String
resp.instances[0].networking.ports[0].access_type #=> String, one of "Public", "Private"
resp.instances[0].networking.ports[0].common_name #=> String
resp.instances[0].networking.ports[0].access_direction #=> String, one of "inbound", "outbound"
resp.instances[0].state.code #=> Integer
resp.instances[0].state.name #=> String
resp.instances[0].username #=> String
resp.instances[0].ssh_key_name #=> String
resp.next_page_token #=> String

Options Hash (options):

  • :page_token (String)

    A token used for advancing to the next page of results from your get instances request.

Returns:

See Also:

#get_key_pair(options = {}) ⇒ Types::GetKeyPairResult

Returns information about a specific key pair.

Examples:

Request syntax with placeholder values


resp = client.get_key_pair({
  key_pair_name: "ResourceName", # required
})

Response structure


resp.key_pair.name #=> String
resp.key_pair.arn #=> String
resp.key_pair.support_code #=> String
resp.key_pair.created_at #=> Time
resp.key_pair.location.availability_zone #=> String
resp.key_pair.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.key_pair.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.key_pair.fingerprint #=> String

Options Hash (options):

  • :key_pair_name (required, String)

    The name of the key pair for which you are requesting information.

Returns:

See Also:

#get_key_pairs(options = {}) ⇒ Types::GetKeyPairsResult

Returns information about all key pairs in the user's account.

Examples:

Request syntax with placeholder values


resp = client.get_key_pairs({
  page_token: "string",
})

Response structure


resp.key_pairs #=> Array
resp.key_pairs[0].name #=> String
resp.key_pairs[0].arn #=> String
resp.key_pairs[0].support_code #=> String
resp.key_pairs[0].created_at #=> Time
resp.key_pairs[0].location.availability_zone #=> String
resp.key_pairs[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.key_pairs[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.key_pairs[0].fingerprint #=> String
resp.next_page_token #=> String

Options Hash (options):

  • :page_token (String)

    A token used for advancing to the next page of results from your get key pairs request.

Returns:

See Also:

#get_operation(options = {}) ⇒ Types::GetOperationResult

Returns information about a specific operation. Operations include events such as when you create an instance, allocate a static IP, attach a static IP, and so on.

Examples:

Request syntax with placeholder values


resp = client.get_operation({
  operation_id: "NonEmptyString", # required
})

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Options Hash (options):

  • :operation_id (required, String)

    A GUID used to identify the operation.

Returns:

See Also:

#get_operations(options = {}) ⇒ Types::GetOperationsResult

Returns information about all operations.

Results are returned from oldest to newest, up to a maximum of 200. Results can be paged by making each subsequent call to GetOperations use the maximum (last) statusChangedAt value from the previous request.

Examples:

Request syntax with placeholder values


resp = client.get_operations({
  page_token: "string",
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String
resp.next_page_token #=> String

Options Hash (options):

  • :page_token (String)

    A token used for advancing to the next page of results from your get operations request.

Returns:

See Also:

#get_operations_for_resource(options = {}) ⇒ Types::GetOperationsForResourceResult

Gets operations for a specific resource (e.g., an instance or a static IP).

Examples:

Request syntax with placeholder values


resp = client.get_operations_for_resource({
  resource_name: "ResourceName", # required
  page_token: "string",
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String
resp.next_page_count #=> String
resp.next_page_token #=> String

Options Hash (options):

  • :resource_name (required, String)

    The name of the resource for which you are requesting information.

  • :page_token (String)

    A token used for advancing to the next page of results from your get operations for resource request.

Returns:

See Also:

#get_regions(options = {}) ⇒ Types::GetRegionsResult

Returns a list of all valid regions for Amazon Lightsail. Use the include availability zones parameter to also return the availability zones in a region.

Examples:

Request syntax with placeholder values


resp = client.get_regions({
  include_availability_zones: false,
})

Response structure


resp.regions #=> Array
resp.regions[0].continent_code #=> String
resp.regions[0].description #=> String
resp.regions[0].display_name #=> String
resp.regions[0].name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.regions[0].availability_zones #=> Array
resp.regions[0].availability_zones[0].zone_name #=> String
resp.regions[0].availability_zones[0].state #=> String

Options Hash (options):

  • :include_availability_zones (Boolean)

    A Boolean value indicating whether to also include Availability Zones in your get regions request. Availability Zones are indicated with a letter: e.g., us-east-1a.

Returns:

See Also:

#get_static_ip(options = {}) ⇒ Types::GetStaticIpResult

Returns information about a specific static IP.

Examples:

Request syntax with placeholder values


resp = client.get_static_ip({
  static_ip_name: "ResourceName", # required
})

Response structure


resp.static_ip.name #=> String
resp.static_ip.arn #=> String
resp.static_ip.support_code #=> String
resp.static_ip.created_at #=> Time
resp.static_ip.location.availability_zone #=> String
resp.static_ip.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.static_ip.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.static_ip.ip_address #=> String
resp.static_ip.attached_to #=> String
resp.static_ip.is_attached #=> true/false

Options Hash (options):

  • :static_ip_name (required, String)

    The name of the static IP in Lightsail.

Returns:

See Also:

#get_static_ips(options = {}) ⇒ Types::GetStaticIpsResult

Returns information about all static IPs in the user's account.

Examples:

Request syntax with placeholder values


resp = client.get_static_ips({
  page_token: "string",
})

Response structure


resp.static_ips #=> Array
resp.static_ips[0].name #=> String
resp.static_ips[0].arn #=> String
resp.static_ips[0].support_code #=> String
resp.static_ips[0].created_at #=> Time
resp.static_ips[0].location.availability_zone #=> String
resp.static_ips[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.static_ips[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.static_ips[0].ip_address #=> String
resp.static_ips[0].attached_to #=> String
resp.static_ips[0].is_attached #=> true/false
resp.next_page_token #=> String

Options Hash (options):

  • :page_token (String)

    A token used for advancing to the next page of results from your get static IPs request.

Returns:

See Also:

#import_key_pair(options = {}) ⇒ Types::ImportKeyPairResult

Imports a public SSH key from a specific key pair.

Examples:

Request syntax with placeholder values


resp = client.import_key_pair({
  key_pair_name: "ResourceName", # required
  public_key_base_64: "Base64", # required
})

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Options Hash (options):

  • :key_pair_name (required, String)

    The name of the key pair for which you want to import the public key.

  • :public_key_base_64 (required, String)

    A base64-encoded public key of the ssh-rsa type.

Returns:

See Also:

#is_vpc_peered(options = {}) ⇒ Types::IsVpcPeeredResult

Returns a Boolean value indicating whether your Lightsail VPC is peered.

Examples:

Request syntax with placeholder values


resp = client.is_vpc_peered()

Response structure


resp.is_peered #=> true/false

Returns:

See Also:

#open_instance_public_ports(options = {}) ⇒ Types::OpenInstancePublicPortsResult

Adds public ports to an Amazon Lightsail instance.

Examples:

Request syntax with placeholder values


resp = client.open_instance_public_ports({
  port_info: { # required
    from_port: 1,
    to_port: 1,
    protocol: "tcp", # accepts tcp, all, udp
  },
  instance_name: "ResourceName", # required
})

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Options Hash (options):

  • :port_info (required, Types::PortInfo)

    An array of key-value pairs containing information about the port mappings.

  • :instance_name (required, String)

    The name of the instance for which you want to open the public ports.

Returns:

See Also:

#peer_vpc(options = {}) ⇒ Types::PeerVpcResult

Tries to peer the Lightsail VPC with the user's default VPC.

Examples:

Request syntax with placeholder values


resp = client.peer_vpc()

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Returns:

See Also:

#put_instance_public_ports(options = {}) ⇒ Types::PutInstancePublicPortsResult

Sets the specified open ports for an Amazon Lightsail instance, and closes all ports for every protocol not included in the current request.

Examples:

Request syntax with placeholder values


resp = client.put_instance_public_ports({
  port_infos: [ # required
    {
      from_port: 1,
      to_port: 1,
      protocol: "tcp", # accepts tcp, all, udp
    },
  ],
  instance_name: "ResourceName", # required
})

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Options Hash (options):

  • :port_infos (required, Array<Types::PortInfo>)

    Specifies information about the public port(s).

  • :instance_name (required, String)

    The Lightsail instance name of the public port(s) you are setting.

Returns:

See Also:

#reboot_instance(options = {}) ⇒ Types::RebootInstanceResult

Restarts a specific instance. When your Amazon Lightsail instance is finished rebooting, Lightsail assigns a new public IP address. To use the same IP address after restarting, create a static IP address and attach it to the instance.

Examples:

Request syntax with placeholder values


resp = client.reboot_instance({
  instance_name: "ResourceName", # required
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :instance_name (required, String)

    The name of the instance to reboot.

Returns:

See Also:

#release_static_ip(options = {}) ⇒ Types::ReleaseStaticIpResult

Deletes a specific static IP from your account.

Examples:

Request syntax with placeholder values


resp = client.release_static_ip({
  static_ip_name: "ResourceName", # required
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :static_ip_name (required, String)

    The name of the static IP to delete.

Returns:

See Also:

#start_instance(options = {}) ⇒ Types::StartInstanceResult

Starts a specific Amazon Lightsail instance from a stopped state. To restart an instance, use the reboot instance operation.

Examples:

Request syntax with placeholder values


resp = client.start_instance({
  instance_name: "ResourceName", # required
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :instance_name (required, String)

    The name of the instance (a virtual private server) to start.

Returns:

See Also:

#stop_instance(options = {}) ⇒ Types::StopInstanceResult

Stops a specific Amazon Lightsail instance that is currently running.

Examples:

Request syntax with placeholder values


resp = client.stop_instance({
  instance_name: "ResourceName", # required
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :instance_name (required, String)

    The name of the instance (a virtual private server) to stop.

Returns:

See Also:

#unpeer_vpc(options = {}) ⇒ Types::UnpeerVpcResult

Attempts to unpeer the Lightsail VPC from the user's default VPC.

Examples:

Request syntax with placeholder values


resp = client.unpeer_vpc()

Response structure


resp.operation.id #=> String
resp.operation.resource_name #=> String
resp.operation.resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operation.created_at #=> Time
resp.operation.location.availability_zone #=> String
resp.operation.location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operation.is_terminal #=> true/false
resp.operation.operation_details #=> String
resp.operation.operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operation.status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operation.status_changed_at #=> Time
resp.operation.error_code #=> String
resp.operation.error_details #=> String

Returns:

See Also:

#update_domain_entry(options = {}) ⇒ Types::UpdateDomainEntryResult

Updates a domain recordset after it is created.

Examples:

Request syntax with placeholder values


resp = client.update_domain_entry({
  domain_name: "DomainName", # required
  domain_entry: { # required
    id: "NonEmptyString",
    name: "DomainName",
    target: "string",
    type: "DomainEntryType",
    options: {
      "DomainEntryOptionsKeys" => "string",
    },
  },
})

Response structure


resp.operations #=> Array
resp.operations[0].id #=> String
resp.operations[0].resource_name #=> String
resp.operations[0].resource_type #=> String, one of "Instance", "StaticIp", "KeyPair", "InstanceSnapshot", "Domain", "PeeredVpc"
resp.operations[0].created_at #=> Time
resp.operations[0].location.availability_zone #=> String
resp.operations[0].location.region_name #=> String, one of "us-east-1", "us-east-2", "us-west-1", "us-west-2", "eu-west-1", "eu-central-1", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2"
resp.operations[0].is_terminal #=> true/false
resp.operations[0].operation_details #=> String
resp.operations[0].operation_type #=> String, one of "DeleteInstance", "CreateInstance", "StopInstance", "StartInstance", "RebootInstance", "OpenInstancePublicPorts", "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", "AttachStaticIp", "DetachStaticIp", "UpdateDomainEntry", "DeleteDomainEntry", "CreateDomain", "DeleteDomain", "CreateInstanceSnapshot", "DeleteInstanceSnapshot", "CreateInstancesFromSnapshot"
resp.operations[0].status #=> String, one of "NotStarted", "Started", "Failed", "Completed"
resp.operations[0].status_changed_at #=> Time
resp.operations[0].error_code #=> String
resp.operations[0].error_details #=> String

Options Hash (options):

  • :domain_name (required, String)

    The name of the domain recordset to update.

  • :domain_entry (required, Types::DomainEntry)

    An array of key-value pairs containing information about the domain entry.

Returns:

See Also:

#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean

Waiters polls an API operation until a resource enters a desired state.

Basic Usage

Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.

# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)

Configuration

You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:

# poll for ~25 seconds
client.wait_until(...) do |w|
  w.max_attempts = 5
  w.delay = 5
end

Callbacks

You can be notified before each polling attempt and before each delay. If you throw :success or :failure from these callbacks, it will terminate the waiter.

started_at = Time.now
client.wait_until(...) do |w|

  # disable max attempts
  w.max_attempts = nil

  # poll for 1 hour, instead of a number of attempts
  w.before_wait do |attempts, response|
    throw :failure if Time.now - started_at > 3600
  end

end

Handling Errors

When a waiter is successful, it returns true. When a waiter fails, it raises an error. All errors raised extend from Waiters::Errors::WaiterFailed.

begin
  client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
  # resource did not enter the desired state in time
end

Parameters:

  • waiter_name (Symbol)

    The name of the waiter. See #waiter_names for a full list of supported waiters.

  • params (Hash) (defaults to: {})

    Additional request parameters. See the #waiter_names for a list of supported waiters and what request they call. The called request determines the list of accepted parameters.

Yield Parameters:

Returns:

  • (Boolean)

    Returns true if the waiter was successful.

Raises:

  • (Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

  • (Errors::TooManyAttemptsError)

    Raised when the configured maximum number of attempts have been made, and the waiter is not yet successful.

  • (Errors::UnexpectedError)

    Raised when an error is encounted while polling for a resource that is not expected.

  • (Errors::NoSuchWaiterError)

    Raised when you request to wait for an unknown state.

#waiter_namesArray<Symbol>

Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:

Waiter NameClient MethodDefault Delay:Default Max Attempts:

Returns:

  • (Array<Symbol>)

    the list of supported waiters.