LoginSignup
0
0

More than 5 years have passed since last update.

EC2で自身のVPC_IDをmetadataから取得する

Posted at

instance metadataからVPCのID取れないかなと思って調べたらあっさりできました。

MAC_ADDRESS=$(curl http://169.254.169.254/latest/meta-data/mac)
VPC_ID=$(curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/$MAC_ADDRESS/vpc-id)
echo $VPC_ID

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0