AWS from zero · Part 2: Networking and compute · Lesson 7 of 38 · about 35 minutes

Lightsail: the simple, fixed-price option

The simplest way to run a website on AWS: one monthly price that includes the server, disk, data transfer and a public address. The bakery's page goes live from the command line, answers in seconds, turns out to have SSH open to the whole internet, gets locked down, and is deleted with nothing left behind. Real prices from AWS, Lightsail against EC2, and the charges that keep running after you think you've stopped.

By the end you'll know

  • What Lightsail is, and how its flat monthly plans differ from paying for EC2 piece by piece
  • How to compare Lightsail's plans from the command line, with AWS's real prices
  • How to create a server that sets itself up at first boot, with no SSH at all
  • Why Lightsail opens SSH (Secure Shell, for remote logins) to the whole internet, and how to close it
  • What still costs money after you "stop" something, and how to check nothing's left
  • When Lightsail is the right choice, and when you've outgrown it

Before you start

  • You need: the juniper-rye profile from Lesson 4, signed in.
  • The script: lightsail-lab.sh from the practice folder's lesson-07. Everything it creates is named jr-lesson7-*, and its delete step removes it.
  • Where you run things: your own machine, labelled (Your machine).
  • Every output below is from a real run on November 9, 2026.

This lesson costs money while it runs

This is the first lab in the track that bills by the hour. The server costs $0.0068 an hour: the whole lab, about 15 minutes, comes to well under a cent, paid from your free plan credits. A server you forget costs $5.00 a month, and it keeps billing even when it's stopped. Run delete the same day, and check that everything shows 0.

The short version

  • Lightsail is AWS's simple hosting: one monthly price covers the server, its disk, a public IP address and a data transfer allowance.
  • The cheapest plan with a public IPv4 address is $5.00 a month. An IPv6-only plan is $3.50; the $1.50 difference is the IPv4 address.
  • For a small site it's cheaper and simpler than EC2: $12 a month buys what costs over $17 on EC2, before data transfer.
  • A server can set itself up at first boot from a launch script, so you never need to log in.
  • Lightsail opens SSH, port 22, to the whole internet by default. Close it if you don't need it.
  • Stopping isn't deleting. A stopped server still bills, and so do snapshots and unattached static IPs.

What this lesson costs

PartCost
Reading plans and prices$0
One nano_3_0 server for about 15 minutes$0.0068 an hour: about a fifth of a cent
Data transfer for one web page$0, inside the plan's 1,024 GB allowance
This lessonUnder one cent, from credits, and nothing left running
If you forget to delete it$5.00 a month, running or stopped

A serviced apartment for websites

In Lesson 1's places to live, EC2 is the apartment: you choose and pay for each part separately, the walls, the heating, the parking space. Lightsail is the same building, sold as a furnished flat at one monthly rent. It runs on EC2 underneath, but you pick a plan and get a server, a disk, a public address and a data allowance, all at one price.

It suits small, predictable things: a shop's website, a blog, a test server, a small app. When you need the full menu of EC2's sizes and networking, you move up, and Lightsail can export a server to EC2 when that day comes.

Plans and prices

In the console: Lightsail > Create instance lists the same plans and prices near the bottom of the page.

(Your machine)

BASH
cd ~/Apps/aws-practice/lesson-07
chmod +x lightsail-lab.sh
./lightsail-lab.sh fence
OUTPUT
== The cheapest Lightsail Linux plans in this Region (from AWS, prices a month)
  plan              a month  an hour  CPUs  memory   disk  transfer  public IPv4
  nano_ipv6_3_0    $   3.50 $ 0.0048     2   0.5GB   20GB    1024GB  no, IPv6 only
  micro_ipv6_3_0   $   5.00 $ 0.0068     2     1GB   40GB    2048GB  no, IPv6 only
  nano_3_0         $   5.00 $ 0.0068     2   0.5GB   20GB    1024GB  yes
  micro_3_0        $   7.00 $ 0.0096     2     1GB   40GB    2048GB  yes
  small_ipv6_3_0   $  10.00 $ 0.0137     2     2GB   60GB    3072GB  no, IPv6 only
  small_3_0        $  12.00 $ 0.0164     2     2GB   60GB    3072GB  yes
  medium_ipv6_3_0  $  20.00 $ 0.0274     2     4GB   80GB    4096GB  no, IPv6 only
  medium_3_0       $  24.00 $ 0.0329     2     4GB   80GB    4096GB  yes
