Please help me to list EBS volume Ids attached to an EC2 instance.
The property is on all objects (instances, volumes, network interfaces) but doesn't show in the object explorer.
Edit: I just fixed the code above, I had a double dot notation (client..getAmazonEC2Client())
Moderator note: This discussion belongs in the vRO forum area, so I moved it there.
Using the vRO AWS plug-in
// Where ec2Instance is of type AWS:EC2Instance
var ec2Client = ec2Instance.client.getAmazonEC2Client();
var ec2DescribeVolumesRequest = new EC2DescribeVolumesRequest();
var ec2Filter = new EC2Filter();
ec2Filter.setName("attachment.instance-id");
ec2Filter.setValues([ec2Instance.instanceId]);
var result = ec2Client.describeVolumes(ec2DescribeVolumesRequest.withFilters([ec2Filter]));
return result.getVolumes();
Thanx for the reply.
U suggested to take Input type of ec2Instance(AWS:EC2Instance)
But AWS:EC2Instance does not show ec2instance.client attribute.
Error message showing cannot ec2instance.client.
Please help me to resolve this
The property is on all objects (instances, volumes, network interfaces) but doesn't show in the object explorer.
Edit: I just fixed the code above, I had a double dot notation (client..getAmazonEC2Client())
Thanx for the help .
This is our output file having Volumes attached to it.
[2016-11-09 05:47:43.979] [I] DynamicWrapper (Instance) : [EC2Volume]-[class com.vmware.o11n.plugin.aws.ec2.model.Volume] -- VALUE : {VolumeId: vol-b43f8528,Size: 20,SnapshotId: snap-3ecc5a48,AvailabilityZone: us-east-1a,State: in-use,CreateTime: Wed Nov 02 09:21:24 EDT 2016,Attachments: [{VolumeId: vol-b43f8528,InstanceId: i-dec3e347,Device: /dev/sda1,State: attached,AttachTime: Wed Nov 02 09:21:24 EDT 2016,DeleteOnTermination: true}],Tags: [{Key: InstanceID,Value: i-dec3e347}, {Key: CostCenter,Value: 0002355678}, {Key: ProjectName,Value: Development AWS Snapshot}],VolumeType: gp2,Iops: 100},DynamicWrapper (Instance) : [EC2Volume]-[class com.vmware.o11n.plugin.aws.ec2.model.Volume] -- VALUE : {VolumeId: vol-063f859a,Size: 1,SnapshotId: ,AvailabilityZone: us-east-1a,State: in-use,CreateTime: Wed Nov 02 09:21:41 EDT 2016,Attachments: [{VolumeId: vol-063f859a,InstanceId: i-dec3e347,Device: xvdf,State: attached,AttachTime: Wed Nov 02 09:22:02 EDT 2016,DeleteOnTermination: false}],Tags: [{Key: Description,Value: }, {Key: CostCenter,Value: 0002355678}, {Key: Name,Value: EBS}, {Key: InstanceID,Value: i-dec3e347}, {Key: VCAC Owner,Value: }, {Key: ProjectName,Value: Development AWS Snapshot}],VolumeType: standard,}
How to filter out only volume Ids from this output. Please help
If you look in the Object Explorer at AWS:EC2Volume you will see it has a getVolumeId() method; it also has a volumeId property but this isn't show in the explorer.
Thus:
// where ec2Volumes is your result from the previous code (AWS:EC2olumes[])
for each (var ec2Volume in ec2Volumes) {
System.debug(ec2Volume.volumeId);
}
When using the plug-in, you'll need to dig around in the API explorer looking at the AWS classes and methods; at the same time, it's best to look through the AWS Javadocs to get an idea of how it all works, as sometimes the plug-in does things differently or hasn't exposed certain methods/properties.
This question is Not Answered.(Mark as assumed answered)
Cloud_dev Nov 15, 2016 10:10 PM
Please help me to find out list of snapshots created from a EBS volume through VRO workflow/action element.?