I have been struggling with the installation of amazonS3. Although I was finally able to have it working pretty well, I would like to confirm with experts my understanding of the problem, and check that I got it right.

This is what I did :

  • installed composer_manager
  • installed with drush awssdk and awssdk_ui.
  • installed amazons3 module
  • while composer_manager states that all required libraries were installed, drupal status report still says that awssdk fails to load.
  • S3 is working fine and stores files attached to a node.

I think I understand my mistake: with Composer Manager installed and all requirements met, I don't need awssdk and awssdk_ui modules.

These modules check that the libraries/awssdk/sdk.class.php is present, but composer_manager install the required library in vendor directory.

With this understanding, I disabled AWS SDK for PHP and awssdk_ui, and it seems to work well.

I believe that i have read to much docs on the Net, and mix two incompatible ways to install amazonS3.

Do I have the right understanding?

1 Answer 1


In the last days, I have repeated the painful procedure many times on different AWS EC2 instances to be sure to have a precise and repeatable procedure. I am thus very confident about my understanding of it today. I have written a step-by-step procedure to deploy amazonS3, with the main encountered problems and how I dealt with them. I believe that such a document would have helped me a lot some days ago (and back then, I didn't found any), so here is my proposal. I would appreciate some real experts validation there !

1) install Drush or update to get 5+ version

2) apply all valid patches from the amazonS3 README (https://www.drupal.org/project/amazons3), mainly to allow S3 generated URI s3:///filename.ext" to be supported by media and fileentity related modules

3) Install composer (goes without saying, but I missed it at first!) with :

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
alias composer='/usr/local/bin/composer.phar'

composer command should return usage tips

4) Install PHP's cURL extention. On Ubuntu, sudo apt-get install php5-curl is sometimes not enough. (See "cURL library required to enable drupal ...")

sudo apt-get update
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
sudo /etc/init.d/apache2 restart

5) From the drupal_root folder, launch amazons3 download and install

drush  dl composer_manager
drush  en composer_manager

6) Configure the directory where to put vendor and composer.json files. The default directory are outside of Drupal's directory (vendor : "../vendor", composer: "../") Once the composer_manager is enabled, I went admin/config/system/composer-manager/settings and set the fields as follows (again, refer to best practices for RW permissions of Drupal folders).

7) Be sure to give write permissions to www-data to the folder. Especially with the folder being outside of the drupal_root folder.

8) Download and install amazonS3 using Drush and composer, since AWSSDK libraries will be automatically installed with all dependencies.

drush dl amazons3
drush en amazons3

These commands should automatically generate composer.json in the previously indicated folder. You can check that all the dependencies were correctly gathered from amazonS3 and other modules requirements. In my case, composer.json contains :

"require": {
    "aws/aws-sdk-php": "2.8.5-p1",
    "capgemini/drupal_doctrine_cache": "0.0.1-p1",
    "doctrine/cache": "~1.4",
    "php": ">=5.3.0"
"config": {
    "autoloader-suffix": "ComposerManager"
"require-dev": {
    "phpunit/phpunit": "~4.6",
    "satooshi/php-coveralls": "0.6.*"
"repositories": [
        "type": "vcs",
        "url": "https://github.com/deviantintegral/drupal-doctrine-cache.git"
        "type": "vcs",
        "url": "https://github.com/deviantintegral/aws-sdk-php.git"
"autoload": {
    "psr-4": {
        "Drupal\\amazons3\\": [


9) I can't explain why, but the first install generated an incomplete composer.json . You can regenerate the file using by accessing /admin/config/system/composer-manager and click regenerate, or running from drupal_root folder the following drush command :


9bis) You can also, directly from the composer folder (which location was set previously) and run : composer install. The command will download all required PHP libraries in composer vendor's folder.

I personally found it very confusing all the locations on my server where composer files where located :

  • Some docs advise to put composer folder in a ~/.composer/vendor folder in user's home directory. - - Drupal created a .composer in a .drush/composer (to indicate that Drush is required for that user)

  • I found a ~/.composer in my root folder. It contains users's credentials to access github repository to load the required packages

  • Most of the docs recommend to store a composer folder just above the drupal_root

  • I choose to follow these last recommendations to put it in the sites/all/libraries/composer in order to commit the code. But I can't say whether this is the right way to proceed.

10) Finally, retrieve you AWS API KEY and AWS SECRET KEY from console.aws.amazon.com and configure amazonS3 in /admin/config/media/amazons3, by setting your Security Credentials: Access Key ID and Secret Access Key, and S3 Bucketname. You can also put the values in the settings configuration file, by adding the following lines to your settings.php :

$conf['amazons3_key'] = "<AWS API KEY>";
$conf['amazons3_secret']="<AWS SECRET KEY>";

11) AmazonS3 should be working : create a file field on a content type, select Amazon S3 as the location to save to. Create a node, attach a file,Save and view the node. The attached file should be displayed as a link to you S3 bucket.

During my last install, I was able to avoid most of the problems encountered in my previous tries : cURL, read/write permissions, composer unable to parse version requirements, etc. The last error I was confronted to, was a composer out of memory problem, which I fixed with the following :

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1

I hope this note will help someone, since S3 really worth a few headaches with the installation. Besides, the last release of the module is only two months old.

  • After rebuilding json, from command line, I had to go to: /sites/all/modules/amazons3 and run: composer install Commented Jan 18, 2016 at 4:26
  • 1
    Sorry, the folder is: sites/default/files/composer Commented Jan 18, 2016 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.