Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services AWS检测弹性IP_Amazon Web Services_Amazon Ec2 - Fatal编程技术网

Amazon web services AWS检测弹性IP

Amazon web services AWS检测弹性IP,amazon-web-services,amazon-ec2,Amazon Web Services,Amazon Ec2,我想知道与我的ec2实例关联的弹性ip。当我通过putty远程并键入ifconfig时,它不会显示弹性ip并提供内部ip。是否有unix命令来获取弹性ip?在命令行中,为基于ubuntu的图像键入ec2metadata。在基于amazon的图像上,我使用ec2元数据您的公共ip将显示在显示的其他数据中。在命令行中,键入ec2metadata用于基于ubuntu的图像。在基于amazon的图像上,我使用了ec2元数据您的公共ip将显示在显示的其他数据中。如果您喜欢http请求,则无论操作系统如何:

我想知道与我的ec2实例关联的弹性ip。当我通过putty远程并键入ifconfig时,它不会显示弹性ip并提供内部ip。是否有unix命令来获取弹性ip?

在命令行中,为基于ubuntu的图像键入
ec2metadata
。在基于amazon的图像上,我使用
ec2元数据
您的公共ip将显示在显示的其他数据中。

在命令行中,键入
ec2metadata
用于基于ubuntu的图像。在基于amazon的图像上,我使用了
ec2元数据
您的公共ip将显示在显示的其他数据中。

如果您喜欢http请求,则无论操作系统如何:

http://169.254.169.254/latest/meta-data/public-ipv4
请随意探索
http://169.254.169.254/
树。请注意,斜杠在树中的某些节点后是必需的,尽管它在上层的答案中不可见

例如:

root@aw [~]# curl -w "\n" http://169.254.169.254/latest/
dynamic
meta-data
user-data
dynamic
末尾没有斜杠,但如果按原样尝试,则什么也看不到:

root@aw [~]# curl -w "\n" http://169.254.169.254/latest/dynamic
(empty line)
然后尝试使用斜杠:

root@aw [~]# curl -w "\n" http://169.254.169.254/latest/dynamic/
instance-identity/

当然,此“网站”仅在AWS内部工作。

如果您更喜欢http请求,则无论操作系统如何:

http://169.254.169.254/latest/meta-data/public-ipv4
请随意探索
http://169.254.169.254/
树。请注意,斜杠在树中的某些节点后是必需的,尽管它在上层的答案中不可见

例如:

root@aw [~]# curl -w "\n" http://169.254.169.254/latest/
dynamic
meta-data
user-data
dynamic
末尾没有斜杠,但如果按原样尝试,则什么也看不到:

root@aw [~]# curl -w "\n" http://169.254.169.254/latest/dynamic
(empty line)
然后尝试使用斜杠:

root@aw [~]# curl -w "\n" http://169.254.169.254/latest/dynamic/
instance-identity/
当然,这个“网站”只在AWS内部工作