How to automate Amazon Lightsail Snapshots

SimpleBackups founder

Laurent Lemaire

Co-founder, SimpleBackups

July 22, 2022

The following guide will help you, step by step, automate your Amazon Lightsail server snapshots & volume backups.

Afterwards, you will be able to take snapshots, automatically on your own terms, whether you need to take them daily, weekly, every couple of hours or on-demand using our API.

You will also have the option to choose the number of snapshots to keep on your provider to save snapshot storage cost.

Table of Contents

Prerequisites

Create your AWS credentials

In order for SimpleBackups to manage your Amazon Lightsail Snapshots, a IAM Users to be created with the right policies.

We will create a custom policy first to allow us to manage your Amazon Lightsail Snapshots. The policy will include the least required permissions to manage snapshots.

Create a custom Lightsail policy for snapshots

  • Connect to your AWS Console
  • Head to IAM/Policies management page
  • Click on "Create policy"
  • Click on JSON and paste the custom policy below:
    AWS Lightsail Snapshots Credentials

For your reference, here is the policy to copy and paste:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "lightsail:GetInstance",
                "lightsail:GetInstances",
                "lightsail:GetInstanceSnapshot",
                "lightsail:GetInstanceSnapshots",
                "lightsail:CreateInstanceSnapshot",
                "lightsail:DeleteInstanceSnapshot",
                "lightsail:GetDisk",
                "lightsail:GetDisks",
                "lightsail:GetDiskSnapshot",
                "lightsail:GetDiskSnapshots",
                "lightsail:CreateDiskSnapshot",
                "lightsail:DeleteDiskSnapshot",
                "lightsail:TagResource",
                "lightsail:UntagResource",
                "lightsail:CopySnapshot"
            ],
            "Resource": "*"
        }
    ]
}
  • Click on "Next: Tags" then "Next: Review"
  • Give the policy a name, "LightsailSnapshotsPolicy" then click on "Create policy"
    AWS Lightsail Snapshots Credentials

Create a Lightsail user for snapshots

In the "Add user" form fill in information shown below:

Step 1: Set user access

  • Define a name to your user.
  • Choose "Access key - Programmatic access" for "Select AWS Credential type".
    Amazon Lightsail Snapshots Credentials

Step 2: Attach policy to user

  • Select "Attach existing policies directly" and select "LightsailSnapshotsPolicy" (we created in the earlier step).
  • Select "Create user without a permission boundary" in the "Set permissions boundary" section.
    Amazon Lightsail Snapshots Credentials

Step 3: Finalize user creation

  • You don't have to add any specific tag, just click "Next".
  • Review and create the user.
    Amazon Lightsail Snapshots Credentials

Step : Copy your access and secret keys

Copy your "access key id" and secret "access key".
Amazon Lightsail Snapshots Credentials

With this done, you know have a IAM User with an access key and secret that we'll be able to use in SimpleBackups to automate your Amazon Lightsail Snapshots.

Connect your AWS Lightsail Account to SimpleBackups

We now have everything we need to connect your AWS account to SimpleBackups.

  • Connect to your SimpleBackups account
  • Head to the Snapshots/Create page
  • Click on "Connect a new provider"
    Amazon Lightsail Snapshots Credentials
In the "Select your provider" form, fill in the information below:

  • Provider: Select Amazon Lightsail
  • Name: Internal name. It doesn't necessarily have to match your AWS IAM User Name
  • Enter the "Access Key" and "Secret" generated in the previous step
  • Save
    Amazon Lightsail Snapshots Credentials

If saving this provider returns an error, make sure to validate that the IAM User associated to the Access Key you used has the right priviledges.

You're good to go! You can now configure and schedule your Amazon Lightsail instance & disk snapshots.



Back to blog

Stop worrying about your backups.
Focus on building amazing things!

Free 7-day trial. No credit card required.

Have a question? Need help getting started?
Get in touch via chat or at [email protected]

Customer support with experts
Security & compliance
Service that you'll love using