CLI Tool
Command-line interface for managing Fugoku Cloud infrastructure
Fugoku CLI
The Fugoku CLI provides a fast, scriptable way to manage your infrastructure from the terminal.
Installation
macOS
Homebrew:
brew install fugoku/tap/fugoku-cliManual:
curl -sSL https://cli.fugoku.com/install-macos.sh | bashLinux
Debian/Ubuntu:
curl -sSL https://cli.fugoku.com/install.sh | sudo bashArch Linux:
yay -S fugoku-cliManual (any distro):
curl -sSL https://cli.fugoku.com/install.sh | bashWindows
PowerShell:
iwr https://cli.fugoku.com/install.ps1 -useb | iexWSL: Use Linux installation method.
npm/yarn (cross-platform)
npm install -g @fugoku/cli
# or
yarn global add @fugoku/cliVerify Installation
fugoku version
# Fugoku CLI v1.4.2Authentication
Interactive Login
fugoku auth loginOpens browser for OAuth flow. Credentials saved to ~/.fugoku/config.json.
API Token
# Set token directly
fugoku auth set-token fgk_abc123...
# Or use environment variable
export FUGOKU_API_TOKEN="fgk_abc123..."Get token: Console → Account → API Credentials
Logout
fugoku auth logoutCheck Current User
fugoku auth whoami
# Logged in as: user@example.com
# Account ID: acc-xyz789Configuration
Config stored at ~/.fugoku/config.json.
View Config
fugoku config listSet Default Region
fugoku config set default-region lagos-1Set Output Format
# Options: table (default), json, yaml
fugoku config set output jsonMultiple Profiles
# Create new profile
fugoku auth login --profile production
# Use specific profile
fugoku --profile production instances list
# Set default profile
fugoku config set default-profile productionCompute Commands
List Instances
# All instances
fugoku instances list
# Filter by region
fugoku instances list --region lagos-1
# Filter by status
fugoku instances list --status running
# Filter by tag
fugoku instances list --tag productionOutput:
ID NAME PLAN STATUS IP REGION
inst-abc123 web-1 standard-2 running 102.89.45.178 lagos-1
inst-def456 web-2 standard-2 running 102.89.45.179 lagos-1
inst-ghi789 db-1 ram-4 running 10.10.0.10 lagos-1Get Instance Details
fugoku instances get web-1
# JSON output
fugoku instances get web-1 --output jsonCreate Instance
# Basic
fugoku create instance \
--name web-1 \
--plan standard-2 \
--image ubuntu-22.04 \
--region lagos-1
# Advanced
fugoku create instance \
--name web-1 \
--plan standard-2 \
--image ubuntu-22.04 \
--region lagos-1 \
--ssh-key laptop \
--tag production \
--tag web \
--private-network backend-net \
--enable-backups \
--user-data @cloud-init.yamlWait for provisioning:
fugoku create instance --name web-1 --plan standard-2 --image ubuntu-22.04 --wait
# ✓ Instance created: inst-abc123
# ⏳ Provisioning... (45s)
# ✓ Instance running
# IP: 102.89.45.178Instance Actions
# Start
fugoku instances start web-1
# Stop
fugoku instances stop web-1
# Reboot
fugoku instances reboot web-1
# Rebuild (reinstall OS)
fugoku instances rebuild web-1 --image ubuntu-24.04 --confirm
# Resize
fugoku instances resize web-1 --plan standard-4Delete Instance
fugoku instances delete web-1 --confirmSSH Into Instance
# Direct SSH (CLI manages keys)
fugoku ssh web-1
# Get SSH command
fugoku ssh web-1 --command
# Output: ssh ubuntu@102.89.45.178Instance Metrics
fugoku instances stats web-1
# Output:
# CPU: 12.5% (0.25 / 2 cores)
# RAM: 1.8 GB / 4 GB (45%)
# Disk: 2.1 GB / 80 GB (3%)
# Network: ↓ 450 Kbps ↑ 120 Kbps
# Uptime: 2h 34mStorage Commands
List Volumes
fugoku volumes listCreate Volume
fugoku volumes create \
--name my-data \
--size 100 \
--region lagos-1Attach Volume
fugoku volumes attach my-data --instance web-1Detach Volume
fugoku volumes detach my-dataResize Volume
fugoku volumes resize my-data --size 200Delete Volume
fugoku volumes delete my-data --confirmSnapshots
# Create snapshot
fugoku snapshots create my-data --name before-upgrade
# List snapshots
fugoku snapshots list
# Restore from snapshot
fugoku volumes restore my-data --snapshot snap-abc123 --confirm
# Enable automatic snapshots
fugoku snapshots enable \
--volume my-data \
--schedule daily \
--time 02:00 \
--retention 7
# Disable automatic snapshots
fugoku snapshots disable --volume my-dataNetworking Commands
Private Networks
# Create network
fugoku networks create \
--name backend-net \
--subnet 10.10.0.0/24 \
--region lagos-1
# List networks
fugoku networks list
# Attach instance to network
fugoku networks attach backend-net --instance web-1
# Detach instance from network
fugoku networks detach backend-net --instance web-1
# Delete network
fugoku networks delete backend-net --confirmFloating IPs
# Create floating IP
fugoku networking create-ip --region lagos-1
# IP: 102.89.45.200
# List floating IPs
fugoku networking list-ips
# Assign to instance
fugoku networking assign-ip web-1 --ip 102.89.45.200
# Unassign from instance
fugoku networking unassign-ip --ip 102.89.45.200
# Delete floating IP
fugoku networking delete-ip 102.89.45.200 --confirmLoad Balancers
# Create load balancer
fugoku lb create \
--name api-lb \
--region lagos-1 \
--algorithm round-robin \
--protocol http \
--port 80 \
--backend-port 8080
# Add backend instance
fugoku lb add-backend api-lb --instance api-1
# Remove backend
fugoku lb remove-backend api-lb --instance api-1
# Configure health check
fugoku lb set-health-check api-lb \
--path /health \
--interval 10 \
--timeout 5 \
--unhealthy-threshold 3
# List load balancers
fugoku lb list
# Get load balancer details
fugoku lb get api-lb
# Delete load balancer
fugoku lb delete api-lb --confirmFirewalls
# List rules for instance
fugoku firewalls list-rules web-1
# Add rule
fugoku firewalls add-rule web-1 \
--direction inbound \
--protocol tcp \
--port 80 \
--source 0.0.0.0/0
# Remove rule
fugoku firewalls remove-rule web-1 --rule-id rule-abc123
# Create security group
fugoku firewalls create-group \
--name web-servers \
--description "Rules for web tier"
# Apply security group to instance
fugoku firewalls apply web-servers --instance web-1SSH Keys
# List SSH keys
fugoku ssh-keys list
# Add SSH key
fugoku ssh-keys add --name laptop ~/.ssh/id_rsa.pub
# Delete SSH key
fugoku ssh-keys delete laptop --confirmImages
# List available images
fugoku images list
# Filter by OS
fugoku images list --os ubuntu
# Get image details
fugoku images get ubuntu-22.04Account & Billing
# Account info
fugoku account info
# Current usage
fugoku account usage
# Usage for specific period
fugoku account usage --start 2024-02-01 --end 2024-02-29
# List invoices
fugoku account invoices
# Download invoice
fugoku account invoice feb-2024 --download invoice.pdfRegions
# List available regions
fugoku regions list
# Output:
# ID NAME LOCATION
# lagos-1 Lagos 1 Lagos, Nigeria
# london-1 London 1 London, UK
# frankfurt-1 Frankfurt 1 Frankfurt, GermanyOutput Formats
Table (default)
fugoku instances listJSON
fugoku instances list --output json[
{
"id": "inst-abc123",
"name": "web-1",
"plan": "standard-2",
"status": "running",
"public_ip": "102.89.45.178"
}
]YAML
fugoku instances list --output yamlQuiet (IDs only)
fugoku instances list --quiet
# inst-abc123
# inst-def456
# inst-ghi789Scripting & Automation
Batch Operations
# Start all stopped instances
fugoku instances list --status stopped --quiet | xargs -n1 fugoku instances start
# Delete all instances with tag 'temp'
fugoku instances list --tag temp --quiet | xargs -n1 fugoku instances delete --confirm
# Create 5 web servers
for i in {1..5}; do
fugoku create instance \
--name web-$i \
--plan standard-2 \
--image ubuntu-22.04 \
--region lagos-1 \
--wait &
done
waitScripting Example: Deploy Stack
#!/bin/bash
set -e
REGION="lagos-1"
# Create private network
fugoku networks create --name app-net --subnet 10.10.0.0/24 --region $REGION
# Create database instance
fugoku create instance \
--name postgres-1 \
--plan ram-4 \
--image ubuntu-22.04 \
--region $REGION \
--private-network app-net \
--enable-backups \
--wait
# Create app instances
for i in {1..3}; do
fugoku create instance \
--name app-$i \
--plan standard-2 \
--image ubuntu-22.04 \
--region $REGION \
--private-network app-net \
--wait &
done
wait
# Create load balancer
fugoku lb create \
--name app-lb \
--region $REGION \
--algorithm least-connections \
--protocol http \
--port 80 \
--backend-port 3000
# Add backends
for i in {1..3}; do
fugoku lb add-backend app-lb --instance app-$i
done
echo "Stack deployed successfully!"
fugoku lb get app-lbEnvironment Variables
# API token
export FUGOKU_API_TOKEN="fgk_abc123..."
# Default region
export FUGOKU_DEFAULT_REGION="lagos-1"
# Output format
export FUGOKU_OUTPUT="json"
# Disable color output
export FUGOKU_NO_COLOR=1Exit Codes
The CLI uses standard exit codes:
0- Success1- General error2- Invalid arguments3- Authentication failed4- Resource not found5- Operation failed
Example:
if fugoku instances get web-1 > /dev/null 2>&1; then
echo "Instance exists"
else
echo "Instance not found"
fiCompletion
Bash
# Add to ~/.bashrc
source <(fugoku completion bash)Zsh
# Add to ~/.zshrc
source <(fugoku completion zsh)Fish
fugoku completion fish | sourceDebugging
Verbose Output
fugoku --verbose instances list
# Shows HTTP requests and responsesDebug Mode
fugoku --debug instances create --name test
# Shows full request/response bodiesUpdates
Check for Updates
fugoku version --check
# Current: v1.4.2
# Latest: v1.5.0
# Update available! Run: fugoku updateUpdate CLI
fugoku updateOr use package manager:
# Homebrew
brew upgrade fugoku-cli
# npm
npm update -g @fugoku/cliExamples
Deploy WordPress
# Create database instance
fugoku create instance \
--name wordpress-db \
--plan ram-2 \
--image ubuntu-22.04 \
--region lagos-1 \
--wait
# Install MySQL
fugoku ssh wordpress-db << 'EOF'
sudo apt update
sudo apt install -y mysql-server
sudo mysql -e "CREATE DATABASE wordpress;"
sudo mysql -e "CREATE USER 'wpuser'@'%' IDENTIFIED BY 'secure_password';"
sudo mysql -e "GRANT ALL ON wordpress.* TO 'wpuser'@'%';"
exit
EOF
# Create web instance
fugoku create instance \
--name wordpress-web \
--plan standard-2 \
--image ubuntu-22.04 \
--region lagos-1 \
--wait
# Install WordPress
fugoku ssh wordpress-web << 'EOF'
sudo apt update
sudo apt install -y nginx php-fpm php-mysql
cd /var/www
sudo wget https://wordpress.org/latest.tar.gz
sudo tar xzf latest.tar.gz
sudo chown -R www-data:www-data wordpress
# Configure nginx...
exit
EOF
# Assign floating IP
fugoku networking create-ip --region lagos-1
fugoku networking assign-ip wordpress-web --ip $(fugoku networking list-ips --quiet | head -1)Backup and Restore
# Snapshot all production instances
fugoku instances list --tag production --quiet | while read id; do
fugoku snapshots create $id --name "backup-$(date +%Y%m%d)"
done
# Restore from snapshot
fugoku instances rebuild web-1 --snapshot snap-abc123 --confirmMonitor Resources
# Watch instance stats
watch -n 5 'fugoku instances stats web-1'
# Alert if CPU high
while true; do
CPU=$(fugoku instances stats web-1 --output json | jq -r '.cpu_percent')
if (( $(echo "$CPU > 80" | bc -l) )); then
echo "ALERT: CPU at $CPU%"
# Send notification...
fi
sleep 60
doneTroubleshooting
Command not found
# Verify installation
which fugoku
# Check PATH
echo $PATH
# Reinstall if needed
curl -sSL https://cli.fugoku.com/install.sh | bashAuthentication errors
# Check token
fugoku auth whoami
# Re-login
fugoku auth logout
fugoku auth loginConnection issues
# Test API connectivity
curl -I https://api.fugoku.com/v1/status
# Use verbose mode
fugoku --verbose instances listGetting Help
# General help
fugoku help
# Command help
fugoku instances --help
fugoku instances create --help
# Version info
fugoku versionDocumentation: docs.fugoku.com/cli
Support: support@fugoku.com
Next Steps:
- Read the API Documentation for programmatic access
- Learn about Infrastructure as Code for Terraform
- Explore the Console for web UI
- Browse Compute Options for instance types