authorize_db_security_group_ingress ( $db_security_group_name, $opt )

Enables ingress to a DBSecurityGroup using one of two forms of authorization. First, EC2 or VPC Security Groups can be added to the DBSecurityGroup if the application using the database is running on EC2 or VPC instances. Second, IP ranges are available if the application accessing your database is running on the Internet. Required parameters for this API are one of CIDR range, EC2SecurityGroupId for VPC, or (EC2SecurityGroupOwnerId and either EC2SecurityGroupName or EC2SecurityGroupId for non-VPC).

You cannot authorize ingress from an EC2 security group in one Region to an Amazon RDS DB Instance in another. You cannot authorize ingress from a VPC security group in one VPC to an Amazon RDS DB Instance in another.

For an overview of CIDR ranges, go to the Wikipedia Tutorial.

Access

public

Parameters

Parameter

Type

Required

Description

$db_security_group_name

string

Required

The name of the DB Security Group to add authorization to.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • CIDRIP - string - Optional - The IP range to authorize.
  • EC2SecurityGroupName - string - Optional - Name of the EC2 Security Group to authorize. For VPC DB Security Groups, EC2SecurityGroupId must be provided. Otherwise, EC2SecurityGroupOwnerId and either EC2SecurityGroupName or EC2SecurityGroupId must be provided.
  • EC2SecurityGroupId - string - Optional - Id of the EC2 Security Group to authorize. For VPC DB Security Groups, EC2SecurityGroupId must be provided. Otherwise, EC2SecurityGroupOwnerId and either EC2SecurityGroupName or EC2SecurityGroupId must be provided.
  • EC2SecurityGroupOwnerId - string - Optional - AWS Account Number of the owner of the EC2 Security Group specified in the EC2SecurityGroupName parameter. The AWS Access Key ID is not an acceptable value. For VPC DB Security Groups, EC2SecurityGroupId must be provided. Otherwise, EC2SecurityGroupOwnerId and either EC2SecurityGroupName or EC2SecurityGroupId must be provided.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Authorize database security group access for a given security group.

// Instantiate the class
$rds = new AmazonRDS();

$response = $rds->authorize_db_security_group_ingress('mySecurityGroup', array(
	'EC2SecurityGroupName' => 'default',
	'EC2SecurityGroupOwnerId' => CFCredentials::get('@default')->account_id
));

// Success?
var_dump($response->isOK());
Result:
bool(true)

Authorize database security group access for a CIDR IP Range.

// Instantiate the class
$rds = new AmazonRDS();

$response = $rds->authorize_db_security_group_ingress('mySecurityGroup', array(
	'CIDRIP' => '0.0.0.0/0'
));

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/rds.class.php | Toggle source view (7 lines) | View on GitHub

public function authorize_db_security_group_ingress($db_security_group_name, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['DBSecurityGroupName'] = $db_security_group_name;
    
    return $this->authenticate('AuthorizeDBSecurityGroupIngress', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback