4 min read

How to create automatic backups in Jira Cloud

Many of our customers come to us with the desire or requirement to be able to automatically back up their Jira cloud data. However, Atlassian currently does not officially offer data rollback upon customer request. Therefore, it is important to create a site backup on a regular basis. The backup will help you, for example, if data on a site is lost due to the user's work. In this article we will describe how to achieve this functionality using RestAPI and scripts. We will first take a look at automation for Jira and then introduce Powershell, Python or Linux scripts that make this possible. We will also include some useful add-ons if you want a ready-made solution from Atlassian's Marketplace.


Jira Cloud Backup Limitations

Currently, there are no scheduled backups or download features for Jira Cloud. A backup can only be created every 48 hours. However, that doesn't mean it can't be done! Here are our solutions for automatic data storage in Jira Cloud:

 

Solution 1: How to use automations for a Backup

With the help of automations in Jira Cloud, it is possible to trigger the creation of a backup automatically. This ensures that your data is not lost and is always available. The only thing that cannot be automated is the download of this data.

 
Step-by-step run-through
  1. You will first need an Administrator account and the corresponding login data.

  2. You will need to use Base64 coding, to create your access token. You can access Base64 here https://emn178.github.io/online-tools/base64_encode.html

    • First, you need to access the account's API token from this page https://id.atlassian.com/manage-profile/security/api-tokens.

    • Then create a token and save it.

    • Launch the encoder and insert the credentials as follows: "{your email}:{your token}"

      Base64 Encode
    • Close and save it: you'll need it later!

  3. Then you need to set up an automation to schedule a backup.

    • Go to your automation page and create an automation.

    • Add 'Scheduled Trigger' and define an extended cron expression. For example, you can use 0 0 9 ? * 1.4. This would create backups on Monday and Thursday at 9am. Remember that you can only get backups every 48 hours.

      Automation schedule
    • Now you need to add the action "Send web request".

    • In this web request, define the details as follows and change "yoursitename" and "yourtoken".

      Automation webhook
    • After that you can run the rule manually and check the results, as shown in this screenshot:

      Automation logs

       

 

✅Advantages of this solution
  • You have the option to automatically create backups every 3 to 4 days to ensure that you can download the latest backup when needed.

 

❌ Disadvantages
  • You will always only have the last fuse.

  • You have to manually download the backup.

  • This solution is run with Automations on Jira, so it is also limited by the execution numbers for Automation on Jira.

  • The backup is only available for 14 days on Jira and 7 days on Confluence.


 

Solution 2: Run script on Windows server or Linux client

In this solution we will provide you with scripts that you can run on your own client. The step-by-step instructions are for Windows clients only, but the other scripts can be used for Linux clients as well. You will need to run these scripts on your own hosted servers. Furthermore, for this solution you need administrator rights for your instance.


 

Step-by-step run-through
  1. First download the script here: https://bitbucket.org/atlassianlabs/automatic-cloud-backup/src/master/backup-jira-api-token.ps1 and save it, as it is. 

  2. You also need to create a token here: https://id.atlassian.com/manage-profile/security/api-tokens erstellen

  3. Replace the script for your own website:

    • Replace the part with ' ' in line 2 with the name of your website. For example, if your website is called examplesite.atlassian.net, you only have to write 'examplesite'.

    • Replace line 3 with your email.

    • Replace line 4 with the token you got in step 2.

    • Replace line 5 with your backup directory. For example, if your directory is "C:\Users\Atlassian Backup Script", you should write "C:\Users\Atlassian Backup Script" to make sure it is created in that directory.

    • Lines 6 and 7 are optional. In this case, you would want line 6 to be true to get the attachments as well.

  4. After that you need to create a scheduled task in Windows Task Scheduler:

    Windows task scheduler
  5. Create a new task within the actions:

    Windows Task scheduler configuration
  6. First you need to define a trigger. The trigger is the defined schedule according to which you want to run the script. In this example we have defined the script to run every Monday and Thursday at 12:50. Remember that, again, a backup can only be performed every 48 hours.

    Windows Task scheduler Triggers
  7. Now you need to specify what you want to do. Go to "Actions" and add a new action.

    • You need to define PowerShell, as this is the program that runs the backup.

    • In the arguments you must specify the script address. You can use the browser for this.

      Windows Task scheduler actions
  8. Now you can create a backup under Windows. The backup may take longer than 1 hour for larger instances, so be sure to define the trigger to run longer than 1 hour.

  9. You can use this script here, to implement this solution as a Python script, or to implement it under Linux using this documentation , to define the Cron-Job.

 

Benefits of this solution 
  • You have your own server to run a job and directly download the backup file.

  • You can use this on Linux, Windows or in Python scripts.

 

❌ Disadvantages
  • The endpoints used in these scripts may change over time as they do not originate from Atlassian.

  • Your server/host must have a connection to Atlassian.

 


 

Solution 3: Atlassian Add-ons

Sometimes things have to happen quickly and you need a simple, out-of-the-box solution. There are several solutions for this in the Atlassian marketplace:

  • Rewind Backups for Jira Cloud: With this app, daily backups and data recovery for Jira Cloud can be implemented in an automated way.

  • Here you can access further alternatives from the Atlassian Marketplace.

 

Benefits of this solution
  • You can create daily backups.
  • Some applications, such as Rewind, also provide audit and monitoring logs.

 

❌ Disadvantages
  • For these solutions you need a subscription.

 

Conclusion 

Even though Atlassian itself does not (yet) offer automatic storage of your Jira cloud data, there are numerous ways to do it yourself and ensure the backup of your data. Whichever method you choose - automation, scripts or third-party apps - we'll be happy to help you implement it: We are happy to help you with the implementation and support you with any problems that may arise.

Contact us free of charge or obligation if you have any questions or suggestions:

 

Schedule a non-binding consultation!

 

 

Further subject-relevant resources: