How backups work
When you enable backups for your database:- Latitude.sh automatically creates full database backups according to your specified schedule.
- Backups are stored in your specified S3-compatible storage location.
- Backups are retained for the duration you configure.
- 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)
Testing your connection
In the database creation flow
- After configuring your S3 backup settings, click Test Connection.
- The system validates your credentials and permissions.
- If successful, you’ll see a success notification and can proceed with deployment.
- If failed, review the specific error message and resolve the issue.
In the database overview (existing databases)
- Navigate to your database overview page.
- Configure or modify your backup settings.
- Click Test Connection before applying changes.
- 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:
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
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:- Click Set up scheduled backup when creating a database or navigate to the Backups tab for an existing database.
- Enter the name of your S3 bucket and specify the backup path where the backups will be stored (E.g.
/backups
). - Provide your S3 Endpoint.
- Enter your Access Key ID and Secret Access Key.
- 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). - In the Retention field, enter how many days backups should be kept (E.g. 30 days).
- Test your S3 connection by clicking Test Connection to ensure your credentials and permissions are correctly configured.
- Click Save (create a new database) or Apply (modify an existing database) to save the backup configuration (available only after successful connection test).
Managing Backups
To view and manage your database backups:- Navigate to Databases in the sidebar menu.
- Select the database you want to manage backups for.
- Click on the Backups tab on the database overview page.
- 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:- Navigate to Databases in the sidebar menu to view your list of databases.
- 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.
- Select Restore from backup from the dropdown menu.
- Choose the specific backup point you want to restore from.
- Provide a name for your new database.
- Select a plan and specifications. Note that the plan must be equal to or higher than the source database’s plan.
- 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:- Navigate to Databases in the sidebar menu.
- Click on the name of the database that has the backup you want to restore from.
- Navigate to the Backups tab.
- Find the backup you want to restore and click the Restore button.
- Follow the prompts to select a specific backup, name your new database, and choose appropriate specifications.
- Click Deploy to create the new database from the backup.
Method 3: From the Backups tab
- Navigate to Databases in the sidebar menu.
- Select the database that has the backup you want to restore from.
- Click on the Backups tab on the database overview page.
- Find the backup you want to restore from in the backup list.
- Click the New from backup button next to the backup (only available for completed backups).
- 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:- Navigate to Databases in the sidebar menu and click Restore from backup.
- Select a source database and choose the backup you want to use. If no databases appear, ensure backups have been created.
- Provide a name for your new database.
- 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.
- 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:- 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.
- 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.
- Secure your S3 credentials: Ensure that the S3 credentials used for backups have appropriate permissions and are securely stored.
- 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:
- Verify S3 credentials: Ensure your S3 access key and secret key are correct and have appropriate permissions.
- Check S3 bucket existence: Confirm that the specified S3 bucket exists and is accessible.
- Validate cron expression: If using a custom schedule, verify that your cron expression is correctly formatted using a 6-field format.
Restoration Issues:
- Ensure sufficient permissions: Verify you have permissions to create databases in your project.
- Check for successful backups: Confirm that the source database has successful backups available.
- Review database logs: If the restoration fails, check the database logs for specific error messages.