aws_ec2_メタデータインスタンスの動作確認
前提
ec2インスタンス
##1.接続
ssh ec2-user@xx.xx.xx.xx -i <keyname>
sudo su
#
##2.curlコマンドでメタデータ一覧を表示
]# curl http://169.254.169.254/latest/meta-data/
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
events/
hostname
iam/
identity-credentials/
instance-action
instance-id
instance-type
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups
3.オプションをいくつか実行
public--ipv4ならipアドレスがリターン
macならMACアドレスがリターン
# curl http://169.254.169.254/latest/meta-data/public-ipv4
18.182.13.197[root@ip-xxx-xx-xx-xxx ec2-user]#
# curl http://169.254.169.254/latest/meta-data/mac
06:aa:23:25:d6:7a[root@ip-xxx-xx-xx-xxx ec2-user]#
課題:
用途があまりよくわかっていない。