# Environment Management

> Use when listing, creating, deleting, or mirroring Cloud environments, managing CDEs, deploying code to an environment, or checking environment status.

- **Type:** Skill
- **Install:** `agentstack add skill-acquia-acquia-skills-environment-management`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [acquia](https://agentstack.voostack.com/s/acquia)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [acquia](https://github.com/acquia)
- **Source:** https://github.com/acquia/acquia-skills/tree/main/skills/acli/environment-management

## Install

```sh
agentstack add skill-acquia-acquia-skills-environment-management
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Environment Management with Acquia CLI

Use when:
- Creating or deleting Continuous Delivery Environments (CDEs)
- Making one environment identical to another (mirroring)
- Copying cron tasks between environments
- Installing SSL certificates
- Listing or inspecting environments
- Deploying code to an environment

---

## List Environments

```bash
acli api:applications:environment-list
```

Shows all environments for an application (prod, staging, dev, and any CDEs).

---

## Get Environment Details

```bash
acli env:info
```

Shows PHP version, database, last deployment, URLs, and status for the selected environment.

---

## Create a Continuous Delivery Environment (CDE)

CDEs are on-demand environments — useful for testing feature branches before merging.

```bash
acli env:create "My Feature Branch" feature/my-branch
```

Arguments:
- `label` (required) — Human-readable name for the new environment
- `branch` (optional) — The git branch to deploy; prompts if omitted

```bash
# Interactive (prompts for branch)
acli env:create "QA Review"

# Non-interactive
acli env:create "Sprint 42 Demo" release/sprint-42
```

---

## Delete a CDE

```bash
acli env:delete
```

Prompts you to select the environment to delete. Only CDEs can be deleted; production and standard environments cannot.

---

## Deploy Code to an Environment

```bash
acli api:environments:code-switch  
```

Example:

```bash
acli api:environments:code-switch 112927-9454a2b1-cce0-475e-ae5f-5374dbca9b0a master
```

Returns a notification UUID you can track with `acli app:task-wait `.

---

## Mirror an Environment

Makes a destination environment identical to a source — copies code, database, files, and config.

```bash
acli env:mirror  
```

Use environment aliases in the format `app-name.env`:

```bash
acli env:mirror myapp.prod myapp.staging
```

**Skip specific components:**

```bash
acli env:mirror myapp.prod myapp.staging \
  --no-code \      # -c: skip code
  --no-databases \ # -d: skip databases
  --no-files \     # -f: skip files
  --no-config      # -p: skip configuration
```

> **Warning:** This overwrites the destination. All existing data in the destination environment is replaced.

---

## Copy Cron Tasks Between Environments

Copy all cron tasks from one environment to another:

```bash
acli env:cron-copy  
```

Example:

```bash
acli env:cron-copy myapp.prod myapp.staging
```

Useful after mirroring an environment to ensure scheduled tasks match.

---

## Install an SSL Certificate

```bash
acli env:certificate-create  
```

Options:

```bash
acli env:certificate-create \
  /path/to/cert.pem \
  /path/to/private-key.pem \
  --label="My SSL Cert" \
  --ca-certificates=/path/to/ca-bundle.pem \
  --legacy              # Use legacy SSL (non-SNI)
```

To install from an existing CSR:

```bash
acli env:certificate-create cert.pem key.pem --csr-id=
```

---

## Typical Workflows

### Set up a CDE for a feature branch

```bash
# Create the environment
acli env:create "Feature: New Checkout" feature/new-checkout

# Mirror prod data to it
acli env:mirror myapp.prod myapp.
```

### Refresh staging from production

```bash
acli env:mirror myapp.prod myapp.staging
```

### Promote staging to prod

```bash
acli api:environments:code-switch  main
```

---

## Best Practices

1. **Mirror before testing** — Always sync a CDE from prod or staging before QA.
2. **Clean up CDEs** — Delete CDEs when done; they consume resources.
3. **Test deploys in staging first** — Always deploy to staging before production.
4. **Copy crons after mirror** — Run `env:cron-copy` after mirroring to keep scheduled tasks in sync.

---

## Troubleshooting

### "Environment not found"

Check available environments:

```bash
acli api:applications:environment-list
```

### Mirror fails midway

Check logs and retry. Use `--no-databases` or `--no-files` to skip the component that failed:

```bash
acli env:mirror myapp.prod myapp.staging --no-files
```

---

## Related Topics

- **[Pull & Push](../pull-push/SKILL.md)** — Sync local and Cloud environments
- **[Application Management](../application-management/SKILL.md)** — Find application UUIDs
- **[Remote Access](../remote-access/SKILL.md)** — SSH and Drush on environments

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [acquia](https://github.com/acquia)
- **Source:** [acquia/acquia-skills](https://github.com/acquia/acquia-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-acquia-acquia-skills-environment-management
- Seller: https://agentstack.voostack.com/s/acquia
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
