SSH access with Clever Tools

While direct SSH access to instances is not recommended in an immutable infrastructure setup, it can be useful for debugging purposes. Clever Cloud allows you to connect to running instances via SSH.

SSH access is meant only for debugging purposes

Clever Cloud instances are to be seen as read-only resources. Any change made on an instance will not be persisted. You can use SSH access for quick tests, but if you want to persist changes, you need to commit them in your repository. Changes made on instances are not kept across deployments.

SSH access is disabled on Docker instances

For security reasons, SSH access is disabled for Docker applications. Contact the support if you need help to debug your Docker applications.

Make sure you have a properly configured SSH key

To use SSH access, you need to have a SSH key properly configured in your Clever Cloud account.

Using clever-tools, with a linked application

You can access running instances of a linked application with clever ssh.

clever ssh
> Opening an ssh shell
> bas@67fbf787-3518-47bb-abd9-2c2575844edd ~ $

If multiple instances are running, you will be asked which one to use:

clever ssh
> 1) Sleepy Ponita - Instance 0 - UP (11281f38-31ff-43a7-8595-a2d82630c32b)
> 2) Tense Caterpie - Instance 1 - UP (b10d19d9-5238-408b-b038-3e32c7a301c2)
> Your choice: 1
> Opening an ssh shell
> bas@11281f38-31ff-43a7-8595-a2d82630c32b ~ $

For Windows users

clever ssh command will fail on PowerShell or cmd.exe if there is no ssh.exe in your path, which is true for most users. To be able to overcome this problem, the most straightforward solution is to start "clever ssh" from "git-bash".

Without clever-tools

Alternatively, you can connect using only your ssh client:

ssh -t ssh@sshgateway-clevercloud-customers.services.clever-cloud.com <app_id>

Don't forget the -t flag

Don't forget the -t flag, it is mandatory for the ssh connection to work properly. If your terminal hangs and you see pseudo-terminal will not be allocated because stdin is not a terminal, it's likely you've forgotten the -t flag.

You can omit the application ID. In that case, you will be asked to choose an organization and an application.

Access your application's folder

Your application's folder is located at: /home/bas/<app_id>

Show your application's logs

If you want to show your application's logs while you debug:

journalctl -efa -u bas-deploy.service

You can also use journalctl with other options if you need it

Edit me on GitHub