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
질문됨 5달 전425회 조회
1개 답변
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
답변함 5달 전
profile picture
전문가
검토됨 한 달 전
  • 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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