简体   繁体   English

AWS EC2,命令行显示实例类型

[英]AWS EC2, command line display instance type

Do you guys know if we can display the EC2 instance type using command line?你们知道我们是否可以使用命令行显示 EC2 实例类型?

Currently, I only have access to the command line of an EC2 instance.目前,我只能访问 EC2 实例的命令行。 Is there a command line that I can type to display the type of instance.是否有我可以键入以显示实例类型的命令行。 eg, p2.8xLarge or g.16x etc.例如, p2.8xLargeg.16x等。

Yes - you can use the meta-data endpoint to retrieve information about your EC2 instance type via the command line: 是 - 您可以使用meta-data端点通过命令行检索有关EC2实例类型的信息:

> curl http://169.254.169.254/latest/meta-data/instance-type
t1.micro

See this page for more information about the available commands. 有关可用命令的更多信息,请参阅此页面。

After accessing your EC2 command line, type the following command for meta data:访问 EC2 命令行后,为元数据键入以下命令:

$ ec2-metadata

It will display many meta data of your instance它将显示您的实例的许多元数据

You can even try this to get the instance type directly by grepping your terminal output您甚至可以尝试通过 grep 终端 output 直接获取实例类型

$ec2-metadata | grep "instance-type"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM