Keboola WIKI‎ > ‎Recipes‎ > ‎

Storage API CLI (how to copy buckets from different KBC projects)


This is the "Idiot's Guide to Copying Buckets/Tables from Different KBC Projects" (it is called Idiot's guide because the person that wrote this is one).  It is probably the lowest level of coding and done extremely poorly ... but it worked for me. 

Use Case: Copying buckets / tables INCLUDING the attributes ... this is useful for sys buckets with a lot of the configuration in the attributes of the table.  If it's just a normal data bucket, just use Rest Box IMHO. 

**note: it is probably much faster and better to run this process through an AWS server or something.  This process that I show is using your own computer as a server, so there is lots of data transfer.  I don't know, but I imagine it is problematic if you start transferring HUGE tables (transferring from cloud -> your computer -> cloud).  Ondrej H. highly recommends to do this only if you're copying sys tables that are small ... anything with actual data, please do this all on a cloud server by asking somebody for help :).

1. Download the Storage API CLI from here:, the file is called sapi-client.phar
 - put it in your "home" folder 
 - next level: put it in a folder on your AWS server

2.You need a php client.  To figure out whether you have one, if you are on mac, spotlight "Terminal" app and type "php -v" ... which will tell you your PHP version.  If you don't have the required version (stated in documentation), then you need to download and install it (I did not have to do this so I can't tell you how to do it if you must ... ask someone else for help).
 - next level: install it on your AWS server

3. go back to Terminal, and enter "php sapi-client.phar" and wait for response, you should see a list of commands and options, if not, then you've done something wrong

4. here is the command for copying a bucket from one project to another

        php sapi-client.phar copy-bucket --token=[SOURCE_TOKEN] SOURCE_BUCKET_NAME DEST_BUCKET_NAME [BACKEND OF BUCKET] [DEST_TOKEN]

        php sapi-client.phar copy-bucket --token=231-asdfasdfasdf sys.c-tr-transformation sys.c-tr-transformationcopy mysql 435-asdfasdfasdf

 - wait for response and see if it works