# Acquia Integration

DDEV provides integration with the [Acquia Cloud Platform](<https://www.acquia.com/choosing-right-acquia-cloud-platform>), which allows Acquia users to quickly download and provision a project from Acquia in a local DDEV-managed environment.

DDEV’s Acquia integration pulls database and files from an existing project into your local system so you can develop locally.

## Acquia Quickstart

1. Get your Acquia API token from *Account Settings* → *API Tokens*.
2. Make sure you’ve added your SSH key to your Acquia account in *Account Settings* → *SSH Keys*.
3. Run [`ddev auth ssh`](<https://ddev.github.io/ddev/en/stable/users/usage/commands/#auth-ssh>). (Typically once per DDEV session, not every pull.)
4. In `$HOME/.ddev/global_config.yaml` (see [global configuration directory](<https://ddev.github.io/ddev/en/stable/users/usage/architecture/#global-files>)) add or update the [`web_environment`](<https://ddev.github.io/ddev/en/stable/users/configuration/config/#web_environment>) section with the API keys:

   ```
   web_environment:
       - ACQUIA_API_KEY=xxxxxxxx
       - ACQUIA_API_SECRET=xxxxx
   ```

   You can also do this with:

   ```
   ddev config global --web-environment-add="ACQUIA_API_KEY=xxxxxxxx,ACQUIA_API_SECRET=xxxxx"
   ```

   > **What if I have more than one API key?**
   >
   > To use multiple API keys for different projects, add them to your per-project configuration using the [`.ddev/config.local.yaml`](<https://ddev.github.io/ddev/en/stable/users/configuration/config/#environmental-overrides>) file instead. This file is gitignored by default.
   >
   > ```
   > web_environment:
   >     - ACQUIA_API_KEY=xxxxxxxx
   >     - ACQUIA_API_SECRET=xxxxx
   > ```
5. In the project `.ddev/config.yaml` add the `ACQUIA_ENVIRONMENT_ID` environment variable:

   ```
   web_environment:
       - ACQUIA_ENVIRONMENT_ID=yoursite.dev
   ```

   You can also do this with:

   ```
   ddev config --web-environment-add="ACQUIA_ENVIRONMENT_ID=yoursite.dev"
   ```
6. Run [`ddev restart`](<https://ddev.github.io/ddev/en/stable/users/usage/commands/#restart>).
7. Use `ddev pull acquia` to pull the project database and files.
8. Optionally use `ddev push acquia` to push local files and database to Acquia. Be aware that [`ddev push`](<https://ddev.github.io/ddev/en/stable/users/usage/commands/#push>) is a command that can potentially damage your production site, so we don’t recommend using it.

## Usage

- [`ddev pull acquia`](<https://ddev.github.io/ddev/en/stable/users/usage/commands/#pull>) will connect to the Acquia Cloud Platform to download the database and files; note that it will download the latest available backup on the requested environment, rather than use a fresh copy of the database. To skip downloading and importing either file or database assets, use the `--skip-files` and `--skip-db` flags.
- To pull from a specific environment without permanently changing your project config, pass environment variables using `--environment`:

  ```
  ddev pull acquia --environment="ACQUIA_ENVIRONMENT_ID=yoursite.dev"
  ```

  You can combine multiple variables:

  ```
  ddev pull acquia --environment="ACQUIA_ENVIRONMENT_ID=yoursite.dev,ACQUIA_API_KEY=xxxxxxxx,ACQUIA_API_SECRET=xxxxx"
  ```
- If you need to change the `acquia.yaml` recipe, you can change it to suit your needs, but remember to remove the `#ddev-generated` line from the top of the file.
