Drush is a command-line shell for Drupal, and it enables you to perform many administrative and application maintenance tasks from the command line instead of having to use the Drupal administrative interface.
Unless you are using Live Development, Drush cannot write to the Acquia Cloud file system, so you cannot use it to manage your application's code, or install or update modules. To manage your code, use your version control system, Git or Subversion (SVN). As an alternative, you can enable the Live Development feature. With Live Development enabled, you can log into your Acquia Cloud server and use Drush or other tools to write to the file system. You can use Live Development to modify only your Dev and Stage environments, not your Prod environment. For more information about Live Development, see Using Live development mode to change code on your server. A more powerful and flexible alternative is to develop locally and use Acquia Dev Desktop to sync your code between your local environment and Acquia Cloud. Acquia Dev Desktop provides full support for Drush.
Best practices for application development — Develop locally!
The fastest and easiest way to work with your application is to develop it on your local computer, rather than attempting to manage code or modules remotely on Acquia Cloud. You can change your application's code, use Drush locally to add or update modules, and then send the changes to Acquia Cloud using your selected source control method (SVN or Git) or using Acquia Dev Desktop.
You can use Drush on Acquia Cloud to help you develop locally. For example, suppose you want to be able to locally access your development environment database. To be able to access the database locally, enable SSH, securely connect to Acquia Cloud, and then run the following Drush command:
drush @[site].dev ah-sql-connect
The command provides the MySQL connection settings required to access the database. Replace
[site] with your application's name and
dev with the environment whose database you want to reach. You can then provide these settings to a MySQL client installed on your computer (such as MySQL Workbench or Navicat). After you configure the MySQL client to connect to the database server using an SSH tunnel, you'll have access to your development environment's database from your local computer.
For more information about Drush, see Introduction to Drush.
Remote development — Drush resources on Acquia Cloud
Drush is pre-installed on Acquia Cloud, and you can use Drush with your applications after you enable SSH access to connect to Acquia Cloud using SSH.
The Acquia Cloud API is a RESTful web interface that allows developers to extend, enhance, and customize Acquia Cloud. It includes Drush commands that allow you to use all features of the Cloud API. For more information, see the Drush Cloud reference.
Using different versions of Drush
Acquia Cloud supports every stable version of Drush, from Drush 8 back to Drush 3. To run a specific version of Drush, specify the major version in the
drush command. For example, to run Drush 5, use the command
drush5. To run the default version of Drush, use the command
drush. On Acquia Cloud, the default version of Drush is currently Drush 8.
If you want to change your personal default Drush version, you can set an alias for drush in a
.bashrc file. For example, to make the
drush command run Drush 4, add this to your
This alias will work only for interactive SSH commands; it will have no effect during cron jobs or Cloud Hooks. To use a specific version of Drush in a cron command, you must call it directly, as follows:
When you run Drush on your local computer and use a remote Drush alias for your Acquia Cloud application (such as those described in Using Drush aliases), the remote Drush command will be run using the default version of Drush on Acquia Cloud. To run a specific version of Drush on Acquia Cloud when you use a remote alias, edit the alias file in the
$HOME/.drush folder on your local computer to specify the version you want. For example:
$aliases['dev'] = array(
'path-aliases' => array(
'%drush-script' => 'drush5',
// ... other alias settings here
Accessing environment databases
Each of an application's environments on Acquia Cloud has its own database, and when you use Drush to access these databases, you must refer to them specifically. For example, if you want to use
drush sql-connect for the database in the development environment of your application, use the following command:
drush @[site].dev ah-sql-connect
[site] with the name of your application. Replace
test to reach the staging environment database or with
prod to reach the production environment database.
Finding help for Drush
To access help for Drush online, go to Drush Commands.
To access command-line help, enter
drush help on the command line while you are signed in to your Acquia Cloud server. For a printable version of this list, enter the following command:
drush help --html.