LanternlyDocs

Configure

Amazon Web Services plugin

The AWS plugin adds two things for people who host on Amazon: Create server, which makes a Lightsail VM that sets itself up and joins your servers, and Costs, which shows what AWS charges in the currency you choose.

Everything else in Lanternly works on AWS without this plugin: EC2 or Lightsail VMs added by hand, S3 or Lightsail buckets for backups. The plugin only adds convenience.

Turn it on

Settings → Plugins → Manage plugins → Amazon Web Services. It's off on a new install. Turning it off later hides Costs, Create server, AWS for new servers and Check Lightsail, and stops the cost timer. Servers it made stay listed and can still be deleted.

The plugin uses two separate AWS keys, each with the least it needs:

KeyUsed forCan it change things?
Costs key (for example IAM user lanternly-costs)Reading Cost Explorer, Free Tier and Lightsail plan pricesOnly the one AWS budget the console keeps
Servers key (for example lanternly-provision)Creating and deleting Lightsail VMsOnly VMs it tagged as its own, in one region

Costs

Costs in the side menu (owners only) shows:

  • This month so far, the forecast for the month and last month.
  • What you pay each day for the last 31 days (UTC days, as AWS counts them; today is still counting).
  • By AWS service after credits, and a breakdown of Lightsail: VMs, buckets, static IPs, data transfer, snapshots, databases and load balancers.
  • Credits and free tier: charges, credits and what you actually paid each month, credits left and when they'll run out at the current pace, and free tier use this month.
  • Each project, a month (estimate): each server's plan price shared between the projects running on it. Also shown on the Projects pages.

Numbers are fetched once a day (and again 3 hours after a failure), or when you press Refresh now.

Connect AWS for costs

  1. In the AWS console, Billing → Cost Explorer: turn it on if it isn't. The first numbers take up to a day.
  2. Account → IAM user and role access to Billing information: turn it on.
  3. IAM → Users → Create user (for example lanternly-costs, no console access). Add the policy below as an inline policy.
  4. On the user, Security credentials → Create access key ("Application running outside AWS").
  5. On Costs → Connect AWS, paste both parts and the Lightsail region your servers are in (for example eu-central-1), and save.
{
  "Version": "2012-10-17",
  "Statement": [
    { "Sid": "ReadCosts", "Effect": "Allow",
      "Action": ["ce:GetCostAndUsage", "ce:GetCostForecast"], "Resource": "*" },
    { "Sid": "ReadCreditsAndFreeTier", "Effect": "Allow",
      "Action": ["freetier:GetFreeTierUsage", "freetier:GetAccountPlanState"], "Resource": "*" },
    { "Sid": "ReadLightsailPlans", "Effect": "Allow",
      "Action": ["lightsail:GetInstances", "lightsail:GetBundles",
                 "lightsail:GetBuckets", "lightsail:GetBucketBundles"], "Resource": "*" },
    { "Sid": "KeepOneBudget", "Effect": "Allow",
      "Action": ["budgets:ViewBudget", "budgets:ModifyBudget"],
      "Resource": "arn:aws:budgets::*:budget/avro-deployer-monthly" }
  ]
}

The console shows this same policy on the Costs page, so you can copy it from there. A bucket's own access key can't be used: Lightsail bucket keys only open their bucket.

What it costs

Cost Explorer charges US$0.01 per request. A daily fetch makes four or five, about US$1.20 to US$1.50 a month. Set DEPLOYER_COSTS=off to stop the timer.

Show money in your currency

AWS bills in US dollars. Under Costs → Budget and alerts → Show money in, pick one of:

CodeCurrency
USDUS dollar (default; shown exactly as AWS bills)
EUR, GBPEuro, pound sterling
AUD, NZD, CAD, SGDAustralian, New Zealand, Canadian and Singapore dollars
INRIndian rupee
  • Other currencies are converted at the day's European Central Bank rate (from the free Frankfurter service). To match your invoice exactly, type the rate from your AWS invoice instead.
  • If the rate service can't be reached, the last known rate is used; failing that, the page shows US$ and says so.
  • Changing the currency fetches the numbers again. Check the budget afterwards, since it's in the chosen currency.
  • Dates follow the locale under Settings → Branding.

Budget and alerts

Set a Monthly budget (empty = no budget, spike alerts only). The alert addresses from Monitoring get an email:

  • at 50%, 80% and 100% of the budget (each once a month),
  • when the forecast goes over the budget (once a month),
  • on a spike: yesterday cost more than twice the 7-day average, by a meaningful amount (about US$1.30 or more),
  • when credits will run out or expire within 30 days.

Without an outgoing email account, press Save as AWS budget: AWS creates a budget named avro-deployer-monthly and emails the same people at 80% and 100% actual, and 100% forecast.

Promotional credits

