我有一个在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"]
  }
}

其他回答

添加一个新的EC2安全组入站规则:

类型:自定义ICMP规则 协议:Echo Request 端口:N / A 来源:你的选择(我会选择任何地方,以便能够从任何机器ping)

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

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"]
  }
}
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.点击“保存”

转到您的实例,编辑安全组并编辑入站规则

注意:请确保在协议中选择Echo Request而不是Echo Reply