Jenkins periodic backups in Amazon S3

Manivannan Selvaraj
2 min readOct 12, 2021

I added an enhancement to Jenkins periodic backup plugin to use Amazon S3 for Jenkins backups. This might be handy if you are using AWS infrastructure to run your Jenkins instance. Backing up in Amazon S3 comes with several advantages like

  • Cheaper than storing it on local disk.
  • Backup is safe even if the instance hosting Jenkins goes down/terminated.
  • Amazon takes care of availability and you don’t have to worry about it.

More information about Amazon s3 here.

Configuring Jenkins periodic backup plugin

For configuring the options like Backup Schedule, File Management, Storage Strategy etc. you can refer the plugin documentation.

Backing up in Amazon S3

To store your backup in AWS, Select “Amazon S3” under “Backup Location” -> “Add Location”

  • Add the s3 bucket you want your backups to be stored.
  • Select the region your s3 bucket is in from the drop down.
  • If the Jenkins instance is already configured with IAM role that has access to the s3 bucket, then you can leave “Amazon Credentials” as it is. Else select / add AWS credential from credentials plugin. For creating access key, refer https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/signup-create-iam-user.html
  • Check “Enable this location”
  • You can click on “Validate button” to see if your Jenkins instance is able to talk to configured S3 bucket successfully. If successful, you should see msg like : bucket “backup-test-maselvarj123” OK.
  • Click on “Save”. That’s it. Your Jenkins should backup its state to the schedule you’ve specified in the configuration.
  • Goto <your jenkins url>/periodicbackup/ to initiate a backup manually , see available backups, restore from a previous backup.

Hope you’re able to use the plugin to backup successfully in Amazon S3. Have fun :) !

Here is a cool video in Telugu made by someone that explains using periodic backup plugin to create backups in S3 : https://www.youtube.com/watch?v=PfA9_LXot7w

--

--