Automate backups for Jira Cloud
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
Jira Cloud doesn't automatically back up data. You can back up data (excluding attachments) anytime. Backups with attachments require 48 hours between each backup.
Automate Cloud backups using Jira Automation
Jira automation can help you automate your cloud site backups without requiring custom scripts or programming experience.
This workaround makes use of the Send web request automation action along with a Jira API key generated by a Jira/Confluence administrator.
Info 1
This approach is not officially supported and is currently maintained by the community. Consider voting for CLOUD-6498 to show your interest in official support.
Info 2
Importantly, in this approach, we skip downloading the created site backups to any local machine simply because it's better than nothing. It is recommended for sure to download site-backups if you can. To do so, use the bash scripts listed below:
Create and encode the API token
1. Create an API token using your site-admin account at https://id.atlassian.com/manage/api-tokens.
2. Encode your credentials "$EMAIL_ADDRESS:$API_TOKEN" with base64 or go with any online tool like Base64 Encode. Make sure not to include a line break at the end.
Encode your API token
$ echo -n "site-admin@example.com:123e4567-e89b-12d3-a456-426614174000" | base64
c2l0ZS1hZG1pbkBleGFtcGxlLmNvbToxMjNlNDU2Ny1lODliLTEyZDMtYTQ1Ni00MjY2MTQxNzQw
MDA=
Besides, for those using IP Allowlisting, include the egress IP ranges introduced at IP addresses and domains for Atlassian cloud products #Outgoing Connections.
You can also find more detailed steps on how to perform this action on the following Community article:
Create a rule for Confluence site-backup
Although you can start with either Jira or Confluence, we'll look into how to configure a rule for Confluence first.
1. Set up the schedule.
- Add the content below to Cron expression.
- Select "simply run the conditions and actions without providing issues" for When rule executes.
0 0 19 1/3 * ?
2. Add an action - Send web requests
- Webhook URL: {{baseUrl}}/wiki/rest/obm/1.0/runbackup
- Headers:
- Authorization: Basic <The output we got above>
3. Add another action - Log action
- To be able to keep track of what we got with the webhook request, specify {{webhookResponse}} in Log message.
4. Name the rule "Site backup - Confluence Cloud" and save the setting.
5. Do a test run with [Run rule] button.
- The log then will be available in the Audit log.
6. Check the download link.
Cron expression
Each backup should be performed after a 48-hour interval at least. We here are going to schedule the execution twice a week on Monday and Thursday. Also, make sure to avoid maintenance windows for your site. For example, suppose your company sits in EST, specify 9 am in UTC:
0 0 9 ? * 1,4
Webhook body
{"cbAttachments":"true"}
Create a rule for Jira site backup
In Jira, there are only a few details different from Confluence.
1. Schedule - same
2. Action - Send web request
- Webhook URL: {{baseUrl}}/rest/backup/1/export/runbackup
3. Remaining procedures - same
Cron expression
Same here, on Monday and Thursday at 9 am in UTC:
0 0 9 ? * 1,4
Webhook body
{"cbAttachments":"true", "exportToCloud":"true"}
A few things to be aware of
- Jira has an upper bound on rule executions per subscription plan. That means you will not get a backup if exceed the limit. So consider upgrading to Premium, especially if you already have a respectable number of existing global automation rules.
- The backup link will be available for 14 days for Jira and 7 days for Confluence. The link then will be replaced by the subsequent one. That means you will only be able to retrieve the backup file until the next backup ends. So make sure to download the backup file as soon as you find any data loss; otherwise, the backup link will be replaced with the one taken after the data loss.
The steps from this documentation are originally from the following article in Atlassian Community: Automate online site-backups for Jira and Confluence without programming
If you have questions or suggestions, feel free to add a comment in the community article.