Skip to main content
Latitude.sh Databases offers scheduled backups to S3-compatible storage, allowing you to protect your data and restore it when needed. Backups are a critical component of any production database strategy, ensuring business continuity and data protection. Restoring a database from a backup is a vital operation that allows you to recover your data in case of accidental deletion, corruption, or when you need to create a copy of an existing database.

How backups work

When you enable backups for your database:
  1. Latitude.sh automatically creates full database backups according to your specified schedule.
  2. Backups are stored in your specified S3-compatible storage location.
  3. Backups are retained for the duration you configure.
  4. You can restore from any available backup when creating a new database.

Testing S3 connection

Latitude.sh requires you to test your S3 connection before deploying a database with scheduled backups enabled. This ensures that your backups will run successfully and prevents deployment issues.

How it works

When you enable scheduled backups, the connection test validates that your S3 credentials have the necessary permissions by testing three essential operations:
  • PUT: Write backup files to your bucket
  • GET: Read backup files from your bucket
  • DELETE: Remove old backup files (retention policy)
The test creates temporary files in your specified backup path and cleans them up afterward, ensuring your S3 configuration works with the exact operations that the backup system requires.

Testing your connection

In the database creation flow

  1. After configuring your S3 backup settings, click Test Connection.
  2. The system validates your credentials and permissions.
  3. If successful, you’ll see a success notification and can proceed with deployment.
  4. If failed, review the specific error message and resolve the issue.

In the database overview (existing databases)

  1. Navigate to your database overview page.
  2. Configure or modify your backup settings.
  3. Click Test Connection before applying changes.
  4. The Apply button becomes available only after a successful test.

Connection test states

  • Idle: Ready to test connection
  • Testing: Validating S3 credentials and permissions
  • Passed: Connection successful, deployment/changes can proceed
  • Failed: Issues detected, must resolve before proceeding

Common issues and solutions

Authentication errors

  • Error: Invalid access credentials
  • Solution: Verify your S3 Access Key ID and Secret Access Key are correct

Permission errors

  • Error: Missing required permissions
  • Solution: Ensure your S3 credentials have the minimum required IAM permissions:
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:PutObject", "s3:GetObject", "s3:DeleteObject"],
      "Resource": "arn:aws:s3:::your-bucket-name/your-backup-path/*"
    }
  ]
}

Network connectivity errors

  • Error: Cannot reach storage endpoint
  • Solution: Verify your S3 endpoint URL is correct and accessible from your network

Bucket/path access errors

  • Error: Bucket not found or path access denied
  • Solution: Confirm the bucket name is correct, verify the backup path exists and is accessible, and check that your IAM policy allows access to the specific path

S3-compatible storage support

The connection test works with all S3-compatible storage providers, including:
  • Amazon S3
  • Cloudflare R2
  • DigitalOcean Spaces
  • Other S3-compatible services
Simply provide the correct endpoint URL for your storage provider.

Important notes

  • Connection testing is mandatory when backups are enabled
  • The deploy button remains disabled until the test passes
  • Tests run instantly without requiring a database to be running
  • Temporary test files are automatically cleaned up after testing
  • If your credentials or settings change, you must retest the connection

Configuring scheduled backups

When creating a new database or modifying an existing one, you can enable and configure scheduled backups:
  1. Click Set up scheduled backup when creating a database or navigate to the Backups tab for an existing database.
  2. Enter the name of your S3 bucket and specify the backup path where the backups will be stored (E.g. /backups).
  3. Provide your S3 Endpoint.
  4. Enter your Access Key ID and Secret Access Key.
  5. Use the Schedule (Cron) dropdown to set how often backups should run. For a custom schedule, enter a six-field cron expression (E.g. 0 0 3 * * * for daily backups at 3 AM UTC).
  6. In the Retention field, enter how many days backups should be kept (E.g. 30 days).
  7. Test your S3 connection by clicking Test Connection to ensure your credentials and permissions are correctly configured.
  8. Click Save (create a new database) or Apply (modify an existing database) to save the backup configuration (available only after successful connection test).
Once enabled, you’ll see a shield icon next to your database in the database list, indicating that backups are active. You can pause or resume backups at any time from the Backups tab by clicking the Manage button.

Managing Backups

To view and manage your database backups:
  1. Navigate to Databases in the sidebar menu.
  2. Select the database you want to manage backups for.
  3. Click on the Backups tab on the database overview page.
The Backups tab displays:
  • Backup Configuration Details: If backups are configured, you’ll see information about your S3 storage settings, schedule, and retention period.
  • Backup List: A table showing all available backups with their creation date and status (Running, Completed, or Failed).
  • Manage Button: Click this button to configure, pause, resume, or modify your backup settings.

