Amazon Linux AMI - 我的 EC2 实例可以 yum 但不能 curl 或 ping

Amazon Linux AMI - My EC2 instance can yum but cannot curl or ping

我正在编写 ansible 剧本并使用 cloudformation 模块启动 EC2 实例 (Amazon Linux AMI)。 然后我可以 ssh 到那个实例,从那个实例我可以用 yum 安装但不能 curl 或 ping。

例如:$ curl -sS https://getcomposer.org/installer | php curl: (7) Failed to connect to getcomposer.org port 443: Connection timed out

有没有人可以帮忙? 谢谢

我无法重现您的问题。这是我所做的:

  • 使用默认的 Amazon Linux AMI
  • 启动了一个新的 t2.nano 实例
  • 已通过 SSH 连接
  • sudo yum install php
  • curl -sS https://getcomposer.org/installer | php

结果:

Composer (version 1.4.2) successfully installed to: /home/ec2-user/composer.phar
Use it: php composer.phar

您可能错过了路线 table 中的路线细节。请提供必要的路线配置以获得进一步的帮助。