How to access Amazon Cloud Drive from the command line on Linux

In today's online retail market dominated by cut throat competitions, one player stands in the forefront, leaving the pack far behind, and that is Amazon. Amazon has been judiciously expanding its business model to satisfy consumer appetites, and I think Amazon Prime membership lies in the center of its expanding business model. Starting out as unlimited free-shipping membership, Amazon Prime has grown over time to include a variety of other perks, including unlimited streaming music, movies and TV dramas, unlimited photo gallery, free e-book library, and now same-day/one-day delivery.

Granted 99USD/year price tag for Prime membership is still hefty for non-regular Amazon customers, but people like me who purchase virtually everything from Amazon and enjoy its other perks everyday, Prime membership is worth every penny.

What is Amazon Cloud Drive?

Amazon Cloud Drive (ACD) is one such benefit of Amazon Prime. ACD is a cloud storage service similar to Dropbox, Google Drive and the likes, but unlike others ACD is free only for Amazon Prime members. If you are not an Amazon Prime member or don't plan to become one, this post is not for you (unless of course you are willing to pay for ACD).

For those Amazon Prime members, Amazon Cloud Drive is where you can store "unlimited" amount of photos and upto 5GB of other files for free. Some Prime customers (like me) may be offered a free upgrade to "Unlimited Everything" plan in which you get unlimited space for any files. If you are not a Amazon Prime member, you will have to pay a yearly subscription fee (11.99USD/year).

For what it's worth, I think ACD still has a long way to go to qualify as a competitive "non-free" cloud storage. Not only is there no official Linux client, but also existing official desktop/mobile clients (for Windows, OS X, Android and iOS) are not yet up to par in terms of UI, reliability and sync capability. In the end, I found a much better "unofficial" ACD client called acd_cli, which I am going to introduce today.

acd_cli is a lightweight command-line client for Amazon Cloud Drive, allowing you to access ACD storage from the command line on Linux. It also comes with a FUSE module for ACD, so that you can "mount" ACD and access it as if it were part of local file system. Pretty neat!

In the rest of the tutorial, I will describe how to access Amazon Cloud Drive from the command line using acd_cli. It's still in beta, so be generous with any hiccups.

Install acd_cli on Linux

Requirements

acd_cli requires Python 3.3.2 or higher. So make sure that you have python3, and that its version meets this requirement.

$ python3 -V

Most recent Linux distributions should meet this requirement (e.g., Python 3.3.2 on Fedora 20, Python 3.4.0 on Ubuntu 14.04, Python 3.4.2 on Debian 8).

Also, you need to have pip3 installed (check the instruction if it is not installed).

For CentOS/RHEL systems which do not have python3/pip3 in their base repositories, you can install the latest python3/pip3 following this guide.

Install acd_cli with pip

Once you have python3 and pip3 on your system, installation of acd_cli is as easy as running:

$ sudo pip3 install --upgrade --pre acdcli

For Arch Linux users, there is a pre-built package from AUR.

Configure acd_cli for the First Time

Before using acd_cli, you need to go through one-time authentication, where you authorize acd_cli to access your Amazon Cloud Drive account via OAuth. To start the procedure, simply run:

$ acd_cli init

On a desktop, this will open up a new browser window, which then loads https://tensile-runway-92512.appspot.com. If you are on a headless server, you can open up a browser on a separate computer, and go to https://tensile-runway-92512.appspot.com. This web app handles the server part of the OAuth procedure, and its source code is available at https://tensile-runway-92512.appspot.com/src.

You will then be asked to sign in to your Amazon account.

Type in your Amazon.com login credential, and you will be presented with a page where you authorize acd_cli to access your ACD.

This will generate necessary OAuth credentials, which will be saved as a JSON file named "oauth_data". Place this file in ~/.cache/acd_cli folder on the host where you ran acd_cli command, and press ENTER.

Before running any command with acd_cli, you need to sync its local cache with your Amazon Cloud Drive account. Most acd_cli commands require the node cache to be up-to-date. The following is the acd_cli sync command.

$ acd_cli sync

This completes the one-time setup of acd_cli. At this point, you should be able to access ACD from the command line.

Access Amazon Cloud Drive from the Command Line

Let's quickly check whether acd_cli is configured correctly by running a few commands.

