Do you guys know if we can display the EC2 instance type using command line?
Currently, I only have access to the command line of an EC2 instance. Is there a command line that I can type to display the type of instance. eg, p2.8xLarge
or g.16x
etc.
Yes - you can use the meta-data
endpoint to retrieve information about your EC2 instance type via the command line:
> 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-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
$ec2-metadata | grep "instance-type"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.