title: Find all the attached volumes for an EC2 instance
body: <p>I'm using the below code to get all the available volumes under EC2. But I can't find any Ec2 api to get already attached volumes with an instance. Please let me know how to get all attached volumes using instanceId.</p>
  
  <pre><code>EC2Api ec2Api = computeServiceContext.unwrapApi(EC2Api.class);
  List&lt;String&gt; volumeLists = new ArrayList&lt;String&gt;();
  if (null != volumeId) {
      volumeLists.add(volumeId);
  }
  String[] volumeIds = volumeLists.toArray(new String[0]);
  LOG.info("the volume IDs got from user is ::"+ Arrays.toString(volumeIds));
  
  Set&lt;Volume&gt; ec2Volumes = ec2Api.getElasticBlockStoreApi().get()
                      .describeVolumesInRegion(region, volumeIds);
  
  Set&lt;Volume&gt; availableVolumes = Sets.newHashSet();
  for (Volume volume : ec2Volumes) {
      if (volume.getSnapshotId() == null
              &amp;&amp; volume.getStatus() == Volume.Status.AVAILABLE) {
          LOG.debug("available volume with no snapshots ::" + volume.getId());
          availableVolumes.add(volume);
     }
  }
  </code></pre>