AWS shows credits used, but has no API for how much of a credit code (AWS Activate, a promotion) is left. Copy the balance from AWS Billing → Credits into Credits left (US$) with its expiry date; credits used from that day on are taken off it. Accounts on the AWS free plan are read automatically.

Create a server

Owners can make a new Lightsail VM from Servers → Create server. It takes about 10 minutes and needs nothing from you after you press the button.

  1. Give it a name, such as Frankfurt 2. The page shows the name it gets in Lightsail.
  2. Pick a size. Each shows its monthly price in your Costs currency and what all your Lightsail plans would cost with it:
    SizeHolds about
    1 GBone small app, never shared
    2 GB2 services' worth of room
    4 GB5
    8 GB (default)10
    16 GB20
    Each size uses the cheapest current Lightsail Linux plan with that much memory and an IPv4 address.
  3. Press Create server and watch the steps on the page.

The console creates an Ubuntu 24.04 VM tagged as its own, gives it a static IP, opens ports 80 and 443 to everyone and 22 only to the deployer VM (plus Lightsail's browser SSH), and the VM runs the services setup on first boot. It fetches its setup with a one-time code that only works from the VM's own IP, reports progress back, and sends its host key when done. The console then checks it can reach the server over SSH and adds it to the list as Ready.

  • If a step fails, press Retry.
  • If the VM never reports back, press Discard: the VM and its static IP are deleted so they cost nothing.

What can stop a create

  • The limit: at most 5 servers made by the console, unless you raise it under AWS for new servers.
  • The budget: when the new server would take your monthly Lightsail plans over the Costs budget, tick Go over the budget to make it anyway.
  • Setup: the page lists anything missing: the key, an https:// DEPLOYER_URL, the certificate email, the console's SSH key.

Set up AWS for new servers (once)

Open Servers → AWS for new servers and fill in:

  • An access key for its own IAM user (not the costs key, which is refused), with the policy below.
  • The region (and zone) new servers go in.
  • The deployer's public IP: the only address allowed on SSH to new servers.
  • Most servers the console may make (default 5).
  • The email for HTTPS certificate notices.
  • Optional: a GitHub user and package token (read:packages) so new servers can pull private ghcr.io images.

The screen shows the exact policy for your region. It looks like this (for eu-central-1):

{
  "Version": "2012-10-17",
  "Statement": [
    { "Sid": "Read", "Effect": "Allow", "Resource": "*",
      "Condition": { "StringEquals": { "aws:RequestedRegion": "eu-central-1" } },
      "Action": ["lightsail:GetBundles", "lightsail:GetBlueprints", "lightsail:GetRegions",
                 "lightsail:GetInstance", "lightsail:GetInstances", "lightsail:GetStaticIp",
                 "lightsail:GetStaticIps", "lightsail:GetInstanceSnapshot",
                 "lightsail:GetInstanceSnapshots"] },
    { "Sid": "CreateOnlyTagged", "Effect": "Allow", "Resource": "*",
      "Action": ["lightsail:CreateInstances", "lightsail:TagResource"],
      "Condition": { "StringEquals": { "aws:RequestedRegion": "eu-central-1",
                                       "aws:RequestTag/avro-managed": "yes" } } },
    { "Sid": "ChangeOnlyTagged", "Effect": "Allow", "Resource": "*",
      "Condition": { "StringEquals": { "aws:RequestedRegion": "eu-central-1",
                                       "aws:ResourceTag/avro-managed": "yes" } },
      "Action": ["lightsail:PutInstancePublicPorts", "lightsail:CreateInstanceSnapshot",
                 "lightsail:DeleteInstance", "lightsail:DeleteInstanceSnapshot"] },
    { "Sid": "StaticIps", "Effect": "Allow", "Resource": "*",
      "Condition": { "StringEquals": { "aws:RequestedRegion": "eu-central-1" } },
      "Action": ["lightsail:AllocateStaticIp", "lightsail:AttachStaticIp",
                 "lightsail:DetachStaticIp", "lightsail:ReleaseStaticIp"] }
  ]
}

So the key can only create VMs that carry the console's tag, and only change or delete VMs with that tag. Static IPs can't be tagged, so the console only ever releases the ones it named itself.

Delete a server

Only servers the console made can be deleted from here, and only once nothing is on them. Open Edit on the server, type its name and press Delete this server. The console takes a last snapshot, deletes the VM and releases its static IP. The snapshot is kept 14 days (listed under Snapshots of deleted servers) so you can still make a VM from it in Lightsail, then deleted.

Check Lightsail

Once a day the console looks for Lightsail VMs tagged as its own that aren't on the Servers page, and deletes expired snapshots. Press Check Lightsail to do it now. Stray VMs are shown on the page and emailed to the alert addresses, because they still cost money.

Practice mode

With DEPLOYER_FAKE_ENGINE=1 and no key, Costs shows steady made-up numbers in the shape AWS sends, and Create server runs against a pretend Lightsail.

Edit this page on GitHub