How to configure AWS Lightsail credentials
Connect Hatchbox to AWS Lightsail with an access key that only manages Lightsail
Updated
AWS Lightsail is Amazon's flat-priced alternative to EC2. The disk, a public IPv4 address and several terabytes of transfer are included in each plan's price, so a Lightsail server costs about the same as a DigitalOcean droplet of the same size. Hatchbox creates and manages Lightsail servers with an IAM access key that only has Lightsail permissions.
Create an IAM user for Hatchbox
- Open IAM Users in the AWS console and create a user named Hatchbox. It doesn't need console access.
- Give the user a policy that allows Lightsail. The simplest is a custom policy allowing
lightsail:*. If you'd rather allow only what Hatchbox uses, create a policy with this JSON:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"lightsail:GetRegions",
"lightsail:GetBundles",
"lightsail:GetBlueprints",
"lightsail:CreateInstances",
"lightsail:GetInstance",
"lightsail:DeleteInstance",
"lightsail:PutInstancePublicPorts",
"lightsail:TagResource"
],
"Resource": "*"
}]
}- Open the user's Security credentials tab, create an access key for an Application running outside AWS, and copy the Access Key ID and Secret Access Key. AWS only shows the secret once.
Connect a cluster
Create a new cluster, choose AWS Lightsail, and enter the Access Key ID and Secret Access Key. Then pick the region for the cluster's servers and add your servers. The size list shows Lightsail's plans with a public IPv4 address. Lightsail's cheaper IPv6-only plans aren't listed, because Hatchbox connects to servers over IPv4.
How Hatchbox sets up Lightsail servers
- Firewall: Lightsail puts its own firewall in front of each server, which only opens SSH and HTTP on a new one. Hatchbox opens it fully and manages the firewall on the server itself instead, the same as on other providers. Use the server's Firewall tab in Hatchbox to add or remove rules.
- Private network: servers in the same region talk to each other over their private IP addresses, so your app reaches its database without going over the internet.
- Public IP addresses: Lightsail gives a server a new public IP when it's stopped and started. Each server tells Hatchbox its new address when it boots, but DNS records you manage yourself need updating. For a server your domains point at, consider attaching a Lightsail static IP.