cli-tool
intermediate
utility
DigitalOcean CLI (doctl)
"Clase de la hoja"
########################################################################################################################################################################################################################################################## Copiar todos los comandos
■/div titulada
Digital Integral Océano Comandos y flujos de trabajo CLI para gestionar gotas, balanceadores de carga, bases de datos y grupos Kubernetes.
Instalación " Autenticación
Command
Description
doctl auth init
Initialize authentication
doctl auth list
List authentication contexts
doctl auth switch --context CONTEXT_NAME
Switch authentication context
doctl account get
Get account information
doctl balance get
Get account balance
Droplets (Máquinas virtuales)
Droplet Management
Command
Description
doctl compute droplet list
List all droplets
doctl compute droplet create mydroplet --size s-1vcpu-1gb --image ubuntu-20-04-x64 --region nyc1
Create droplet
doctl compute droplet delete DROPLET_ID
Delete droplet
doctl compute droplet get DROPLET_ID
Get droplet details
doctl compute droplet reboot DROPLET_ID
Reboot droplet
doctl compute droplet power-off DROPLET_ID
Power off droplet
doctl compute droplet power-on DROPLET_ID
Power on droplet
doctl compute droplet shutdown DROPLET_ID
Shutdown droplet
Droplet Actions
Command
Description
doctl compute droplet-action list DROPLET_ID
List droplet actions
doctl compute droplet-action resize DROPLET_ID --size s-2vcpu-2gb
Resize droplet
doctl compute droplet-action snapshot DROPLET_ID --snapshot-name my-snapshot
Create snapshot
doctl compute droplet-action restore DROPLET_ID --image IMAGE_ID
Restore from image
doctl compute droplet-action rebuild DROPLET_ID --image ubuntu-20-04-x64
Rebuild droplet
SSH y Access
Command
Description
doctl compute ssh DROPLET_NAME
SSH into droplet
doctl compute ssh DROPLET_NAME --ssh-user root
SSH with specific user
doctl compute ssh-key list
List SSH keys
doctl compute ssh-key create --name mykey --public-key-file ~/.ssh/id_rsa.pub
Add SSH key
doctl compute ssh-key delete KEY_ID
Delete SSH key
Imágenes y instantáneas
Command
Description
doctl compute image list
List all images
doctl compute image list --public
List public images
doctl compute image list-user
List user images
doctl compute image get IMAGE_ID
Get image details
doctl compute image delete IMAGE_ID
Delete image
doctl compute image update IMAGE_ID --name new-name
Update image name
Volumen (Block Storage)
Command
Description
doctl compute volume list
List all volumes
doctl compute volume create myvolume --size 100GiB --region nyc1
Create volume
doctl compute volume delete VOLUME_ID
Delete volume
doctl compute volume attach VOLUME_ID DROPLET_ID
Attach volume to droplet
doctl compute volume detach VOLUME_ID
Detach volume
doctl compute volume snapshot VOLUME_ID --snapshot-name my-volume-snapshot
Create volume snapshot
Salarios de carga
Command
Description
doctl compute load-balancer list
List load balancers
doctl compute load-balancer create --name mylb --forwarding-rules entry_protocol:http,entry_port:80,target_protocol:http,target_port:80 --region nyc1
Create load balancer
doctl compute load-balancer delete LB_ID
Delete load balancer
doctl compute load-balancer add-droplets LB_ID --droplet-ids DROPLET_ID1,DROPLET_ID2
Add droplets to LB
doctl compute load-balancer remove-droplets LB_ID --droplet-ids DROPLET_ID1
Remove droplets from LB
Redes
cortafuegos
Command
Description
doctl compute firewall list
List firewalls
doctl compute firewall create --name myfirewall --inbound-rules protocol:tcp,ports:22,sources:0.0.0.0/0
Create firewall
doctl compute firewall delete FIREWALL_ID
Delete firewall
doctl compute firewall add-droplets FIREWALL_ID --droplet-ids DROPLET_ID
Add droplets to firewall
doctl compute firewall remove-droplets FIREWALL_ID --droplet-ids DROPLET_ID
Remove droplets from firewall
VPC Redes
Command
Description
doctl vpcs list
List VPCs
doctl vpcs create --name myvpc --region nyc1
Create VPC
doctl vpcs delete VPC_ID
Delete VPC
doctl vpcs get VPC_ID
Get VPC details
IPs flotantes
Command
Description
doctl compute floating-ip list
List floating IPs
doctl compute floating-ip create --region nyc1
Create floating IP
doctl compute floating-ip delete FLOATING_IP
Delete floating IP
doctl compute floating-ip-action assign FLOATING_IP DROPLET_ID
Assign floating IP
doctl compute floating-ip-action unassign FLOATING_IP
Unassign floating IP
Kubernetes (DOKS)
Cluster Management
Command
Description
doctl kubernetes cluster list
List Kubernetes clusters
doctl kubernetes cluster create mycluster --region nyc1 --node-pool "name=worker-pool;size=s-2vcpu-2gb;count=3"
Create cluster
doctl kubernetes cluster delete CLUSTER_ID
Delete cluster
doctl kubernetes cluster get CLUSTER_ID
Get cluster details
doctl kubernetes cluster kubeconfig save CLUSTER_ID
Save kubeconfig
Node Pools
Command
Description
doctl kubernetes cluster node-pool list CLUSTER_ID
List node pools
doctl kubernetes cluster node-pool create CLUSTER_ID --name new-pool --size s-2vcpu-2gb --count 2
Create node pool
doctl kubernetes cluster node-pool delete CLUSTER_ID POOL_ID
Delete node pool
doctl kubernetes cluster node-pool resize CLUSTER_ID POOL_ID --count 5
Resize node pool
Bases de datos
Listas de bases de datos
Command
Description
doctl databases list
List database clusters
doctl databases create mydb --engine mysql --size db-s-1vcpu-1gb --region nyc1
Create database cluster
doctl databases delete DATABASE_ID
Delete database cluster
doctl databases get DATABASE_ID
Get database details
doctl databases resize DATABASE_ID --size db-s-2vcpu-2gb
Resize database
Operaciones de base de datos
Command
Description
doctl databases db list DATABASE_ID
List databases
doctl databases db create DATABASE_ID --name myapp
Create database
doctl databases db delete DATABASE_ID myapp
Delete database
doctl databases user list DATABASE_ID
List database users
doctl databases user create DATABASE_ID --username myuser
Create database user
Respaldos de bases de datos
Command
Description
doctl databases backups list DATABASE_ID
List backups
doctl databases backups restore DATABASE_ID BACKUP_ID
Restore from backup
Espacios (Objeto Almacenamiento)
Command
Description
doctl compute cdn list
List CDN endpoints
doctl compute cdn create --origin spaces.example.com --domain cdn.example.com
Create CDN endpoint
doctl compute cdn delete CDN_ID
Delete CDN endpoint
App Management
Command
Description
doctl apps list
List apps
doctl apps create --spec app.yaml
Create app from spec
doctl apps get APP_ID
Get app details
doctl apps delete APP_ID
Delete app
doctl apps update APP_ID --spec app.yaml
Update app
Implementación de aplicaciones
Command
Description
doctl apps list-deployments APP_ID
List deployments
doctl apps get-deployment APP_ID DEPLOYMENT_ID
Get deployment details
doctl apps logs APP_ID --type build
Get build logs
doctl apps logs APP_ID --type run
Get runtime logs
Supervisión
Alertas
Command
Description
doctl monitoring alert list
List alert policies
doctl monitoring alert create --spec alert.yaml
Create alert policy
doctl monitoring alert delete ALERT_ID
Delete alert policy
doctl monitoring alert get ALERT_ID
Get alert details
Proyectos
Command
Description
doctl projects list
List projects
doctl projects create --name myproject --description "My project"
Create project
doctl projects get PROJECT_ID
Get project details
doctl projects update PROJECT_ID --name "New name"
Update project
doctl projects resources list PROJECT_ID
List project resources
Regiones y tamaños
Command
Description
doctl compute region list
List available regions
doctl compute size list
List available droplet sizes
doctl kubernetes options regions
List Kubernetes regions
doctl kubernetes options versions
List Kubernetes versions
doctl databases options engines
List database engines
doctl databases options sizes
List database sizes