LinuxCommandLibrary

aws-lightsail

Manage AWS Lightsail resources

TLDR

List all virtual private servers, or instances

$ aws lightsail get-instances
copy

List all bundles (instance plans)
$ aws lightsail list-bundles
copy

List all available instance images, or blueprints
$ aws lightsail list-blueprints
copy

Create an instance
$ aws lightsail create-instances --instance-names [name] --availability-zone [region] --bundle-id [nano_2_0] --blueprint-id [blueprint_id]
copy

Print the state of a specific instance
$ aws lightsail get-instance-state --instance-name [name]
copy

Stop a specific instance
$ aws lightsail stop-instance --instance-name [name]
copy

Delete a specific instance
$ aws lightsail delete-instance --instance-name [name]
copy

SYNOPSIS

aws lightsail <command> [options]

Examples:
  • aws lightsail get-instances
  • aws lightsail create-instance --instance-name my-new-server --blueprint-id wordpress --bundle-id nano_2_0 --availability-zone us-east-1a
  • aws lightsail stop-instance --instance-name my-stopped-server

PARAMETERS

Global AWS CLI Options:
    These options affect how the AWS CLI interacts with AWS services in general, including Lightsail operations.

--region region-name
    Specifies the AWS region to send the request to (e.g., us-east-1). Overrides default configured region.

--output output-format
    Specifies the output format (e.g., json, text, table). Overrides default configured output format.

--profile profile-name
    Uses a specific profile from your credential file to manage AWS credentials and configuration.

--cli-input-json file://path/to/json
    Reads command arguments from a JSON file, useful for complex or numerous parameters.

Common Lightsail Subcommand Parameters (examples):
    The `aws lightsail` command consists of many subcommands (e.g., `create-instance`, `get-instances`, `update-domain-entry`), each with its own extensive set of specific parameters. Listing all is impractical; below are examples of common Lightsail-specific parameters you might encounter.

--instance-name name
    The unique name of the Lightsail instance.

--blueprint-id id
    The ID for the virtual private server image (e.g., wordpress, ubuntu_22_04, lamp).

--bundle-id id
    The ID for the virtual private server bundle (e.g., nano_2_0, medium_2_0) which defines CPU, RAM, and storage.

--availability-zone zone
    The Availability Zone in which to create the instance (e.g., us-east-1a).

--key-pair-name name
    The name of the key pair to use for SSH access to Linux instances.

DESCRIPTION

The `aws lightsail` command is a subcommand of the official AWS Command Line Interface (AWS CLI). It provides a programmatic interface to interact with and manage AWS Lightsail resources directly from your terminal.

AWS Lightsail is a simplified cloud platform that offers bundles of compute, storage, and networking capacity for a low, predictable monthly price. It's designed to make it easy for developers, small businesses, and students to get started with cloud computing without deep knowledge of complex AWS services.

Using the `aws lightsail` command, users can automate various tasks such as creating, starting, stopping, and deleting instances, databases, load balancers, and network resources. It also allows for managing domains, DNS records, and object storage buckets. This command-line access is essential for scripting, integration with CI/CD pipelines, and efficient management of numerous Lightsail resources. It abstracts away the need to use the AWS Management Console for routine operations, offering greater control and automation capabilities.

CAVEATS

  • Requires the AWS CLI to be installed and configured with appropriate credentials and region settings.
  • Operations incur costs based on the AWS Lightsail pricing model. Ensure you understand the pricing before provisioning resources.
  • Permissions: The AWS credentials used must have the necessary IAM (Identity and Access Management) permissions to perform the requested Lightsail actions.
  • Rate Limiting: AWS APIs have rate limits; frequent or rapid calls might result in throttling errors. Implement retry mechanisms for robust scripting.
  • Learning Curve: While Lightsail simplifies cloud, mastering the various subcommands and their specific parameters requires consulting the official AWS CLI Lightsail documentation.

<B><I>CONFIGURATION</I></B>

Before using `aws lightsail`, the AWS CLI must be configured. This typically involves running `aws configure` and providing your AWS Access Key ID, Secret Access Key, default region, and default output format. Alternatively, environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_DEFAULT_REGION`) or IAM roles can be used for authentication and configuration.

<B><I>COMMON USE CASES</I></B>

The `aws lightsail` command is frequently used for:

  • Rapid deployment of web applications (e.g., WordPress, Joomla, LAMP stacks).
  • Automating server provisioning for development and testing environments.
  • Managing DNS records and domain registrations.
  • Creating and restoring snapshots of instances and databases.
  • Monitoring resource usage and status, and setting up alarms.
  • Configuring networking features like static IPs, firewalls, and load balancers.

HISTORY

AWS Lightsail was officially launched by Amazon Web Services in November 2016, aiming to simplify cloud adoption for users needing basic compute and storage. Since its inception, the `aws lightsail` subcommand has been an integral part of the AWS CLI, providing immediate command-line access to new features as they were introduced. This includes support for managed databases (2018), load balancers (2018), object storage (2019), and container services (2020), with the CLI commands continually updated to reflect these expanded capabilities. Its development focuses on maintaining parity with the Console's features, enabling full automation of Lightsail resource management and integration into developer workflows.

SEE ALSO

aws lightsail (AWS CLI Reference), aws(1) - The main AWS CLI command., ssh(1) - For securely connecting to Lightsail instances., scp(1) - For transferring files to/from Lightsail instances., curl(1) - For direct API interaction (less common for Lightsail than CLI, but fundamental for web requests).

Copied to clipboard