Using this command I can be able to list the volume details with instance id and volume size.
aws ec2 describe-volumes –-query "Volumes[*].[Attachments[0].VolumeId,AvailabilityZone,Attachments[0].InstanceId,Attachments[0].State,Size]" --output text > test.txt
But my query I have to consolidate the whole instance list its includes instance id, instance state, region, platform, key pair name along with attached volumes name, volume id, volume size and mount path name like /dev/sda1,
Please help me with this.
Using this command can be able to get the instance details but I need to single query to get all the details.
aws ec2 describe-instances --filters "Name=instance-state-name,Values=*" --query "Reservations[].Instances[].[Tags[?Key==`Name`]| [0].Value,InstanceId,State.Name,InstanceType,Placement.AvailabilityZone,PrivateIpAddress,VolumeInfo:BlockDeviceMappings" --output text > instances.txt