-2

I am executing the command below in AWS CLI to find volumes that have size>=200GIB but the command returns nothing. But from the AWS console I can see that few volumes have a size >=200GiB

aws ec2 describe-volumes  --filter "Name=size,Values= >=200GiB"
TylerH
  • 20,799
  • 66
  • 75
  • 101
sakshi
  • 121
  • 1
  • 3
  • 9
  • 2
    I've noticed that almost all your questions got answers, yet not a single answer was ever accepted. Accepting helpful answers is not only a good practice, but it reduces the number of duplicates and helps others. – Marcin May 06 '21 at 05:05

2 Answers2

3

You can use the following:

aws ec2 describe-volumes --query 'Volumes[?Size > `250`].[VolumeId,Size]' --output text
Marcin
  • 215,873
  • 14
  • 235
  • 294
  • I get this error when I execute the command – sakshi May 17 '21 at 06:21
  • C:\Users\Sakshi Gupta>aws ec2 describe-volumes --query 'Volumes[?Size > `250`].[VolumeId,Size]' --output text Bad value for --query 'Volumes[?Size: Bad jmespath expression: Unclosed ' delimiter: 'Volumes[?Size – sakshi May 17 '21 at 06:22
0

I think correct format is

aws ec2 describe-volumes --query "Volumes[?Size > 100].{tag:Tags,ID:VolumeId,size:Size,type:VolumeType}"

Above command is working at my end

sakshi
  • 121
  • 1
  • 3
  • 9