0

I have a AWS instance on which I perform a ssh login and operate.Os is Ubuntu 16.04.3. I didn’t select it’s AMI and neither do I have the access to its AWS console.

I wanted to know that what instance is it like, is it t2.small or m3.large?

I did found a command lscpu which tells me that it has 1 CPU and 1 Core per socket,

And on running free -m I can see that it has 2GB of available memory.

Based on these things I am making a guess that it is a t2.small instance. Is there a way to be sure about it that what instance is it?

When I use the describe-intances command i get the following output:

aws ec2 describe-instances
You must specify a region. You can also configure your region by running "aws configure".

And I am not aware of the region of my instance as well.

Also I needed an EBS Provisioned IOPS SSD or SSD instance store volumes specifically. But if it is a t2.micro instance then according to the table shown by was while selecting instances, it is EBS only.

So how can I find that whether the instance I am using contains a EBS IOPS SSD or SSD instance store volumes or not?

  • Have you configured `aws cli` ? first you need to install and configure `aws cli` https://docs.aws.amazon.com/cli/latest/userguide/installing.html – sanjayparmar Sep 14 '18 at 11:04
  • I didn't used pip, instead I used sudo apt intall. And when I am running `aws version` command I get a output as described in the link, like this `aws-cli/1.11.84 Python/3.6.2 Linux/4.4.0-59-generic botocore/1.5.47` – abhishek ranjan Sep 14 '18 at 11:10
  • now run command `$ aws configure` and provide details `AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY Default region name [None]: us-west-2 Default output format [None]: json` – sanjayparmar Sep 14 '18 at 11:14
  • if you already login into instance you can get metadata `curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/\(.*\)[a-z]/\1/'` – sanjayparmar Sep 14 '18 at 11:16
  • Metadata will give you full details of instance `curl http://169.254.169.254/latest/meta-data` for more info. - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html – sanjayparmar Sep 14 '18 at 11:17
  • or if you configured `aws cli` then run `aws configure get region` to get region information – sanjayparmar Sep 14 '18 at 11:26
  • to use `aws configure` I need to have the IAM user permissions (according to the docs which you sent me) i guess, but i do not have the access to aws console for that. Also when I use curl command the terminal stops indefinetly and does not returns anything. – abhishek ranjan Sep 14 '18 at 11:41
  • Yes, to configure `AWS cli`. need credentials. you can ask to your admin. or `curl` command should work. try only `curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone` – sanjayparmar Sep 14 '18 at 11:45
  • as per your requirements you can use. refer - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html – sanjayparmar Sep 14 '18 at 11:46

1 Answers1

1

Step 1. Determine your EC2 instance ID:

curl http://169.254.169.254/latest/meta-data/instance-id

Step 2: Figure out your region

curl http://169.254.169.254/latest/dynamic/instance-identity/document

Step 3: Using the AWS CLI describe your instance. A lot of this information is also available thru the metadata referenced in Step 1.

aws ec2 --region region_from_step_2 describe-instances --instance-ids instance_id_from_step_1

The output will be nicely formatted json with a wealth of information about your EC2 instance.

Almost all of this information is available from metadata. This is organized much like a file system directory.

curl http://169.254.169.254/latest/meta-data

John Hanley
  • 4,754
  • 1
  • 11
  • 21