我有一个在AWS中运行的EC2实例。当我试图从我的本地盒子ping它是不可用的。

我如何能使实例pingable?


当前回答

terrraform安全组的特定指令,因为-1对我来说不明显。

resource "aws_security_group" "Ping" {
  vpc_id = "${aws_vpc.MyVPC.id}"
  ingress {
    from_port   = -1
    to_port     = -1
    protocol    = "icmp"
    cidr_blocks = ["0.0.0.0/0"]
    ipv6_cidr_blocks = ["::/0"]
  }
}

其他回答

terrraform安全组的特定指令,因为-1对我来说不明显。

resource "aws_security_group" "Ping" {
  vpc_id = "${aws_vpc.MyVPC.id}"
  ingress {
    from_port   = -1
    to_port     = -1
    protocol    = "icmp"
    cidr_blocks = ["0.0.0.0/0"]
    ipv6_cidr_blocks = ["::/0"]
  }
}

我想提到一些ISP引起的罕见问题。我偶尔也会用BSNL。这是一个奇怪的问题,它占用了你日常生活中的几个小时。在这种情况下,人们可能会提出与ISP或更换ISP的问题。

Amazon实例可以从浏览器访问(所有开放端口) 控制台无法ping通 SSH / Telnet也不能正常使用。

安全组使您能够控制到实例的流量,包括可以到达实例的流量类型。

1. Check the Security Groups (Enabled the PORTS to be OPEN)
2. Check the correct VPC 
3. Attached the correct Subnet 
4. AWS EC2 to be in Public Subnet 
5. Enable Internet Gateway 

打开AWS EC2中的端口,检查此链接正式的AWS链接

当访问ec2实例中的新端口时。你要在两个地方相加。 1. 安全组入端口。 2. 防火墙设置入站规则。

1.Go to EC2 Dashboard and click "Running Instances" on "Security Groups"
2.select the group of your instance which you need to add security.  
3.click on the "Inbound" tab
4.Click "Edit" Button (It will open an popup window)
5.click "Add Rule"
6.Select the "Custom ICMP rule - IPv4" as Type
7.Enter the "0.0.0.0/0" as Source or your public IP

7.点击“保存”