Commands Cheat Sheet

Evaluating engineering tools? Get the comparison in Google Sheets

(Perfect for making buy/build decisions or internal reviews.)

Most-used commands
Your email is safe thing.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

Connection

export ETCDCTL_API=3
Set the API version for etcdctl

etcdctl --endpoints=localhost:2379
Connect to a local etcd server

etcdctl --endpoints=https://example.com:2379 --cacert=/path/ca.pem --cert=/path/cert.pem --key=/path/key.pem
Connect to a secure etcd server with TLS

Key-Value Operations

etcdctl put key value
Store a key-value pair

etcdctl get key
Retrieve a value for a key

etcdctl get --prefix key
Get all keys-values with specified prefix

etcdctl get --limit=10 --prefix key
Get limited number of keys with prefix

etcdctl del key
Delete a key-value pair

etcdctl del --prefix key
Delete all keys with specified prefix

Cluster Management

etcdctl member list
List all members in the cluster

etcdctl member add name --peer-urls=https://example.com:2380
Add a new member to the cluster

etcdctl member remove member_id
Remove a member from the cluster

etcdctl member update member_id --peer-urls=https://example.com:2380
Update peer URLs of a member

Cluster Observability

etcdctl endpoint health
Check the health of endpoints

etcdctl endpoint status
Print endpoint status

etcdctl alarm list
List all alarms

etcdctl alarm disarm
Disarm all alarms

etcdctl endpoint health --cluster
Check health of all cluster endpoints

Snapshot & Backup

etcdctl snapshot save backup.db
Create a snapshot of the database

etcdctl snapshot restore backup.db
Restore a snapshot

etcdctl snapshot status backup.db
Get detailed information about a snapshot

Watch

etcdctl watch key
Watch for changes on a key

etcdctl watch --prefix key
Watch for changes on keys with prefix

etcdctl watch --rev=10 key
Watch for changes on key starting at a specific revision

Lease Management

etcdctl lease grant 60
Create a lease with a 60-second TTL

etcdctl lease revoke lease_id
Revoke a lease

etcdctl lease timetolive lease_id
Get lease information

etcdctl lease keep-alive lease_id
Keep a lease alive

Authentication

etcdctl user add username
Add a user

etcdctl user delete username
Delete a user

etcdctl user list
List all users

etcdctl role add rolename
Add a role

etcdctl role delete rolename
Delete a role

etcdctl role list
List all roles

etcdctl role grant-permission rolename read key
Grant read permission on key to role

etcdctl user grant-role username rolename
Grant role to user

etcdctl auth enable
Enable authentication

etcdctl auth disable
Disable authentication

Advanced

etcdctl compaction rev
Compact the event history to revision

etcdctl defrag
Defragment the database

etcdctl check perf
Check the performance of the etcd cluster