PHPackages                             typhonius/acquia\_cli - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. typhonius/acquia\_cli

ActiveLibrary[CLI &amp; Console](/categories/cli)

typhonius/acquia\_cli
=====================

A Robo CLI tool for integrating with Acquia CloudAPI

2.0.10(5y ago)3132.6k19[4 issues](https://github.com/typhonius/acquia_cli/issues)[12 PRs](https://github.com/typhonius/acquia_cli/pulls)MITPHPPHP &gt;=7.3

Since Jul 11Pushed 2y ago4 watchersCompare

[ Source](https://github.com/typhonius/acquia_cli)[ Packagist](https://packagist.org/packages/typhonius/acquia_cli)[ GitHub Sponsors](https://github.com/typhonius)[ RSS](/packages/typhonius-acquia-cli/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (11)Versions (69)Used By (0)

[![Acquia Cli Test](https://github.com/typhonius/acquia_cli/workflows/Acquia%20Cli%20Test/badge.svg)](https://github.com/typhonius/acquia_cli/workflows/Acquia%20Cli%20Test/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/dd63834353998899dbadcf761d5b4f91d7bedacfed9277d672e3176d1c597da1/68747470733a2f2f706f7365722e707567782e6f72672f747970686f6e6975732f6163717569615f636c692f646f776e6c6f6164732e706e67)](https://packagist.org/packages/typhonius/acquia_cli)[![Coverage Status](https://camo.githubusercontent.com/58d5e4a265700992b71640f258fe9d3f31a04139a816c0d7cf21cb9cd721fb52/68747470733a2f2f636f6465636f762e696f2f67682f747970686f6e6975732f6163717569615f636c692f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/typhonius/acquia_cli)

![License](https://camo.githubusercontent.com/78e6e7b237ff19543985eb1f592a636abccee787a44c2a1e0d0ecad988e536af/68747470733a2f2f706f7365722e707567782e6f72672f747970686f6e6975732f6163717569615f636c692f6c6963656e73652e706e67)[![Latest Stable Version](https://camo.githubusercontent.com/5b1278bdb27905b720e89b0ae0903ee1b5a3693ae9ad441faee1a94ecd3a45ff/68747470733a2f2f706f7365722e707567782e6f72672f747970686f6e6975732f6163717569615f636c692f762f737461626c652e706e67)](https://packagist.org/packages/typhonius/acquia_cli)[![Latest Unstable Version](https://camo.githubusercontent.com/d3a62203987cf425f95554d57d6d7a12da042af01e0e428fe5c1c03ade39ed7d/68747470733a2f2f706f7365722e707567782e6f72672f747970686f6e6975732f6163717569615f636c692f762f756e737461626c652e706e67)](https://packagist.org/packages/typhonius/acquia_cli)

Acquia Cli
==========

[](#acquia-cli)

The Acquia Cli tool provides developers, sysops, release managers and website administrators with a simple to use tool for obtaining information and running tasks on the Acquia Cloud.

Acquia Cli is simple to install and aligns to the permissions constructs already built into Acquia. The tool can be used for any task that can be completed using the Acquia web interface, and contains in-built instructions for each task.

If Acquia Cli doesn't have the task built in, simply create a ticket or a pull request for it to be included.

Pre-installation
----------------

[](#pre-installation)

### Generating an API access token

[](#generating-an-api-access-token)

To generate an API access token, login to , then visit , and click ***Create Token***.

- Provide a label for the access token, so it can be easily identified. Click ***Create Token***.
- The token has been generated, copy the api key and api secret to a secure place. Make sure you record it now: you will not be able to retrieve this access token's secret again.

Downloading a version of the application
----------------------------------------

[](#downloading-a-version-of-the-application)

Select either the packaged application or the source application below before continuing with setup steps.

### Installing the packaged application (easiest)

[](#installing-the-packaged-application-easiest)

To install the packaged application quickly and easily, the following three steps may be executed.

```
wget https://github.com/typhonius/acquia_cli/releases/latest/download/acquiacli.phar
mv acquiacli.phar /usr/local/bin/acquiacli
chmod +x /usr/local/bin/acquiacli

```

*Automatic updates*

If the packaged application is used, it can be updated simply and easily whenever a new release is out by running the following command from anywhere on the computer:

```
acquiacli self:update

```

### Installing from source (advanced)

[](#installing-from-source-advanced)

To install from source, clone the repository into a location on your computer with the following commands:

```
git clone https://github.com/typhonius/acquia_cli.git
cd acquia_cli
composer install

```

Setup
-----

[](#setup)

Choose one of the following methods to finish setting up your AcquiaCli installation.

### Automatic setup

[](#automatic-setup)

Once you have downloaded the application using one of the above steps, run the following commands to enter add your Acquia credentials.

1. Run `acquiacli setup` (or `./vendor/bin/acquiacli setup` when used as a dependency in another project) which will ask for your credentials and automatically create this file.
2. Run `acquiacli drush:aliases` to download your available Drush aliases. Follow the instructions output by the command to install them.

### Manual installation/setup

[](#manual-installationsetup)

Alternatively, follow the below steps for a manual installation.

1. Copy the `default.acquiacli.yml` file to your project root and name it `acquiacli.yml`.
2. Add your Acquia key and secret to the `acquiacli.yml` file.

### Environment Variables

[](#environment-variables)

Environmment variables can be used to store and provide the API key and secret, removing the need for configuration files. Refer to the values in `default.acquiacli.yml` for examples of how to configure these environment variables.

- `ACQUIACLI_KEY` The environment variable for the API key
- `ACQUIACLI_SECRET` The environment variable for the API secret
- `ACQUIACLI_TIMEZONE` Use [a supported PHP timezone](https://secure.php.net/manual/en/timezones.php) to see times in your locale.
- `ACQUIACLI_FORMAT` Use [a supported PHP date string](https://secure.php.net/manual/en/function.date.php) to show times in an alternate format.
- `ACQUIACLI_TASKWAIT` A number in seconds to wait before hitting the API to check the status of a task.
- `ACQUIACLI_TIMEOUT` A number in seconds before a task is considered to have timed out.

If environment variables are to be used, these will need to be placed in the relevant bash file on Linux/Mac e.g. `$HOME/.bashrc` or `$HOME/.bash_profile` in the following format.

```
export ACQUIACLI_KEY=15fd1cde-1e66-b113-8e98-5ff9d444d54f
export ACQUIACLI_SECRET=Sdtg0o83TrZm5gVckpaZynCxpikMqcht9u3fexWIHm7

```

Windows users will need to add the environment variables within their system settings.

Configuration
-------------

[](#configuration)

The Acquia Cli tool uses cascading configuration on the user's own machine to allow both global and per project credentials and overrides as needed.

Acquia Cli will load configuration in the following order with each step overriding matching array keys in the step prior:

1. Firstly, default configuration from `default.acquiacli.yml` in the project root/packaged with the Phar is loaded.
2. Next, if it exists, global configuration from `$HOME/.acquiacli/acquiacli.yml` is loaded.
3. Finally, if it exists, an `acquiacli.yml` file in the project root will be loaded. (Not applicable if using the Phar)
4. Environment variables take overall precedence for the key and secret, however other config won't be overridden.

The global and per project files may be deleted (manually) and recreated with `acquiacli setup` whenever a user wishes to do so.

Options may be manually set within the relevant `acquiacli.yml` file to change the following parameters under the `extraconfig` key:

KeyDefaultDescriptiontimezoneAustralia/SydneyUse [a supported PHP timezone](https://secure.php.net/manual/en/timezones.php) to see times in your locale.formatY-m-d H:i:sUse [a supported PHP date string](https://secure.php.net/manual/en/function.date.php) to show times in an alternate format.taskwait5A number in seconds to wait before hitting the API to check the status of a task.timeout300A number in seconds before a task is considered to have timed out.Usage/Examples
--------------

[](#usageexamples)

Some of the following commands have aliases for simplicity e.g. `environment:info` has the alias of `e:i`.

```
# Show which applications you have access to.
acquiacli application:list

# Show detailed information about servers in the prod environment (assuming sitename of prod:acquia obtained from site:list command)
acquiacli environment:info prod:myacquiasite prod

# Copy the files and db from alpha to dev in preparation for a deployment
acquiacli deploy:prepare prod:myacquiasite dev alpha

# Copy the files and db from prod to test to prepare for a deployment.
# N.B. if the last argument is omitted in deploy:prepare, prod will be used
acquiacli deploy:prepare prod:myacquiasite test

# Deploy the develop-build branch to the test environment.
acquiacli code:switch prod:myacquiasite test develop-build

# Deploy the release-1.2.3 branch/tag to the production environment without prompting the user to confirm.
acquiacli code:switch prod:myacquiasite prod release-1.2.3 --yes

# Promote the code in preprod to prod.
acquiacli code:deploy prod:myacquiasite preprod prod

# Get a list of organizations you have access to and display organization UUIDs.
acquiacli organization:list

# Add a new team to an organization.
acquiacli team:create 'My Team Name' 'External Contractors'

# Add a new role to an organization (Use permissions:list to get available permissions for the new role).
acquiacli role:add 'My Team Name' 'Contractors' 'move file to non-prod,move file from prod,download db backup non-prod,download logs non-prod,deploy to non-prod'

# Associate a team with an application within the organization (Use organization:teams to get team UUIDs).
acquiacli team:addapp prod:myacquiasite d2693c6e-58e7-47e5-8867-e2db88c71b8c

# Add a user to a team and assign roles (Use role:list to obtain the role UUIDs).
acquiacli team:invite d2693c6e-58e7-47e5-8867-e2db88c71b8c 'username@example.com' f0b89594-0fc5-4609-935f-1f18c313c6c7

```

### Additional parameters

[](#additional-parameters)

The `--limit`, `--sort`, and `--filter` parameters can be added to every single command used with the Acquia Cli tool for providing more relevant information to users who are working on sites.

*Limiting*

To limit the number of returned entries, use `--limit=x` with a command.

```
# Reduce the number of notifications passed back to 10.
acquiacli notification:list myacquiasite --limit=10

```

*Sorting*

A comma-delimited string with fields can be used for sorting. The order of the fields is significant. A leading - in the field indicates the field should be sorted in a descending order. Not all fields are sortable.

```
# Sort all applications first by organization name (alphabetically) and then by label (reverse-alphabetically).
acquiacli application:list --sort='organization_name,-label'

```

*Filtering*

The filters query string parameter restricts the data returned from your request. Filtered queries restrict the rows that do (or do not) get included in the result by testing each row in the result against the filters. Not all fields are filterable.

There are eight filter operators that can be used and they must be URL encoded in order to be included. The operators are:

- Equals: =
- Does not equal: !=
- Greater than: &gt;
- Less than: &lt;
- Greater than or equal to: &gt;=
- Less than or equal to: &lt;=
- Contains substring: =@
- Does not contain substring: !@

Filters can be combined using OR and AND boolean logic. The OR operator is defined using a comma (,) and the AND operator is defined using a semi-colon (;).

```
# Show all tasks with a label starting with Database after 1st April 2019 and before 1st Jan 2020.
acquiacli notification:list myacquiasite --filter='label=@Database*;created_at>2019-04-01;created_at