== What the lab would use
  plan:  nano_3_0
  image: debian_12
  zone:  us-east-2a

This step creates nothing: it asks AWS for the plans, also called bundles, and picks the cheapest one with a public IPv4 address, plus a current Debian Linux image. Three things to notice:

  • Each IPv4 plan costs more than its IPv6-only twin: $1.50 more at the small end, $4.00 at the top. That's the public IPv4 address, the same charge Lesson 1 found on EC2, folded into the price. An IPv6-only plan is fine behind a load balancer or a CDN (content delivery network), but some visitors' networks still can't reach IPv6 directly.
  • The hourly price is the monthly price over 730 hours. You pay by the hour, so a server that runs for 15 minutes costs a fraction of a cent.
  • The transfer allowance covers data in and out. Going over it costs $0.09 a GB out of Ohio; data coming in is never charged.

Lightsail against EC2

Lesson 1 priced the bakery's shop on EC2. The same size of server on Lightsail:

EC2, from Lesson 1Lightsail small_3_0
Server, 2 CPUs and 2 GB of memory$12.26 (t4g.small)$12.00, all of it
Disk$1.60 for 20 GB
Public IPv4 address$3.65
Data out to the internet100 GB free a month, then charged
A month$17.51, plus data beyond 100 GB$12.00, with 60 GB of disk and 3,072 GB of transfer

For a small, steady site, Lightsail wins on price and on simplicity. What you give up comes later in this lesson.

Put the bakery's page online

In the console: Lightsail > Create instance: Linux/Unix, OS Only, Debian, then Add launch script and paste the script below, then pick a plan.

(Your machine)

BASH
./lightsail-lab.sh create
OUTPUT
== Created jr-lesson7-shop: plan nano_3_0, image debian_12, zone us-east-2a
   Billing has started. Run ./lightsail-lab.sh delete when you're done.

Under the hood, that's one CLI call:

BASH
aws lightsail create-instances --instance-names jr-lesson7-shop --availability-zone us-east-2a \
  --blueprint-id debian_12 --bundle-id nano_3_0 \
  --user-data file:///tmp/jr-lesson7-userdata.sh \
  --tags key=lesson,value=7 key=owner,value=juniper-rye

| Part | What it does | |---|---| | --blueprint-id debian_12 | The image: what's installed when the server starts. Lightsail calls images blueprints. | | --bundle-id nano_3_0 | The plan, from the price list above | | --availability-zone us-east-2a | A Lightsail server lives in one zone | | --user-data file://... | A launch script that runs once, as the administrator, the first time the server starts | | --tags ... | Labels, so it's obvious what this is and who it belongs to |

The launch script is what puts the bakery online without anyone logging in:

BASH
#!/bin/bash
# Runs once, as root, the first time the server starts.
if command -v apt-get >/dev/null; then
  apt-get update -y && apt-get install -y nginx
  root=/var/www/html
else
  dnf install -y nginx && systemctl enable --now nginx
  root=/usr/share/nginx/html
fi
cat > "$root/index.html" <<'HTML'
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><title>Juniper &amp; Rye</title></head>
<body><h1>Juniper &amp; Rye</h1><p>Sourdough, rye and morning buns. Open 7 to 3.</p></body></html>
HTML
systemctl restart nginx

