How do you find the EBS Volume IDS for a Volume that was created and attached at EC2 Instance Launch Time ?

0

When Creating and Attaching an EBS Volume at RunInstances time, the CreateVolume and AttachVolume CloudTrail entries are missing. I don't see any CloudTrail entries that are related to the created volume until we do a snapshot, then detach, then delete. Once the instance is running, if we create a second EBS Volume, and attach it, snapshot it, detach it, and then delete the volume, we what you would expect, which is CreateVolume -> AttachVolume -> CreateSnapshot -> DetachVolume -> DeleteVolume in the CloudTrail Logs.

When we look at the RunInstances event for the instance creation, there is no reference to the EBS Volume Id that was create during instance run time. My question is, is there any way to find all EBS volumes that are attached to a running EC2 instance when those EBS Volumes were created and attached at instance run time by using CloudTrail logs ?

We can see the volume information in the RunInstances JSON for the instance launch :

{ "deviceName": "/dev/sdb", "ebs": { "volumeSize": 5, "deleteOnTermination": true, "volumeType": "gp3", "iops": 3000, "throughput": 125 } } But again, there is no reference to the actual volume-id .

Thanks for any pointers !

jamestr
已提問 2 年前檢視次數 1409 次
1 個回答
1

Using the AWS CLI, you can use the Describe-Volume operation by passing the attached EC2 Instance ID as a filter to find ALL volumes attached to it.

Check out example 2 on in the CLI reference which is similar to what you are asking: https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-volumes.html

AWS
已回答 2 年前
  • Thank you, so if I read this correctly, it means that there is no way to find this without specifically querying for it , which is to say it will not show up in the logs due to the way it was created, you will have to go look for it, correct ?

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南