Restoring a Database from a Backup

Latitude.sh provides multiple intuitive ways to restore databases from backups, ensuring this functionality is easily accessible when you need it most, especially in critical situations. Important: Restoring a database from a backup creates a brand new database instance—it does not restore data into your existing database. Both the original and new databases will run simultaneously and be billed separately. After verifying your restored database works correctly, remember to delete the old database if you no longer need it to avoid duplicate charges.

Prerequisites for Restoration

Before you can restore a database from a backup:
  • You must have at least one database with backups configured.
  • At least one successful backup must have been created.
  • You need appropriate permissions to create databases in your project.

Restoration Methods

Latitude.sh offers multiple straightforward ways to restore a database from a backup:

Method 1: From the Database List View

The most direct way to restore a database from a backup is directly from the database list view:
  1. Navigate to Databases in the sidebar menu to view your list of databases.
  2. Find the database with the backup you want to restore from and click the actions menu (three dots) on the right side of its row.
  3. Select Restore from backup from the dropdown menu.
  4. Choose the specific backup point you want to restore from.
  5. Provide a name for your new database.
  6. Select a plan and specifications. Note that the plan must be equal to or higher than the source database’s plan.
  7. Click Deploy to start the restoration process.

Method 2: From a Database’s Backups Tab

You can also initiate a backup restoration from a specific database’s backups tab:
  1. Navigate to Databases in the sidebar menu.
  2. Click on the name of the database that has the backup you want to restore from.
  3. Navigate to the Backups tab.
  4. Find the backup you want to restore and click the Restore button.
  5. Follow the prompts to select a specific backup, name your new database, and choose appropriate specifications.
  6. Click Deploy to create the new database from the backup.

Method 3: From the Backups tab

  1. Navigate to Databases in the sidebar menu.
  2. Select the database that has the backup you want to restore from.
  3. Click on the Backups tab on the database overview page.
  4. Find the backup you want to restore from in the backup list.
  5. Click the New from backup button next to the backup (only available for completed backups).
  6. Configure the new database as you would normally do when creating a new database.

Method 4: From the Database Creation Flow

You can also restore from a backup when creating a new database:
  1. Navigate to Databases in the sidebar menu and click Restore from backup.
  2. Select a source database and choose the backup you want to use. If no databases appear, ensure backups have been created.
  3. Provide a name for your new database.
  4. Choose a plan and specifications based on your requirements. Note that the selected plan must be equal to or higher than the source database plan.
  5. Click Deploy.

Important Considerations for Restoration

When restoring a database from a backup, keep these points in mind:
  • Both databases will run simultaneously: The restoration process creates a new database; it does not overwrite the existing one. You will be billed for both databases until you delete one of them.
  • Different connection string: The new database will have a different connection string than the original. You must update your application configuration to use the new connection string.
  • Typical workflow: Restore to new database → verify data integrity → update your application to use the new connection string → delete the old database once confirmed everything works.
  • Restoration time: The restoration time depends on the size of the backup.
  • Plan requirements: The new database must use a plan equal to or higher than the source database’s plan.
  • Complete data restoration: All data in the backup will be restored, including tables, indexes, and stored procedures.

Backup and Restoration Best Practices

For an optimal database backup and restoration strategy:
  1. Set appropriate frequency: Configure backup frequency based on how much data you can afford to lose. Critical applications might require hourly backups, while less critical ones might be fine with daily backups.
  2. Test your backups and restoration: Periodically create a test database from a backup to verify that your backups are working correctly and can be restored. Regularly testing your backup restoration process is recommended to ensure you can recover your data when needed.
  3. Secure your S3 credentials: Ensure that the S3 credentials used for backups have appropriate permissions and are securely stored.
  4. Consider retention periods: Set retention periods based on your compliance requirements and storage constraints.

Troubleshooting

If you encounter issues with your database backups or the restoration process:

Backup Issues:

  1. Verify S3 credentials: Ensure your S3 access key and secret key are correct and have appropriate permissions.
  2. Check S3 bucket existence: Confirm that the specified S3 bucket exists and is accessible.
  3. Validate cron expression: If using a custom schedule, verify that your cron expression is correctly formatted using a 6-field format.

Restoration Issues:

  1. Ensure sufficient permissions: Verify you have permissions to create databases in your project.
  2. Check for successful backups: Confirm that the source database has successful backups available.
  3. Review database logs: If the restoration fails, check the database logs for specific error messages.
If you continue to experience issues with backups or restoration, contact Latitude.sh support for assistance.
I