It installs nginx, a web server, writes the bakery's page, and restarts nginx. It works on Debian and on Amazon Linux, which use different package tools. A server that sets itself up like this can be deleted and recreated in minutes, and that's the habit the rest of the track builds on.

Visit it

In the console: The instance's page shows its state and public IPv4 address. Open the address in a browser.

(Your machine)

BASH
./lightsail-lab.sh status
OUTPUT
== Waiting for jr-lesson7-shop to run
  state: running
  public address: 3.147.238.182
== Fetching the page (the web server installs itself at first boot, so this can take a few minutes)
  after about 10 seconds:
    <!doctype html>
    <html lang="en"><head><meta charset="utf-8"><title>Juniper &amp; Rye</title></head>
    <body><h1>Juniper &amp; Rye</h1><p>Sourdough, rye and morning buns. Open 7 to 3.</p></body></html>

The script waited for the server to report running, then fetched http://3.147.238.182/ with curl until the page appeared: the launch script had already finished by then. curl shows the raw HTML. Now open the address from your own run in a browser, with http:// in front, while the server is still running:

The bakery's page, live on the internet from a $5 server. A second run got a different address: each new server gets a new one.

That's a real website: anyone, anywhere, could open it. Two things give away that it's not finished. It's an IP address, not a name like juniperandrye.com, and the browser says Not Secure because there's no HTTPS (HyperText Transfer Protocol Secure) certificate. Lesson 14 adds both. The address belonged to this server only while it existed; it went back to AWS when the server was deleted, which is why the second run, in the screenshot, got a different one.

The door left open

In the console: The instance > Networking tab > IPv4 Firewall: delete the SSH rule.

(Your machine)

BASH
./lightsail-lab.sh firewall
OUTPUT
== Ports open on jr-lesson7-shop, as created
  tcp  80     open    from 0.0.0.0/0, ::/0
  tcp  22     open    from 0.0.0.0/0, ::/0
== After closing everything except the website (port 80)
  tcp  80     open    from 0.0.0.0/0, ::/0

Lightsail's firewall started with two ports open: 80, for the website, and 22, for SSH. Both are open from 0.0.0.0/0, ::/0, which means from every IPv4 and IPv6 address on the internet. Lightsail does that so its browser-based SSH works out of the box; it also means automated scanners start trying to log in within minutes of a server appearing.

This server never needs SSH, because the launch script did the setup. So the lab replaced the rules with just the website:

BASH
aws lightsail put-instance-public-ports --instance-name jr-lesson7-shop \
  --port-infos fromPort=80,toPort=80,protocol=tcp,cidrs=0.0.0.0/0,ipv6Cidrs=::/0

put-instance-public-ports replaces the whole list, so anything not in it is closed. If you do need SSH, open port 22 only from your own address, not the world.

Check the firewall on every server

A new Lightsail server accepts SSH from anywhere on the internet. Close port 22 if you don't need it, or limit it to your own address. Lesson 9 does the same job on EC2 with security groups.

Take it down, and check

In the console: The instance's menu (the three dots) > Delete. The Networking and Snapshots tabs on the Lightsail home page list static IPs, load balancers and snapshots.

(Your machine)

BASH
./lightsail-lab.sh delete
OUTPUT
== Deleted jr-lesson7-shop. Billing for it stops now.
== Left over in this Region
  servers:          0
  static IPs:       0
  extra disks:      0
  snapshots:        0
  load balancers:   0

Why check five kinds of thing, not just servers? Because these are the ways a "deleted" Lightsail site keeps billing:

Left behindStill costs
A stopped serverThe full plan price. Stopping doesn't pause billing; only deleting does.
A static IP not attached to a serverAbout $0.005 an hour
A snapshot, a saved copy of a server's diskAbout $0.05 per GB a month
An extra diskIts own monthly price
A load balancerIts own monthly price

All five at zero means nothing from this lab is billing.

When to use Lightsail, and when not to

