Get instance name via curl on ec2?

本小妞迷上赌 提交于 2020-03-04 18:43:39

问题


Is it possible to get the actual name of the ec2 instance, for example:

I've been able to grab some of the lower-level data by doing stuff like:

$ curl http://169.254.169.254/1.0/meta-data/hostname

But is it possible to get the name (or tags) anywhere without using some sort of aws, ec2, or boto command?


回答1:


Tags data is not available through instance metadata, you would need aws-cli for that.

As of today, this is what's available:

$ curl http://169.254.169.254/latest/meta-data/
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
events/
hostname
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

Fun fact: this feature request was suggested almost a decade ago



来源:https://stackoverflow.com/questions/59165542/get-instance-name-via-curl-on-ec2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!