Environment alias management with the Contentful CLI
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.
Currently the only possible alias is master.
Requirements
- A (free) Contentful account
- Locally installed
contentful-cli
- Authenticated with
contentful-cli
- Configure the master alias using the environment settings at https://app.contentful.com
- More than one environment
List available commands and their description
contentful space environment-alias --help
Get a list of all available environment-aliases
Lists all available environment aliases from a Space.
contentful space environment-alias list
The output should look similar to this:
┌──────────┬───────────────────────┐
│ Alias id │ Target environment ID │
├──────────┼───────────────────────┤
│ master │ release-1 │
└──────────┴───────────────────────┘
Change the environment alias's target environment.
This is how you update an environment alias from a Space.
contentful space environment-alias update --alias-id master --target-environment-id release-2
The output should look similar to this:
Successfully changed the target environment for alias master to release-2
Next steps
Not what you’re looking for? Try our FAQ.