Lightsail fits whenEC2 fits better when
A small site or app with steady trafficTraffic swings a lot, and you want to scale automatically (Lesson 12)
You want one predictable monthly priceYou need a particular CPU, lots of memory, or GPUs
The simple firewall is enoughYou need your own network design: private subnets, routing (Lesson 8)
You'll manage a handful of serversMany servers, built and changed by code (Lesson 29)

Lightsail's plans run on burstable CPUs: fine for a shop's site, which is quiet most of the time, but not for something busy all day. And it's still a server you run: in Lesson 5's terms, you patch its operating system, just as on EC2.

In real systems

  • Lightsail runs plenty of real small businesses' sites, and agencies host clients' WordPress sites on it for the predictable bill.
  • Teams outgrow it gradually: a Lightsail server can be snapshotted and exported to EC2, and Lightsail can connect to a regular VPC (virtual private cloud, AWS's private network) when an app needs other AWS services privately.
  • Nobody sets servers up by hand at scale. Launch scripts, then images, then tools like Terraform and Ansible build servers the same way every time.
  • Open SSH is the first thing a security review flags. Teams use AWS Systems Manager instead of SSH where they can (Lesson 11).

Spot the problem

Work out what's wrong before you read the explanation.

"I stopped it, so it's free." A student finishes a Lightsail lab, clicks Stop on the server, and takes a snapshot "just in case". Two months later the bill shows $10 for Lightsail, plus a little for storage. What happened? A stopped Lightsail server still bills its full plan price, and the snapshot bills for its storage. Stopping only turns the server off; it still holds its disk and its place. The fix: delete the server, delete the snapshot unless it's really needed, and release any static IP. Then check: does ./lightsail-lab.sh check, or the console's Lightsail home page, show nothing left?

Keep this

RememberWhy
One price: server, disk, IPv4, transfer$5 a month for the smallest with a public IPv4 address
IPv6-only plans are cheaperThe public IPv4 address is what you're paying extra for
Launch scripts set servers upNo SSH, and the server can be rebuilt in minutes
SSH starts open to the internetClose port 22, or limit it to your address
Stopped still billsOnly delete stops the charge
Check servers, IPs, disks, snapshots, load balancersAll the ways a deleted site keeps costing

Where you are now

The bakery's page went live on AWS from one command, set itself up without anyone logging in, had its open SSH port closed, and was deleted with nothing left billing, for well under a cent. You can read Lightsail's prices, compare them with EC2's, and say when each fits. Lightsail hid the network from you; Lesson 8 opens it up: VPCs, subnets and route tables, the network every EC2 server and database in the rest of the track lives in.

Check yourself

  1. From the run, what does the nano_3_0 plan cost, and what's included?

  2. What's the difference between nano_ipv6_3_0 and nano_3_0?

  3. Who ran the commands that installed nginx on the server?

  4. Port 22 showed open from 0.0.0.0/0. What does that mean?

  5. You stop a Lightsail server and leave it for a month. What does it cost?

  6. Which site suits Lightsail best?

Key terms

  • Amazon Lightsail: AWS's simple hosting, with flat monthly plans.
  • Plan, or bundle: a Lightsail size and price: CPUs, memory, disk, transfer allowance, and whether there's a public IPv4 address.
  • Blueprint: a Lightsail image: the operating system, and sometimes an app, that a server starts from.
  • Launch script, or user data: a script that runs once, as root, the first time a server starts.
  • nginx: a popular web server.
  • Port: a numbered door on a server; 80 is the web, 22 is SSH.
  • SSH (Secure Shell): a way to log in to a server remotely.
  • 0.0.0.0/0, ::/0: every IPv4 address, and every IPv6 address.
  • Static IP: a public address you keep, even if you replace the server. Free while attached; charged when not.
  • Snapshot: a saved copy of a server's disk, billed for its storage.
  • Data transfer allowance: the data in and out a plan includes each month; only extra data out is charged.

Go deeper