/**
 * Create Security Group Action Sample
 * The CreateSecurityGroup operation creates a new security group.
 * Every instance is launched in a security group. If no security group is
 * specified during launch, the instances are launched in the default security
 * group. Instances within the same security group have unrestricted network
 * access to each other. Instances will reject network access attempts from other
 * instances in a different security group. As the owner of instances you can
 * grant or revoke specific permissions using the AuthorizeSecurityGroupIngress
 * and RevokeSecurityGroupIngress operations.  
 * @param Amazon_EC2_Interface $service instance of Amazon_EC2_Interface
 * @param mixed $request Amazon_EC2_Model_CreateSecurityGroup or array of parameters
 */
function invokeCreateSecurityGroup(Amazon_EC2_Interface $service, $request)
{
    try {
        $response = $service->createSecurityGroup($request);
        echo "Service Response\n";
        echo "=============================================================================\n";
        echo "        CreateSecurityGroupResponse\n";
        if ($response->isSetResponseMetadata()) {
            echo "            ResponseMetadata\n";
            $responseMetadata = $response->getResponseMetadata();
            if ($responseMetadata->isSetRequestId()) {
                echo "                RequestId\n";
                echo "                    " . $responseMetadata->getRequestId() . "\n";
            }
        }
    } catch (Amazon_EC2_Exception $ex) {
        echo "Caught Exception: " . $ex->getMessage() . "\n";
        echo "Response Status Code: " . $ex->getStatusCode() . "\n";
        echo "Error Code: " . $ex->getErrorCode() . "\n";
        echo "Error Type: " . $ex->getErrorType() . "\n";
        echo "Request ID: " . $ex->getRequestId() . "\n";
        echo "XML: " . $ex->getXML() . "\n";
    }
}