Skip to content
Tutorials Center
My learning

Topics

Lesson 16 of 70 ยท Compute with EC2

Amazon Lightsail

Learn Amazon Lightsail: fixed-price instances, static IPs, managed databases, load balancers, a WordPress setup, how it compares with EC2, and when to move to full AWS.

Launching an EC2 instance means choosing an AMI, an instance type, a VPC, a subnet, a security group, a key pair and a storage volume, then separately allocating an Elastic IP and setting up a database. That is the right amount of control for an engineer. It is a lot for someone who wants to publish a WordPress blog or run a small web app for a client.

Amazon Lightsail is AWS's simplified product for exactly that person. You choose an operating system or an application, pick a plan with a fixed monthly price, and get a running server with a few clicks. Networking, storage, a static IP, DNS, a firewall, backups, a database and a load balancer are all part of the same simple console.

Lightsail cannot run on this site. The CLI commands are real, read-only examples, and the plans mentioned are described in general terms, because prices change. The Python programs are stand-ins with invented numbers: a cost comparison and a "should I move off Lightsail?" checklist.

What you get

Instances are virtual servers. Each plan (called a bundle) bundles vCPUs, memory, an SSD, and a monthly data transfer allowance at one price per month. Compared with EC2, there are no separate line items for storage, public IP or most of the transfer.

Blueprints are ready-made starting images:

  • Operating systems only: Amazon Linux, Ubuntu, Debian, Windows Server and others.
  • Apps: WordPress, LAMP, Node.js, Django, Joomla, Magento, GitLab and similar, already installed and configured.

Static IP addresses are free while attached to an instance, and they keep the same address when you stop and start the instance. A new instance gets a dynamic public IP that changes, so attach a static IP before you point DNS at it.

Firewall. Each instance has a simple firewall: a table of allowed protocols and ports (for example TCP 80, 443 and 22). You can limit SSH to your own address. It is similar to a security group with fewer options.

Managed databases offer MySQL or PostgreSQL with automatic backups and a fixed monthly price, in a standard or high-availability plan with a standby in a second zone.

Load balancers distribute traffic over several instances and handle HTTPS certificates for you (free certificates for a domain that you validate).

Other pieces: snapshots (manual and automatic daily ones), block storage disks that you can attach to an instance, DNS zones for your domain, a CDN distribution based on CloudFront, object storage (S3-like buckets with a fixed plan) and a container service for running Docker images.

Creating an instance

In the console it is three choices: Region and zone, blueprint, plan. With the AWS CLI it looks like this (read-only):

Terminal
aws lightsail create-instances \
  --instance-names blog \
  --availability-zone eu-west-1a \
  --blueprint-id wordpress \
  --bundle-id small_3_0

aws lightsail allocate-static-ip --static-ip-name blog-ip
aws lightsail attach-static-ip --static-ip-name blog-ip --instance-name blog

aws lightsail open-instance-public-ports \
  --instance-name blog \
  --port-info fromPort=443,toPort=443,protocol=TCP

Blueprint and bundle IDs change over time. List the current ones with aws lightsail get-blueprints and aws lightsail get-bundles.

A WordPress site step by step

  1. Create an instance with the WordPress blueprint and a small plan.
  2. Attach a static IP so the address will not change.
  3. Log in over SSH (the browser-based SSH button needs no key setup) and find the generated admin password: the console shows the exact command for your blueprint, which reads it from a file on the server.
  4. Point your domain at the static IP: create a Lightsail DNS zone, add an A record, and set your registrar's name servers to the four Lightsail ones. See Route 53 and DNS for how records work.
  5. Enable HTTPS. Follow the blueprint's documentation for a free Let's Encrypt certificate, or put a Lightsail load balancer or CDN in front, which provides managed certificates.
  6. Turn on automatic snapshots and test a restore. A backup you never restored is only a hope.
  7. Move the database to a managed Lightsail database when the site grows, so that updating the server does not threaten the data.

Lightsail or EC2?

