0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

EC2のインスタンスメタデータ確認

Last updated at Posted at 2020-06-21

EC2インスタンス上で実行。169.254.169.254/latest/meta-data/にアクセスする。REST形式のAPIになっているので、取得したい要素を指定する

% curl http://169.254.169.254/latest/meta-data/
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
events/
hibernation/
hostname
iam/
identity-credentials/
instance-action
instance-id
instance-life-cycle
instance-type
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups
services/

例)hostnameを取得したい場合

% curl http://169.254.169.254/latest/meta-data/hostname
ip-XXX-XXX-XXX-XXX.ap-northeast-1.compute.internal
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?