UPDATE: It seems Amazon has banned ACD_CLI. I contacted Amazon to see what is their suggestion. So waiting for a feedback from them now.
We are going to connect to Amazon Cloud Drive from Debian Command line to utilize the benefit of unlimited cloud storage. Even there are various tutorials out there, finding a really “workable” one is not a trivial work. I summarize some steps here for reference.
- First, we need to install necessary environment (softwares):
[bash]apt-get install links #Web browser for command line
apt-get install libsqlite3-dev #Need before build python3, since it is used in acd_cli[/bash] - Build python from source, remember that we need 3.5 (latest version currently):
- Download and install latest python at https://www.python.org/downloads/release/python-361/:
[bash]wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
tar zxvf Python-3.6.1.tgz
cd Python-3.6.1
./configure
make
make install[/bash] - Check to be sure Python is in the correct version
[bash]python3 -V[/bash]
. Link it if it requires to be in /usr/bin/python3:
[bash]ln -s /usr/local/bin/python3 /usr/bin/python3[/bash]
- Download and install latest python at https://www.python.org/downloads/release/python-361/:
- Install pip:
[bash]wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py[/bash] - Install acdcli:
[bash]pip3 install –upgrade –pre acdcli[/bash]
- Init acd:
[bash]acd_cli -v init[/bash]
. Remember that after login with Amazon account, you’ll need to grant access to the acd_cli_oa and then must have the returned JSON in the right location: /root/.cache/acd_cli/oauth_data. If you use the text-based browser, be sure to save the output JSON and move it to the proper place after permission granting. The file is sth as follows:
[javascript]{
"access_token": "TOKEN_HERE___TOKEN_HERE___TOKEN_HERE___TOKEN_HERE___TOKEN_HERE___TOKEN_HERE___TOKEN_HERE___TOKEN_HERE___TOKEN_HERE___",
"exp_time": 1460728465.1998088,
"expires_in": 3600,
"refresh_token": "OTHER_TOKEN_HERE__OTHER_TOKEN_HERE__OTHER_TOKEN_HERE__OTHER_TOKEN_HERE__OTHER_TOKEN_HERE__OTHER_TOKEN_HERE__OTHER_TOKEN_HERE__",
"token_type": "bearer"
}[/javascript] - Before doing anything, we need to sync:
[bash]acd_cli sync[/bash]
- Access Amazon Cloud Drive from the Command Line: Basically, we'll need to mount the Amazon Cloud Drive into our Linux File System and then run rsync periodly (hourly/every 6 hours/daily/weekly) to keep data be synchronized.
- Mount it:
[bash]mkdir /mnt/AmazonCloudDrive
acd_cli mount /mnt/AmazonCloudDrive[/bash] - Test the mount:
[bash]df -h[/bash]
- Copy files/folder or Setup sync from local server to remote AWS:
[bash]rsync -uptorgvlHaz /YOUR_BACKUP_PATH/ /mnt/AmazonCloudDrive/FOLDER_NAME/[/bash]
- What we need to do for future synchronization is to create a cron job so that the rsync command can be run daily.
- Mount it:
TroubleShooting
- If you are using acd_cli v0.3.2 and when syncing, some of your folders in CloudDrive do not show. You can use the fix in github at https://github.com/yadayada/acd_cli/issues/464#issuecomment-282144624
- When initing acd_cli, if you face problems of opening the amazon oauth server, just go to https://acd-api-oa.appspot.com/, authorize with your account, and then copy the downloaded oauth.json to /root/.cache/acd_cli/oauth.json on your server.