2016-05-13 77 views
0

授权安全组,进入不添加规则,创建一个AWS安全组,安全组

aws ec2 create-security-group --group-name test-sg --description "test" 

显示输出:

{ 
"GroupId": "sg-79e9441d" 
} 

增加了一个新的规则给它:

aws ec2 authorize-security-group-ingress --group-name test-sg --port 8091 --protocol tcp 

描述为:

aws ec2 describe-security-groups --group-name test-sg 

输出不显示安全组中的规则:

{ 
"SecurityGroups": [ 
    { 
     "IpPermissionsEgress": [ 
      { 
       "IpProtocol": "-1", 
       "IpRanges": [ 
        { 
         "CidrIp": "0.0.0.0/0" 
        } 
       ], 
       "UserIdGroupPairs": [], 
       "PrefixListIds": [] 
      } 
     ], 
     "Description": "test", 
     "IpPermissions": [], 
     "GroupName": "test-sg", 
     "VpcId": "vpc-c561f9a0", 
     "OwnerId": "598307997273", 
     "GroupId": "sg-79e9441d" 
    } 
] 
} 

缺少了什么?

回答

1

您错过了--cidr选项,它说明您希望接受流量的IP范围。

aws ec2 authorize-security-group-ingress --group-name test-sg --port 8091 --protocol tcp --cidr 0.0.0.0/0 

参见:authorize-security-group-ingress