What's the correct URI format when creating scheduled backups from CockroachDB to a linode s3 bucket?

Viewed 19

CockroachDB's documentation gives the example

CREATE SCHEDULE core_schedule_label
  FOR BACKUP INTO 's3://test/schedule-test-core?AWS_ACCESS_KEY_ID=x&AWS_SECRET_ACCESS_KEY=x'

How can I modify this to use an S3-compatible service like linode rather than AWS?

1 Answers

The format is very similar; you just need to override the endpoint with your actual linode endpoint. A linode s3 URI can look like

CREATE SCHEDULE my_own_backup_schedule FOR BACKUP INTO 's3://test/schedule-test-core?AWS_ACCESS_KEY_ID=accesskeyid&AWS_SECRET_ACCESS_KEY=secret&AWS_REGION=us-east-1&AWS_ENDPOINT=https://us-east-1.linodeobjects.com'

Note that the AWS_ENDPOINT is just the host, not the full endpoint with the bucket name. On older versions of CockroachDB, providing the bucket name in AWS_ENDPOINT (like AWS_ENDPOINT=https://us-east-1.linodeobjects.com/test/schedule-test-core) worked, but in 22.1+ backups created like that may get the error "failed to list s3 bucket". You can fix this issue by creating a new backup schedule formatted as above and adding WITH SCHEDULE OPTIONS ignore_existing_backups so that you don't get an error like unexpected error occurred when checking for existing backups in s3 from validations in current code trying to use the older URI.

Related