Joel
Joel

Reputation: 95

aws ec2 get-console-output prints nothing to the screen

I am creating an aws ec2 instance using this tutorial, and I can't find any information on troubleshooting my issue, or any evidence that anyone else has even experienced this!

I used an IAM user with admin permissions to set up an ec2 instance, and when I run

$> aws ec2 get-console-output --instance-id <my-ec2-id>

a blank line is output, followed by

'Output' 

and nothing else!

According to the tutorial, this command would enable me to see the remote RSA fingerprint to verify I'm making the right connection.

I can log into my ec2 instance just fine (though I suppose without the previous step there's no way to be absolutely sure).

Additionally, the IAM user I'm working with is not my CLI's default user, and I set up a profile to handle it. But if I try

$> aws ec2 get-console-output --profile <user-profile> --instance-id <my-ec2-id>

I still get the same results as before. The maddening thing is that I have solved this problem before, but I can't remember how.

Upvotes: 0

Views: 3207

Answers (1)

alexjs
alexjs

Reputation: 573

Certain AWS CLI operations may not explicitly state if the credentials are invalid or if users are lacking the roles/permissions to access the resources defined. In this case, it is likely due to the Access Credentials being invalid - and you can verify this with a describe-instances or similar command.

In older versions of the CLI (~1.7), in order to easier debug this, you can use the --debug argument, such as:

> aws ec2 get-console-output --instance-id i-<id> --debug

<Errors><Error><Code>InvalidInstanceID.NotFound</Code><Message>The instance ID 'i-e7bffa43' does not exist</Message></Error></Errors>

In newer versions of the CLI (1.9) this particular argument gives a bit more detail in its error:

> aws ec2 get-console-output --instance-id i-<id>

A client error (InvalidInstanceID.NotFound) occurred when calling the GetConsoleOutput operation: The instance ID 'i-<id>' does not exist

Upvotes: 2

Related Questions