Using Bitbucket Server DIY Backup in AWS
Configuring the Bitbucket Server DIY Backup in AWS
If you launched your Bitbucket instance via BitbucketServer.template or BitbucketDataCenter.template, there is already a copy of the Bitbucket Server DIY Backup tools pre-installed and pre-configured on your instance. Just SSH to your instance (the shared file server node in the case of Bitbucket Data Center), and run:
cd /opt/atlassian/bitbucket-diy-backup
git pull
./bitbucket.diy-backup.sh
If you launched your Bitbucket instance in AWS manually, you need to clone the Bitbucket Server DIY Backup repository and configure the variables manually.
git clone git@bitbucket.org:atlassianlabs/atlassian-bitbucket-diy-backup.git
cd atlassian-bitbucket-diy-backup
cp -i bitbucket.diy-backup.vars.sh.example-aws bitbucket.diy-backup.vars.sh
Then edit bitbucket.diy-backup.vars.sh
appropriately for your environment.
Once you have configured bitbucket.diy-backup.vars.sh correctly, you can then run your backups by typing:
./bitbucket.diy-backup.sh
See Using Bitbucket zero downtime backup for more information.
Setting up the instance role
The DIY backup and restore scripts use the AWS CLI toolset to do their job. These tools need to authenticate with AWS in order to gain access to your resources (EBS volumes, snapshots, etc). The recommended way of providing credentials to the instance is by launching it with an instance role that has a suitable policy attached. If you are using the Bitbucket Server CloudFormation template, it'll take care of creating a policy for you and attach it to the instance at launch time.
If you need to create your own policy, you can use this JSON object as an example of the minimum permissions required for an instance:
{
"Statement": [
{
"Resource": [
"*"
],
"Action": [
"ec2:AttachVolume",
"ec2:CreateSnapshot",
"ec2:CreateTags",
"ec2:CreateVolume",
"ec2:DescribeSnapshots",
"ec2:DescribeVolumes",
"ec2:DetachVolume"
],
"Effect": "Allow"
}
],
"Version": "2012-10-17"
}
For other ways of configuring the AWS CLI toolset, please refer to the documentation.