---
title: "Custom Drush commands for Cloud Platform"
date: "2024-02-14T06:18:38+00:00"
summary: "Discover custom Drush commands for Cloud Platform, including database backup, import, and SQL operations. Streamline your Drupal site management with these powerful command-line tools for developers and administrators."
image:
type: "page"
url: "/acquia-cloud-platform/custom-drush-commands-cloud-platform"
id: "bcd9bdeb-6111-4a22-816b-09c7724e71a6"
---

Table of contents will be added

Note

*   The [current Drupal version](/service-offerings/guide/software-life-cycle#supported-drupal-version) requires Drush version 11 or later. Newer versions of Drush, that is, version 11 and later, must be installed via Composer. Acquia does not manage the update to the newer versions. For more information, see [About Drush on Cloud Platform](/acquia-cloud-platform/manage-apps/command-line/drush).
*   Custom Drush commands are not supported in Cloud Next environments.

Cloud Platform provides the following custom Drush commands for your use:

Command

Description

[ah-db-backup](#ah-db-backup)

Creates a database backup from the command line.

[ah-db-import](#ah-db-import)

Imports a database from the command line. For more information, see [Downloading database backups from the command line](/acquia-cloud-platform/manage-apps/back-up/cli) or [Importing your database](/acquia-cloud-platform/create-apps/import/manual/manual-db).

[ah-site-archive-import](#ah-site-archive-import)

Imports a website archive file, as described in [Importing an existing application using Drush](/acquia-cloud-platform/create-apps/import/archive/drush).

[ah-sql-cli](#ah-sql-cli)

Opens a MySQL command-line interface using Drupal’s credentials.

[ah-sql-connect](#ah-sql-connect)

Display a MySQL command for connecting to a Cloud Platform database.

ah-db-backup
------------

Note

This command is [incompatible with Drush 9 and later](/acquia-cloud-platform/known-issues#cloud-known-supported-drush9).

This command backs up a database on Cloud Platform from the command line.

Alias

Arguments

_(none)_

*   `site`: Specify a website to back up.
*   `roles`: The comma-separated list of [database roles](/acquia-cloud-platform/glossary) to back up. Defaults to all database roles for the website.

This command accepts the following options, in the format `--option=value`:

*   `retain`: The number of daily backups to retain.
*   `ah-syslog`: Log the output of this command via syslog,
*   `structure-tables-list`: Comma-separated list of tables to backup only the structure (no data, only the CREATE TABLE command)
*   `skip-tables-list`: Comma-separated list of tables to skip in the backup.
*   `structure-tables-key`: A key in the `$structure_tables` array. See example.drushrc.php.
*   `skip-tables-key`: A key in the `$skip_tables` array. See example.drushrc.php.

ah-db-import
------------

Note

This command is [incompatible with Drush 9 and later](/acquia-cloud-platform/known-issues#cloud-known-supported-drush9).

Imports a Drupal database, using MySQL, converting tables to InnoDB format in the process.

Alias

Arguments

_(none)_

`file`: The SQL file to import, with a file path relative to the Drupal root. If the filename ends in `.gz`, the file will first be extracted to `$TMP`.

ah-site-archive-import
----------------------

Note

This command is [incompatible with Drush 9 and later](/acquia-cloud-platform/known-issues#cloud-known-supported-drush9).

Import a Drupal site archive file into Cloud Platform. This command requires a Drush alias for the Cloud Platform environment into which to import, such as `drush @[sitename].[env] ah-sari ./archive.tgz`.

Alias

Arguments

`ah-sar-import`, `ah-sari`

`filename`: The archive file to import.

This command accepts the following option, in the format `--option=value`:

*   `extract-into`: The temporary directory into which to extract the archive.

ah-sql-cli
----------

Open a SQL command-line interface using Drupal’s credentials.

Alias

Arguments

`ah-sql-cli`

_(none)_

This command accepts the following option, in the format `--option=value`:

*   `db`: The environment-agnostic database name. Defaults to the default primary Drupal database for the website. For more information, see [Viewing database information](/acquia-cloud-platform/manage-apps/database#credentials).

Note

When you run `drush ah-sql-cli`, Cloud Platform may display the following message:

    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
                            

The `-A` option is a MySQL option and not a `drush ah-sql-cli` option. You should ignore it when you run `drush ah-sql-cli`.

ah-sql-connect
--------------

Display a MySQL command for connecting to a Cloud Platform database.

Alias

Arguments

_(none)_

_(none)_

This command accepts the following option:

*   `db`: The environment-agnostic database name. Defaults to the default primary Drupal database for the website. For more information, see [Viewing database information](/acquia-cloud-platform/manage-apps/database#credentials).

Related topics
--------------

*   [Official documentation](https://docs.drush.org) for Drush
*   [Introduction to Drush](/acquia-cloud-platform/help/93836-introduction-drush "Introduction to Drush")
*   [Using Drush aliases](/acquia-cloud-platform/manage-apps/command-line/drush/aliases)
*   [About SSH/Shell access](/acquia-cloud-platform/manage-apps/command-line)