AWS EC2元数据Invoke-RestMethod -uri http://169.254.169.254/latest/meta-data/

时间:2017-08-02 13:41:52

标签: amazon-web-services

我有Windows EC2并尝试获取元数据

Invoke-RestMethod -uri http://169.254.169.254/latest/meta-data/

Invoke-RestMethod : Unable to connect to the remote server
At line:1 char:1
+ Invoke-RestMethod -uri http://169.254.169.254/latest/meta-data/
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

如何查看EC2实例的元数据?

1 个答案:

答案 0 :(得分:0)

在EC2实例上运行InitializeInstance.ps1修复了问题