Lightsail EC2
Pricing Fixed monthly plans, transfer included Pay per second plus separate storage, IP and transfer
Setup A few choices, application blueprints Full control of networking, storage and images
Networking Simple firewall, optional peering to your VPC Full VPC, subnets, route tables, NAT, endpoints
Scaling Larger plan or more instances behind a load balancer Auto Scaling groups, spot, hundreds of instance types
Integration Limited set of services Everything on AWS
Best for Small sites, dev servers, simple apps, learning Production systems that will grow or need fine control

A cost sketch makes the difference clear. The prices below are invented to show the shape: Lightsail has one price, while EC2 has a sum of items, and a busy site pays for data transfer beyond the allowance.

Python Fixed plan or itemized bill?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

For small sites the fixed plan is both simpler and cheaper. Notice that the bill jumps once traffic passes the allowance (here at 2,000 GB), whichever service you use. At that point the better answer is often a CDN in front of the server, not a different server. Run your own numbers with real prices before deciding.

Connecting Lightsail to the rest of AWS

A Lightsail instance does not live in your default VPC. If it must talk to an RDS database, an ElastiCache cluster or an EC2 instance privately, enable VPC peering in the Lightsail settings for the Region, then add the right security group rules on the other side. You can also use the AWS SDK from a Lightsail server, with an IAM user's keys or a role. See VPC connectivity for peering concepts.

When to move off Lightsail

Lightsail is not a toy, and many sites run there for years. It is time to move to EC2, ECS or another service when:

  • you need Auto Scaling, fleet management or many environments,
  • you need private subnets, a NAT gateway, fine-grained network ACLs or flow logs,
  • your team wants infrastructure as code for everything (CloudFormation or Terraform covers EC2 far better),
  • you need instance types or features that no plan offers (large memory, GPUs, spot capacity),
  • you need advanced compliance controls or tighter IAM integration.

Moving is possible: a Lightsail instance snapshot can be exported to Amazon EC2, where it becomes an AMI and a new EC2 instance. Plan a maintenance window, because the IP and security setup change.

Python Should this workload move off Lightsail?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Good habits

  • Always attach a static IP and create DNS records pointing to it.
  • Restrict SSH to your IP and keep the system updated. A WordPress site needs updates for core, themes and plugins.
  • Enable automatic snapshots, and keep a copy of important data off the instance.
  • Watch the transfer metric: going over the allowance incurs extra charges.
  • Delete test instances and unused static IPs. A static IP that is not attached to any instance is billed.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What is the main pricing difference between Lightsail and EC2?

    A Lightsail bundle has one monthly price covering compute, disk and a data transfer allowance. EC2 charges separately for each component.
  2. 2. Why attach a static IP to a Lightsail instance?

    A default public IP can change. A static IP is a fixed address that you can point DNS at.
  3. 3. Which need is a good reason to move from Lightsail to EC2?

    Auto Scaling and detailed VPC design are EC2-level features. Lightsail aims at simple, fixed setups.
  4. 4. How can a Lightsail instance reach an RDS database in your VPC privately?

    Lightsail has its own network. Peering connects it to your default VPC in the Region.
  5. 5. What can you do with a Lightsail snapshot when you outgrow the service?

    Snapshots can be exported to EC2, which gives you a standard AMI and instance.

Summary

  • Lightsail packages a virtual server, disk, transfer allowance, static IP, firewall, DNS, databases and load balancers into simple fixed-price plans.
  • Blueprints such as WordPress give you a working app in minutes. Attach a static IP, point DNS at it, enable HTTPS and automatic snapshots.
  • Lightsail is cheaper and simpler than EC2 for small, steady workloads, and EC2 gives more control and scaling.
  • Peering links Lightsail to your VPC when you need private access to other AWS resources.
  • Move to EC2, ECS or other services when you need Auto Scaling, advanced networking, infrastructure as code or special hardware. A snapshot export makes the move possible.

Next: VPC Fundamentals