authorize-security-group-ingress不向安全组添加规​​则

时间:2016-05-13 13:49:56

标签: amazon-web-services amazon

创建了一个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 个答案:

答案 0 :(得分: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