# How to configure AWS Lightsail credentials

Connect Hatchbox to AWS Lightsail with an access key that only manages Lightsail

AWS Lightsail is Amazon&#39;s flat-priced alternative to EC2. The disk, a public IPv4 address and several terabytes of transfer are included in each plan&#39;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](https://console.aws.amazon.com/iam/home#/users) in the AWS console and create a user named **Hatchbox**. It doesn&#39;t need console access.
- Give the user a policy that allows Lightsail. The simplest is a custom policy allowing `lightsail:*`. If you&#39;d rather allow only what Hatchbox uses, create a policy with this JSON:

```
{
  &quot;Version&quot;: &quot;2012-10-17&quot;,
  &quot;Statement&quot;: [{
    &quot;Effect&quot;: &quot;Allow&quot;,
    &quot;Action&quot;: [
      &quot;lightsail:GetRegions&quot;,
      &quot;lightsail:GetBundles&quot;,
      &quot;lightsail:GetBlueprints&quot;,
      &quot;lightsail:CreateInstances&quot;,
      &quot;lightsail:GetInstance&quot;,
      &quot;lightsail:DeleteInstance&quot;,
      &quot;lightsail:PutInstancePublicPorts&quot;,
      &quot;lightsail:TagResource&quot;
    ],
    &quot;Resource&quot;: &quot;*&quot;
  }]
}
```

- Open the user&#39;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&#39;s servers and add your servers. The size list shows Lightsail&#39;s plans with a public IPv4 address. Lightsail&#39;s cheaper IPv6-only plans aren&#39;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&#39;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&#39;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.
