Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to migrate Bitbucket to AWS

I'm incredibly frustrated. I've been trying to migrate our Bitbucket server from a local VM to AWS and I can't get it to work. I started with then used the server template from We backed up our existing server using Bitbucket Server Backup Client so I went to

But here's where I started to have trouble. The server seemed to have a demo project in /var/atlassian/application-data/bitbucket but the additional storage (200GB) appeared under /media/atl/bitbucket/:

$ df -hl
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.9G 80K 1.9G 1% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/xvda1 50G 43G 6.9G 87% /
/dev/xvdb 15G 39M 15G 1% /media/ephemeral0
tank/atlassian-home 193G 66M 193G 1% /media/atl
tank 193G 0 193G 0% /tank

I stopped the server:

sudo -u atlbitbucket /opt/atlassian/bitbucket/bin/

then tried using:

sudo -u atlbitbucket /opt/atlassian/bitbucket/bin/ /media/atl/bitbucket

I couldn't figure out the parameters for the restore. After some guesswork I took the username and password from /var/atlassian/application-data/bitbucket/shared/, then guessed at the database host and port:

sudo java -Djdbc.override=true -Djdbc.driver=org.postgresql.Driver -Djdbc.url=jdbc:postgresql://localhost/bitbucket -Djdbc.user=atlbitbucket -Djdbc.password=#### -Dbitbucket.home=/media/atl/bitbucket/ -jar bitbucket-restore-client.jar bitbucket-20181024-233703-804.tar

But then I got "The target database contains tables whose names collide with Bitbucket's tables. Please migrate to a clean, empty database."

So I used:

sudo -u atlbitbucket psql -d bitbucket -U atlbitbucket

then this code to clear the database

I finally got the restore to work and I reran the server  but now when I open the URL it redirects to It's likely that one of my previous steps has screwed something up but I have no idea because of the complete lack of documentation around this.

Does anyone have any experience with this? Once I get the damned thing working I'm going to write up a blog post so nobody else has to go through this stupidity.



2 answers

1 vote
Emily Chan Atlassian Team Jan 13, 2020

Hi @tomisaacson and Community!

We've just built the beta of a solution to help ease migrations from Server/Data-Center-on-prem to Data-Center-on-AWS-Quickstarts.

Would you be interested to join our beta program and try out this solution? If you're interested, or would like to find out more, please email me at 

That looks like Bitbucket can't talk to the database, so it's starting up as if it was a fresh install.

Can you check your database connection settings in your

Also check /var/atlassian/application-data/bitbucket/log/atlassian-bitbucket.log to see if there are any connection errors shown there.



I can't see anything that looks like an error in the log, but not sure what I'm looking for.

# primary db url


Maybe try and add the port number as above..


Also, I see that you are using a non-standard install location, as in /media instead of /var. That complicates things slightly. Make sure the shell scipts in /opt/atlassian/bitbucket/5.15.0/bin/ are using the /media path rather than /var.

How do I know what the port number is? That's part of my problem, none of this is documented in the setup instructions.

I'm using a non-standard install location because I need more storage in my VM and that's where AWS adds it. How else should I be doing this?

The default port is 5432 for postgres. You can confirm that postgres is running on that port with:

netstat -anp | grep 5432

Let's make that change first and go from there.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

473 views 5 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you