Difference between revisions of "Aws ec2 describe-security-groups"

From wikieduonline
Jump to navigation Jump to search
Line 6: Line 6:
 
  [[aws ec2]] describe-security-groups  | egrep "[[GroupId]]|[[Description]]"
 
  [[aws ec2]] describe-security-groups  | egrep "[[GroupId]]|[[Description]]"
 
  aws ec2 describe-security-groups --group-ids sg-0cc21460XXXXX
 
  aws ec2 describe-security-groups --group-ids sg-0cc21460XXXXX
 +
 +
== Official example ==
 +
aws ec2 describe-security-groups --group-ids sg-903004f8
 +
<pre>
 +
{
 +
    "SecurityGroups": [
 +
        {
 +
            "IpPermissionsEgress": [
 +
                {
 +
                    "IpProtocol": "-1",
 +
                    "IpRanges": [
 +
                        {
 +
                            "CidrIp": "0.0.0.0/0"
 +
                        }
 +
                    ],
 +
                    "UserIdGroupPairs": [],
 +
                    "PrefixListIds": []
 +
                }
 +
            ],
 +
            "Description": "My security group",
 +
            "Tags": [
 +
                {
 +
                    "Value": "SG1",
 +
                    "Key": "Name"
 +
                }
 +
            ],
 +
            "IpPermissions": [
 +
                {
 +
                    "IpProtocol": "-1",
 +
                    "IpRanges": [],
 +
                    "UserIdGroupPairs": [
 +
                        {
 +
                            "UserId": "123456789012",
 +
                            "GroupId": "sg-903004f8"
 +
                        }
 +
                    ],
 +
                    "PrefixListIds": []
 +
                },
 +
                {
 +
                    "PrefixListIds": [],
 +
                    "FromPort": 22,
 +
                    "IpRanges": [
 +
                        {
 +
                            "Description": "Access from NY office",
 +
                            "CidrIp": "203.0.113.0/24"
 +
                        }
 +
                    ],
 +
                    "ToPort": 22,
 +
                    "IpProtocol": "tcp",
 +
                    "UserIdGroupPairs": []
 +
                    }
 +
            ],
 +
            "GroupName": "MySecurityGroup",
 +
            "VpcId": "vpc-1a2b3c4d",
 +
            "OwnerId": "123456789012",
 +
            "GroupId": "sg-903004f8",
 +
        }
 +
    ]
 +
}
 +
</pre>
  
  

Revision as of 16:00, 22 June 2022


aws ec2 describe-security-groups  | grep Description
aws ec2 describe-security-groups  | egrep "GroupId|Description"
aws ec2 describe-security-groups --group-ids sg-0cc21460XXXXX

Official example

aws ec2 describe-security-groups --group-ids sg-903004f8
{
    "SecurityGroups": [
        {
            "IpPermissionsEgress": [
                {
                    "IpProtocol": "-1",
                    "IpRanges": [
                        {
                            "CidrIp": "0.0.0.0/0"
                        }
                    ],
                    "UserIdGroupPairs": [],
                    "PrefixListIds": []
                }
            ],
            "Description": "My security group",
            "Tags": [
                {
                    "Value": "SG1",
                    "Key": "Name"
                }
            ],
            "IpPermissions": [
                {
                    "IpProtocol": "-1",
                    "IpRanges": [],
                    "UserIdGroupPairs": [
                        {
                            "UserId": "123456789012",
                            "GroupId": "sg-903004f8"
                        }
                    ],
                    "PrefixListIds": []
                },
                {
                    "PrefixListIds": [],
                    "FromPort": 22,
                    "IpRanges": [
                        {
                            "Description": "Access from NY office",
                            "CidrIp": "203.0.113.0/24"
                        }
                    ],
                    "ToPort": 22,
                    "IpProtocol": "tcp",
                    "UserIdGroupPairs": []
                    }
            ],
            "GroupName": "MySecurityGroup",
            "VpcId": "vpc-1a2b3c4d",
            "OwnerId": "123456789012",
            "GroupId": "sg-903004f8",
        }
    ]
}


Related

See also

Advertising: