aws cli commands hang with no response

0

The cli is installed on my instance (I'm able to run aws --version and online help (e.g., aws s3 mb help)). However, when I execute any other commands the session just hangs - no error message or response of any kind. I get this same result using both a Terminal session and EC2 Instance Connect.

Thanks!

  • What output do you get if you use the debug flag? For example: aws s3 ls --debug

  • Debug output is much too long to post here and I don't see any obvious errors. I'm using Amazon internal account - is that a factor?

  • Additional testing provides this error to 'aws ec2 describe-instances --debug': Connection to ec2.us-west-1.amazonaws.com timed out.

  • If by "Amazon internal account" you mean that you're an employee of Amazon you're asking this question in the wrong forum.

ddlbc35
asked 4 months ago372 views
1 Answer
0

Hello ddlbc35,

By using internal account i guess you mean "iam user"?

You first have to authenticate. For that you need to create an access key first in the aws console for your iam user. (Keep it secret, since these are static credentials anyone who get's hands on them can do bad things).

https://repost.aws/knowledge-center/create-access-key

Afterwards run aws configure in your cli and configure your access key, secret access key and default region.

https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html

Then you should be able to run aws api calls like ec2 describe-instances.

Sincerely Heiko

profile picture
HeikoMR
answered 4 months ago
profile picture
EXPERT
reviewed 25 days ago
  • Thanks Heiko. I ran aws configure at the beginning so that's not the issue. i've also rotated access keys and updated aws configure to ensure that's not the issue but still getting the same result.

  • Hello,

    now I understand.

    You actually have an ec2-instance and installed the aws cli there, but requests time out. First of all, it is best practice for ec2 instances to use iam-roles(instance_profiles) instead of static credentials.

    https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html Although with following you don't even need to attach an iam role anymore: https://docs.aws.amazon.com/systems-manager/latest/userguide/managed-instances-default-host-management.html

    Secondly, your api requests time out. Are you able to resolve other resources in the vpc/outside of aws? Is your instance located in a private subnet? If so it could be that your instance can't reach for example the ec2-api and it would require you either a nat gateway located in a public subnet, so that you can reach the public api of ec2, or you need vpc endpoints for ec2 to reach the ec2-api via private aws network.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions