Managing applications using the command line

Secure Shell (SSH) is a secure network protocol you can use to sign in to your Cloud Platform environments and use command-line tools.

SSH address

To sign in to an environment with SSH, you will need environment’s SSH address or URL. You can find the SSH URL for an environment in the Cloud Platform user interface on the environment’s Overview page.

Each environment’s SSH URL has the initial format [application name].[environment name] where:

  • [application name] is the name of your application.
  • [environment name] is the environment name (frequently one of dev, test, or prod). When you specify an environment, your PATH and other environment variables are configured the same way as they are for web processes, cron jobs, and Cloud hooks. In particular, the version of PHP you have configured appears first in the PATH, and is the default in your SSH session.

For environments running on the Acquia Cloud Next technologies:

  • SSH sessions don’t stay open indefinitely and may be discontinued during normal platform operations, such as code deployments or system updates. When such events occur, SSH sessions have a one hour grace period to exit. When this happens, a warning is broadcasted to the affected interactive SSH sessions every five minutes.

  • When you trigger code deployment on an environment, the system displays a warning message to the users in SSH sessions. The message warns such users that the code in their SSH session is outdated and that they should restart the session. Otherwise, the session is terminated in an hour.

  • New SSH sessions automatically use the latest deployment available.

  • To initiate SSH sessions for environments provisioned on Acquia Cloud Next, use the following syntax:

    ssh [application name].[env]@[application name][env]

  • To initiate SSH sessions for environments originally provisioned on the Cloud Classic infrastructure, use the following syntax for production environments:

    ssh [application name].[env]@[application name]

Tasks you can perform from the command line

After you enable SSH access in Cloud Platform, you can use SSH in the Cloud Platform environment to perform the following tasks:

Access your file storage directories from the command line

You have shell access to all web nodes running your application, using the same username and SSH public key credentials you use for rsync, Secure Copy (SCP), or Secure File Transfer Protocol (SFTP) on Cloud Platform. To access your file storage directories, use a command like:

ssh [SSH address]

For example, this command accesses the Dev environment of an application named example:

Import and export databases

Cloud Platform has unique database requirements to provide the best possible Drupal application performance. With SSH access enabled, you can use the Cloud Platform database import script. For more information, see Importing your database.

Use the Drush command-line tool

Cloud Platform applications with SSH access have an installed and configured infrastructure of Drush for performing administrative and application maintenance tasks from the command line instead of using the Drupal administrative interface. For more information, see About Drush on Cloud Platform.

Limitations on shell access

Due to the technical requirements necessary for maintaining a highly available and redundant hosting platform, you have limits on what you can access and do using shell access on Cloud Platform:

  • Limited file access: You must store files in the persistent network filesystem directory at /mnt/files/[application name].[environment name].
  • No root access: You do not have root access, even if your application runs on dedicated cloud infrastructure.
  • Write access to your Drupal docroot: Use Git to manage your code on Cloud Platform. By default, you cannot use shell access to install or update modules or to make other changes to your Drupal docroot directory (/var/www/html). If you want to make changes to your Drupal docroot directory, enable Live Development on a non-production environment. Live Development is not available for production environments.
  • Session timeout: Your SSH session will time out (expire) after 15 minutes of idle time.