Cloud Platform defines Drush aliases for all your application’s environments. For example, the application named (Cloud Platform username) example has the following Drush aliases for its Development, Staging, and Production environments:
- example.dev
- example.test
- example.prod
Your environments may not all be on the same infrastructure, depending on your account and configuration. Using Drush’s remote command capability, you can use any of the aliases to access any of your applications from your local computer or any Cloud Platform infrastructure. The remote aliases work seamlessly if you have your SSH private key available on the source infrastructure. To use your SSH private key from Cloud Platform without having to copy the private key to the Cloud Platform infrastructure, use SSH key forwarding by using the -A
argument to SSH when connecting from your local computer.
For the following examples, the Staging environment is on infrastructure staging-1``and your Production environment is on ``web-1
, web-2
, and web-3
.
Downloading Drush aliases
To download your Drush aliases:
- Sign in to the Cloud Platform user interface.
Click your user avatar in the upper-right corner, and click Account Settings.
Click Credentials.
Based on whether you are using the Cloud Platform user interface or Acquia CLI, perform the steps in either of the following tabs:
Use the aliases on your local command line as though you’re signed in to your Cloud Platform infrastructure to view the Drush status. For example:
drush @example.test status
Example: Viewing site status with Drush
To view the status of your application on the production environment from your local computer using Drush, enter the following command:
drush @example.prod status
Viewing site status using Drush and SSH forwarding
By signing in to a Cloud Platform infrastructure with SSH forwarding, you can access all your environments without copying your private key to Cloud Platform. To log in to the staging environment with SSH forwarding, run the following command:
ssh -A [email protected]
To view the Drush status for your production website while you’re signed in to the infrastructure for your staging environment, enter the following command, replacing infrastructure names as appropriate:
drush @example.prod status
Refreshing Drush aliases
From time to time, your Drush aliases may change if your infrastructure (and hostname of your Cloud Platform) was changed. For example, your Drush aliases may change if you relaunch or resize your infrastructure. The aliases may also change if you upgrade your subscription from Cloud Platform Professional to Cloud Platform Enterprise.
You can refresh your Drush aliases by downloading them again, and pasting the new version in place of the old one. As an alternative, you can use the following Drush command:
drush acquia-update