Connection
aws ec2 describe-instances
List all EC2 instances including those with EBS volumes
aws ec2 describe-volumes
List all EBS volumes in your account
aws ec2 describe-volumes --filters Name=attachment.instance-id,Values=i-1234567890abcdef0
List EBS volumes attached to a specific instance
aws configure
Set up AWS CLI credentials to access EBS
Volume Management
aws ec2 create-volume --availability-zone us-west-2a --size 100
Create a new 100GB EBS volume in specified AZ
aws ec2 attach-volume --volume-id vol-1234567890abcdef0 --instance-id i-1234567890abcdef0 --device /dev/sdf
Attach an EBS volume to an instance
aws ec2 detach-volume --volume-id vol-1234567890abcdef0
Detach an EBS volume from an instance
aws ec2 delete-volume --volume-id vol-1234567890abcdef0
Delete an EBS volume
Monitoring
aws cloudwatch get-metric-statistics --namespace AWS/EBS --metric-name VolumeReadOps --dimensions Name=VolumeId,Value=vol-1234567890abcdef0
Get read operations metrics for a specific volume
aws cloudwatch get-metric-statistics --namespace AWS/EBS --metric-name VolumeWriteOps --dimensions Name=VolumeId,Value=vol-1234567890abcdef0
Get write operations metrics for a specific volume
aws cloudwatch get-metric-statistics --namespace AWS/EBS --metric-name VolumeQueueLength --dimensions Name=VolumeId,Value=vol-1234567890abcdef0
Get queue length metrics for a specific volume
Snapshots
aws ec2 create-snapshot --volume-id vol-1234567890abcdef0 --description 'Snapshot for backup'
Create a snapshot of an EBS volume
aws ec2 describe-snapshots --owner-ids self
List all snapshots owned by your account
aws ec2 delete-snapshot --snapshot-id snap-1234567890abcdef0
Delete a snapshot
aws ec2 copy-snapshot --source-region us-west-2 --source-snapshot-id snap-1234567890abcdef0 --destination-region us-east-1
Copy a snapshot to another region
Performance
aws ec2 modify-volume --volume-id vol-1234567890abcdef0 --volume-type gp3 --iops 3000 --throughput 125
Modify an EBS volume to change its type and performance characteristics
aws ec2 describe-volumes-modifications --volume-ids vol-1234567890abcdef0
Check the status of a volume modification
Encryption
aws ec2 copy-snapshot --source-region us-west-2 --source-snapshot-id snap-1234567890abcdef0 --encrypted
Create an encrypted copy of a snapshot
aws ec2 create-volume --snapshot-id snap-1234567890abcdef0 --encrypted --kms-key-id alias/aws/ebs
Create an encrypted volume from a snapshot