describeVolumes

abstract suspend fun describeVolumes(input: DescribeVolumesRequest = DescribeVolumesRequest { }): DescribeVolumesResponse

Describes the specified EBS volumes or all of your EBS volumes.

If you are describing a long list of volumes, we recommend that you paginate the output to make the list more manageable. For more information, see Pagination.

For more information about EBS volumes, see Amazon EBS volumes in the Amazon Elastic Compute Cloud User Guide.

Samples

import aws.sdk.kotlin.services.ec2.model.Filter
fun main() { 
   //sampleStart 
   // This example describes all of your volumes in the default region.
val resp = ec2Client.describeVolumes() 
   //sampleEnd
}
import aws.sdk.kotlin.services.ec2.model.Filter
fun main() { 
   //sampleStart 
   // This example describes all volumes that are both attached to the instance with the ID i
// 1234567890abcdef0 and set to delete when the instance terminates.
val resp = ec2Client.describeVolumes {
    filters = listOf<Filter>(
        Filter {
            values = listOf<String>(
                "i-1234567890abcdef0"
            )
            name = "attachment.instance-id"
        },
        Filter {
            values = listOf<String>(
                "true"
            )
            name = "attachment.delete-on-termination"
        }            
    )
} 
   //sampleEnd
}