Automatically generate certificate on login

You can configure your local environment to generate the SSH certificate automatically when you authenticate to the magento-cloud CLI.

To add SSH certificate auto-generation to your magento-cloud CLI configuration:

  1. On your local workstation, create a file named config.yaml in the .magento-cloud folder in your home directory if it does not exist.

    touch ~/.magento-cloud/config.yaml
    
  2. Add the following configuration to the config.yaml file.

    api:
       auto_load_ssh_cert: true
    
  3. Use the magento-cloud CLI to authenticate again:

    Log out:

    magento-cloud logout
    

    Log in:

    magento-cloud login
    

    Follow the response:

    Please open the following URL in a browser and log in:
    http://127.0.0.1:5000
    
    Help:
      Leave this command running during login.
      If you need to quit, use Ctrl+C.
    
      To log in using an API token, run: magento-cloud auth:api-token-login
    
    Login information received. Verifying...
    You are logged in.
    
    Generating SSH certificate...
    A new SSH certificate has been generated.
    It will be automatically refreshed when necessary.
    The certificate is included in your SSH configuration: /Users/<user-name>/.ssh/config
    

Connect to an environment using SSH with TFA

When MFA is enabled on a project, you must have TFA enabled on your account before you can connect to a remote environment using an SSH. See Enable TFA.

recommendation-more-help