> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://contentful.com/developers/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/developers/docs/_mcp/server.

# Environment alias management with the Contentful CLI

> These commands will help you manage environment aliases in Contentful | Getting lists | Creating new aliases | Changing the environment alias's target environment

An environment alias is like an environment but any access using the alias reaches a target environment instead. This allows a quick change of which content is made available using the alias. For example, some content is in the environment **release-1** and targeted by the alias **master**. Access to the content via the **master** alias reaches the information in **release-1**. New content is available in the environment **release-2**. To quickly change the content made available using the alias, the **master** alias is changed to target the **release-2** environment. If the new content is not quite right it is easy to switch back to **release-1**.

## Requirements

* A (free) [Contentful account](https://www.contentful.com/sign-up/).
* Locally [installed](/tutorials/cli/installation) `contentful-cli`.
* [Authenticated](/tutorials/cli/authentication) with `contentful-cli`.
* An existing environment alias — You can create and configure an environment alias in the "Environments" page that can be accessed under the Settings tab in the [web app](https://app.contentful.com).
* More than one environment.

## List available commands and their description

```bash
contentful space environment-alias --help
```

## Get a list of all available environment-aliases

Lists all available environment aliases from a Space.

```bash
contentful space environment-alias list
```

*The output should look similar to this:*

```bash
┌──────────┬───────────────────────┐
│ Alias id │ Target environment ID │
├──────────┼───────────────────────┤
│ master   │ release-1             │
└──────────┴───────────────────────┘
```

## Create a new environment alias

You can create a new environment alias that points to a specific environment.

```bash
contentful space environment-alias create --alias-id staging --target-environment-id release-2
```

*The output should look similar to this:*

```bash
Successfully created environment alias staging targeting environment release-2
```

## Change the environment alias's target environment

This is how you update an environment alias from a Space.

```bash
contentful space environment-alias update --alias-id master --target-environment-id release-2
```

*The output should look similar to this:*

```bash
Successfully changed the target environment for alias master to release-2
```

## Next steps

* [Manage extensions with the Contentful CLI](/tutorials/cli/extension-management)
* [Check out the documentation in the GitHub repository](https://github.com/contentful/contentful-cli/tree/main/docs/space/environment-alias)