Magento Cloud CLI reference

CLI command reference

The Magento CLI is a cloud-specific verion of the Magento CLI we provide supporting commands including Magento management and Git interactions. This reference lists all available commands, and a list of commonly used commands, for Magento cloud.

You must install the Magento CLI to your local workspace to issue commands. For details, see:

The following Magento CLI commands can be run from any directory and run best from a project directory. When run from a project directory, you can omit the -p <project ID> parameter. These commands are meant to be used to manage Integration environments.

You may notice these commands are similar to Git commands. The magento-cloud Git commands directly connect with Magento Git, the Magento ECE project, with additional features. For example, when you push a Git branch, it is not activated until you access GitHub. The Magento CLI command includes activation.

All listed commands include only the required information and options. These commands may include additional options. To see all options and help, append --help with any magento-cloud command .

git commit --allow-empty -m "redeploy" && git push <branch name>
Push an empty commit to force a redeployment. Some actions, like adding a user for example, don’t result in deployment.
magento-cloud login
Log in to the project
magento-cloud project:get <project ID> <directory> -e <environment ID>
Clone a project to a directory. To clone the master environment, omit -e <environment ID>.
magento-cloud environment:list -p <project ID>
List the environments in the current project (that is, the project that corresponds to the directory in which you run the command).

magento-cloud environment:list displays environment hierarchies whereas git branch does not. If you have any nested environments, use magento-cloud environment:list.

magento-cloud environment:branch <name> <parent branch>
Create a new branch; the environment has both a name and an ID

The environment name is different from the environment ID only if you use spaces or capital letters in the environment name. An environment ID consists of all lowercase letters, numbers, and allowed symbols. Capital letters in an environment name are converted to lowercase in the ID; spaces in an environment name are converted to dashes.

An environment name cannot include characters reserved for your Linux shell or for regular expressions. Forbidden characters include curly braces ({ }), parentheses, asterisk (*), angle brackets (< >), ampersand (&), percent (%), and other characters.

magento-cloud environment:checkout <environment ID>
Check out an existing environment
magento-cloud environment:merge -p <project ID> -e <environment ID>
Merge changes in this environment with its parent.
magento-cloud environment:synchronize -p <project ID> -e <environment ID> {code|data}
Synchronize (that is, git pull) code and/or data from the parent to this environment
magento-cloud variable:list
List variables in this environment
magento-cloud variable:set <name> <value>
Set a value for an environment variable in this environment

Display all commands

The magento-cloud list displays all available commands.

Help for a command

You can preface or append any command with help to see more information on how to use that command.

$ magento-cloud help domain:add
Command: domain:add
Description: Add a new domain to the project

 domain:add [--project[="..."]] [--cert="..."] [--key="..."] [--chain="..."] [name]

 name                  The name of the domain

 --project             The project ID
 --cert                The path to the certificate file for this domain.
 --key                 The path to the private key file for the provided certificate.
 --chain               The path to the certificate chain file or files for the provided certificate. (multiple values allowed)
 	 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages
 --version (-V)        Display this application version
 --yes (-y)            Answer "yes" to all prompts
 --no (-n)             Answer "no" to all prompts
 --shell (-s)          Launch the shell

List of Magento CLI commands

The following table provides an extensive list of Magento CLI commands for ECE accessed with magento-cloud To see a full list of commands, enter magento-cloud list.

Variable name Description
activity:list (activities) Gets a list of activities for an environment
activities:log Displays the log for an environment activity
app:config-get Views the configuration of an app
app:list (apps) Gets a list of all apps in the local repository
domain:add Adds a new domain to the project
environment:activate Activates an environment
environment:branch (branch) Branches an environment, or creates a Git branch
environment:checkout (checkout) Checks out an environment, or Git branch
environment:delete Deletes an environment
environment:http-access (httpaccess) Updates HTTP access settings for an environment
environment:info Reads or sets properties for an environment
environment:list (environments) Gets a list of environments
environment:logs (log) Reads an environment's logs
environment:merge (merge) Merges an environment
environment:relationships (relationships) Displays an environment's relationships
environment:routes (routes) Lists an environment's routes
environment:sql (sql) Runs SQL on the remote database
environment:sql-dump (sql-dump) Creates a local dump of the remote database
environment:ssh (ssh) Opens an SSH session to the current environment
environment:synchronize (sync) Synchronizes an environment's code and or data from its parent
environment:url (url) Gets the public URLs of an environment
integration:add Add an integration to the project
integration:delete Deletes an integration from a project
integration:list (integrations) Views project integration(s)
integration:update Updates an integration
local:build (build) Builds the current project locally
local:clean (clean) Removes old project builds
project:delete Deletes a project
prohect:get (get) Clones a project locally
project:info Reads or sets properties for a project
project:list (projects) Gets a list of all active projects
self:install Installs or updates CLI configuration files
self:update (self-update) Updates the CLI tot he latest version
snapshot:create (backup) Makes a snapshot of an environment
snapshot:list (snapshots) List available snapshots of an environment
snapshot:restore Restores an environment snapshot
ssh-key:add Adds a new SSH key
ssh-key:delete Deletes an SSH key
ssh-key:list (ssh-keys) Gets a list of SSH keys in your account
tunnelclose Closes SSH tunnels
tunnel:info Views relationships info for SSH tunnels
tunnel:list (tunnels) Lists SSH tunnels
tunnel:open Open SSH tunnels to an app's relationship
user:add Adds a user to the project
user:delete Deletes a user from the project
user:list (users) Lists users for the project
variable:delete Deletes an environment variable
variable:get (variables, vget) Views variable(s) for an environment
variable:set (vset) Sets an environment variable