22

I've started an EC2 instance and installed the ec2-api-tools. Environment variables (JAVA_HOME, EC2_PRIVATE_KEY, EC2_CERT) are set up.

Running ec2-describe-instances doesn't return anything. According to the EC2 command line reference information on all currently running (and terminated) instances should be returned. What's going wrong?

In general ec2-describe-images -o self -o amazon works, so the EC2 tools are working. Adding explicitly -K and -C parameters to ec2-describe-instances doesn't change the situation.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Jimbo
  • 271
  • 1
  • 3
  • 4
  • 5
    Solution: The `EC2_URL` must be set up to use other regions than us-east-1, e.g. `export EC2_URL=https://ec2.eu-west-1.amazonaws.com`. Because of the wrong region, nothing was displayed. – Jimbo Nov 18 '10 at 16:17
  • I could not understand what was the problem here. Could someone elaborate please? How to solve the problem? What are the steps? Is this a command - `export EC2_URL=https://ec2.eu-west-1.amazonaws.com`? – Sandeepan Nath May 20 '16 at 11:16
  • Adding the relevant section from the docs http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/set-up-ec2-cli-linux.html#set_ec2_url_linux. It says "If you've already launched an instance using the console and wish to work with the instance using the CLI, you must specify the endpoint URL for the instance's region. You can verify the region for the instance by checking the region selector in the console navigation bar." Where is the region selector in the console navigation bar? – Sandeepan Nath May 20 '16 at 12:06
  • I got the region from the console navigation bar by following this http://docs.aws.amazon.com/awsconsolehelpdocs/latest/gsg/getting-started.html#select-region. Then found the equivalent region name string "us-west-2" and its URL from a link. Then I added this to the `.bashrc` file - `export EC2_URL=https://elasticache.us-west-2.amazonaws.com`. – Sandeepan Nath May 20 '16 at 13:11

2 Answers2

11

A little more detail:

You don't need to set the EC2_URL directly. You can use the more friendly command-line option:

--region eu-west-1 (substituting the name of the region you want to address).

This way you don't need to look up the region's URL endpoint.

Here are the EC2 Command Line API Tools general options where this is explained.

Shlomo Swidler
  • 1,105
  • 9
  • 12
0

if all your instances are in eu-west-1, configure your aws cli to use this region by default.

just type : aws configure

and you ll be prompted to enter your credential, then you can rewrite the region

Toumi
  • 2,925
  • 4
  • 37
  • 31