I am trying to find out the vpc-id of an instance. Can anyone refer to an API that would work this out? Im using the java sdk.
You can try doing the below one inside the ec2-instance
First you need to find the macid of the instance
macid=$(curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/)
and use the macid below
curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/${macid}/vpc-id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With