Overview
The Ubicloud CLI uses personal access tokens for authentication. All API requests require a valid token set in theUBI_TOKEN environment variable.
Creating a Personal Access Token
- Log in to the Ubicloud Console
- Navigate to Settings → Access Tokens
- Click Create Token
- Give your token a descriptive name (e.g., “CLI Access”)
- Copy the token immediately - it won’t be shown again
Setting the Token
Temporary (Current Session)
Set the token for your current terminal session:Permanent Configuration
Add the token to your shell profile for persistent authentication:- Bash
- Zsh
- Fish
Replace
your-token-here with your actual token.Verify Authentication
Test that authentication is working:Token Management Best Practices
Security Recommendations
Use Separate Tokens for Different Purposes
Use Separate Tokens for Different Purposes
Create different tokens for:
- Development/testing environments
- Production deployments
- CI/CD pipelines
- Different team members
Rotate Tokens Regularly
Rotate Tokens Regularly
Periodically create new tokens and revoke old ones:
- Create a new token
- Update your configuration
- Verify the new token works
- Revoke the old token
Never Commit Tokens to Version Control
Never Commit Tokens to Version Control
Add token files to
.gitignore:.gitignore
Use Environment Management Tools
Use Environment Management Tools
For complex environments, consider using:
- direnv for per-directory environments
- Secret management tools like HashiCorp Vault
- CI/CD secret storage (GitHub Secrets, GitLab CI/CD Variables)
Environment Variables
The CLI supports these environment variables:Your personal access token for authentication.
API endpoint URL. Override for custom or development environments.
Enable debug output. Set to Debug output includes:
1 to see detailed request/response information.- Command arguments sent to API
- Executed commands with full arguments
- Validation steps
Tool-Specific Overrides
The CLI allows you to override the paths to external tools:Path to SSH executable.
Path to SCP executable.
Path to SFTP executable.
Path to psql executable.
Path to pg_dump executable.
Path to pg_dumpall executable.
Using Multiple Accounts
To work with multiple Ubicloud accounts, use shell functions or aliases:~/.bashrc
~/.bashrc
CI/CD Integration
For automated deployments, store the token as a secret:- GitHub Actions
- GitLab CI
- Jenkins
.github/workflows/deploy.yml
Troubleshooting
Token Not Found
If you see “Personal access token must be provided”:-
Verify the variable is set:
- Ensure there are no typos in the variable name
-
Check that your shell profile is loaded:
Invalid Token
If you get authentication errors:- Verify the token hasn’t been revoked in the console
- Check for extra whitespace or quotes:
- Generate a new token if needed
Token Exposed
If your token is accidentally exposed:- Immediately revoke it in the Ubicloud Console
- Create a new token
- Update all configurations using the old token
- Review access logs for suspicious activity
Next Steps
CLI Overview
Learn about available commands
Virtual Machines
Create and manage VMs