Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > RightScale API 1.5 > Examples > Security Groups > Show Security Group Rules

Show Security Group Rules

Show the security group rules for a single, specific security group.

Table of Contents

Curl

Prerequisite:  Example assumes you have previously authenticated, and your valid session cookie is in 'mycookie'.

Example Call

#!/bin/sh -e
CLOUD="2112"
SG="4ISBSPCJCG3CS"        # Reminder, must obtain the Security Group ID via the API, not the Dashboard
curl -i -H X_API_VERSION:1.5 -b mycookie -X GET \
https://my.rightscale.com/api/clouds/$CLOUD/security_groups/$SG/security_group_rules.xml

Sample Output

Note:  Headers not shown.

XML output below reveals:

  • Port 80 and 22 opened up for CIDR IP's (based on Security Group Rules created by source_type = icdr_ips)
  • Port 80 opened up for the group (based on Security Group Rules created by source_type = group)
<?xml version="1.0" encoding="UTF-8"?>
<security_group_rules>
  <security_group_rule>
    <group_owner>test</group_owner>
    <group_name>GD SG for API Sandbox</group_name>
    <protocol>tcp</protocol>
    <start_port>80</start_port>
    <actions></actions>
    <end_port>80</end_port>
    <links>
      <link href="/api/security_group_rules/358914001" rel="self"/>
      <link href="/api/clouds/2112/security_groups/4ISBSPCJCG3CS" rel="security_group"/>
    </links>
  </security_group_rule>
  <security_group_rule>
    <protocol>tcp</protocol>
    <start_port>22</start_port>
    <cidr_ips>0.0.0.0/0</cidr_ips>
    <actions></actions>
    <end_port>22</end_port>
    <links>
      <link href="/api/security_group_rules/358925001" rel="self"/>
      <link href="/api/clouds/2112/security_groups/4ISBSPCJCG3CS" rel="security_group"/>
    </links>
  </security_group_rule>
  <security_group_rule>
    <protocol>tcp</protocol>
    <start_port>80</start_port>
    <cidr_ips>0.0.0.0/0</cidr_ips>
    <actions></actions>
    <end_port>80</end_port>
    <links>
      <link href="/api/security_group_rules/358926001" rel="self"/>
      <link href="/api/clouds/2112/security_groups/4ISBSPCJCG3CS" rel="security_group"/>
    </links>
  </security_group_rule>
</security_group_rules>
You must to post a comment.
Last modified
23:18, 16 May 2013

Tags

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.