$ acd_cli usage
$ acd_cli ls /

The first command will show you the current usage of your ACD account (e.g., how much storage is being used). The second command shows the content of its root folder.

Here are other basic examples of acd_cli's command-line interface.

To browse a particular folder:

$ acd_cli ls /Pictures

To download an entire folder locally:

$ acd_cli dl /Pictures/Jessica_Wedding

To upload an entire local folder to ACD:

$ acd_cli ul ./Xmas_2015 /Pictures

Check the official documentation for the complete list of available actions.

Mount Amazon Cloud Drive on Linux

Another useful feature of acd_cli is its FUSE support, allowing unprivileged users to mount Amazon Cloud Drive as a FUSE filesystem.

To mount ACD locally, simply run:

$ acd_cli mount /local/mount/point

Now you can use native Linux commands (e.g., ls, df, cp, mv) to access your ACD account.

To unmount ACD:

$ acd_cli umount ./acd

If you want to have your ACD account mounted automatically on boot, you can configure systemd to auto-mount ACD (assuming that you are using systemd on your Linux).

The following is how to set up a systemd user instance for ACD service.

First create necessary folders (i.e., local mount point and systemd's user folder).

$ mkdir ~/acd
$ mkdir -p ~/.config/systemd/user

Create the following systemd file.

$ vi ~/.config/systemd/user/amazon-cloud-drive.service
[Unit]
Description=user Amazon Cloud Drive FUSE mount
Documentation=https://acd-cli.readthedocs.org/en/latest/
AssertPathIsDirectory=%h/acd
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/local/bin/acd_cli mount --foreground %h/acd
ExecStop=/usr/local/bin/acd_cli -v -nl umount %h/acd
Restart=on-abort

[Install]
WantedBy=default.target

Finally reload and enable systemd as a "regular" user:

$ systemctl --user daemon-reload
$ systemctl --user start amazon-cloud-drive.service
$ systemctl --user enable amazon-cloud-drive.service

Now your ACD account should be mounted at ~/acd automatically upon boot.

Note that the FUSE support of acd_cli is labeled as "experimental." So treat this feature as such.

Conclusion

In this tutorial, I went over a nice little command-line tool for Amazon Cloud Drive. Despite its unofficial status, acd_cli does a wonderful job to make ACD readily accessible on Linux, even in extremely user-friendly ways. Something folks at Amazon should learn from. Kudos to the developer!

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.


Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

8 thoughts on “How to access Amazon Cloud Drive from the command line on Linux

  1. Great article. I like the unlimited photo storage (including raw files) from Amazon Prime, but the web application and the desktop application are horrible. You can not even sort by type or search with parameters. Do you know any utility, third party app to do this kind of simple tasks (web or desktop)?

  2. Dan,

    It looks like you are using Ubuntu 15.04 "systemctl". How would you get the ACD account mounted automatically on boot on Ubuntu 14.04?

  3. Hi, I just wanted to say thank you for this guide. Works great for me since I have been trying to upload some files over 2 GB and the ACD Android app is limited to those 2 GB max file limits. I don't own or care to own a PC or MAC so I was kinda stuck until running into this article. I can get those bigger files finally uploaded.

  4. Thank you for the write-up. Very useful. I managed to install Python3 (pip3 included) on a Synology (XPenology). Got as far as installing acd_cli and am able to access my ACD account and run ls etc...

    There is a problem however when I try to mount ACD as a local drive. The error : " raise EnvironmentError('Unable to find libfuse')".

    Did some searching on how to install libfuse on my NAS, but this does seem like a simple task. Do you have any advice for me? Many thanks in advance.

    • Is your problem that your NAS does not have libfuse installed, or that acd_cli does not find libfuse installed on your system? If it's the latter case, you can set LIBFUSE_PATH environment variable pointing to where libfuse is located. If you want to install libfuse, do this:

      On Debian-based NAS:

      $ sudo apt-get install libfuse2 and libfuse-dev

      On Red Hat-based NAS:

      $ sudo yum install fuse fuse-devel
  5. Hi, Thanks for the great guide. I am not able to finalize due to a permission error [Errno 13] for the oauth data file. Thank you in advance for any advice!

Leave a comment

Your email address will not be published. Required fields are marked *