There are more AWS SDK examples available in the AWS Doc SDK Examples
Use DescribeVolumeStatus with a CLI
The following code examples show how to use DescribeVolumeStatus.
- CLI
-
- AWS CLI
-
Example 1: To describe the status of a single volume
The following
describe-volume-statusexample describes the status for the volumevol-1234567890abcdef0.aws ec2 describe-volume-status \ --volume-idsvol-1234567890abcdef0Output:
{ "VolumeStatuses": [ { "VolumeStatus": { "Status": "ok", "Details": [ { "Status": "passed", "Name": "io-enabled" }, { "Status": "not-applicable", "Name": "io-performance" } ] }, "AvailabilityZone": "us-west-2a", "VolumeId": "vol-1234567890abcdef0", "Actions": [], "Events": [] } ] }For more information, see Amazon EBS volume status checks in the Amazon EBS User Guide.
Example 2: To describe the status of impaired volumes
The following
describe-volume-statusexample describes the status for all volumes that are impaired. In this example output, there are no impaired volumes.aws ec2 describe-volume-status \ --filtersName=volume-status.status,Values=impairedOutput:
{ "VolumeStatuses": [] }For more information, see Work with an impaired Amazon EBS volume in the Amazon EBS User Guide.
-
For API details, see DescribeVolumeStatus
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
Example 1: This example describes the status of the specified volume.
Get-EC2VolumeStatus -VolumeId vol-12345678Output:
Actions : {} AvailabilityZone : us-west-2a Events : {} VolumeId : vol-12345678 VolumeStatus : Amazon.EC2.Model.VolumeStatusInfo(Get-EC2VolumeStatus -VolumeId vol-12345678).VolumeStatusOutput:
Details Status ------- ------ {io-enabled, io-performance} ok(Get-EC2VolumeStatus -VolumeId vol-12345678).VolumeStatus.DetailsOutput:
Name Status ---- ------ io-enabled passed io-performance not-applicable-
For API details, see DescribeVolumeStatus in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
Example 1: This example describes the status of the specified volume.
Get-EC2VolumeStatus -VolumeId vol-12345678Output:
Actions : {} AvailabilityZone : us-west-2a Events : {} VolumeId : vol-12345678 VolumeStatus : Amazon.EC2.Model.VolumeStatusInfo(Get-EC2VolumeStatus -VolumeId vol-12345678).VolumeStatusOutput:
Details Status ------- ------ {io-enabled, io-performance} ok(Get-EC2VolumeStatus -VolumeId vol-12345678).VolumeStatus.DetailsOutput:
Name Status ---- ------ io-enabled passed io-performance not-applicable-
For API details, see DescribeVolumeStatus in AWS Tools for PowerShell Cmdlet Reference (V5).
-