RDS

boto.rds

class boto.rds.RDSConnection(aws_access_key_id=None, aws_secret_access_key=None, is_secure=True, port=None, proxy=None, proxy_port=None, proxy_user=None, proxy_pass=None, debug=0, https_connection_factory=None, region=None, path='/', security_token=None)
APIVersion = '2011-04-01'
DefaultRegionEndpoint = 'rds.us-east-1.amazonaws.com'
DefaultRegionName = 'us-east-1'
authorize_dbsecurity_group(group_name, cidr_ip=None, ec2_security_group_name=None, ec2_security_group_owner_id=None)

Add a new rule to an existing security group. You need to pass in either src_security_group_name and src_security_group_owner_id OR a CIDR block but not both.

Parameters:
  • group_name (string) – The name of the security group you are adding the rule to.
  • ec2_security_group_name (string) – The name of the EC2 security group you are granting access to.
  • ec2_security_group_owner_id (string) – The ID of the owner of the EC2 security group you are granting access to.
  • cidr_ip (string) – The CIDR block you are providing access to. See http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
Return type:

bool

Returns:

True if successful.

create_dbinstance(id, allocated_storage, instance_class, master_username, master_password, port=3306, engine='MySQL5.1', db_name=None, param_group=None, security_groups=None, availability_zone=None, preferred_maintenance_window=None, backup_retention_period=None, preferred_backup_window=None, multi_az=False, engine_version=None, auto_minor_version_upgrade=True)

Create a new DBInstance.

Parameters:
  • id (str) – Unique identifier for the new instance. Must contain 1-63 alphanumeric characters. First character must be a letter. May not end with a hyphen or contain two consecutive hyphens
  • allocated_storage (int) – Initially allocated storage size, in GBs. Valid values are [5-1024]
  • instance_class (str) –

    The compute and memory capacity of the DBInstance. Valid values are:

    • db.m1.small
    • db.m1.large
    • db.m1.xlarge
    • db.m2.xlarge
    • db.m2.2xlarge
    • db.m2.4xlarge
  • engine (str) – Name of database engine. Must be MySQL5.1 for now.
  • master_username (str) – Name of master user for the DBInstance. Must be 1-15 alphanumeric characters, first must be a letter.
  • master_password (str) – Password of master user for the DBInstance. Must be 4-16 alphanumeric characters.
  • port (int) – Port number on which database accepts connections. Valid values [1115-65535]. Defaults to 3306.
  • db_name (str) – Name of a database to create when the DBInstance is created. Default is to create no databases.
  • param_group (str) – Name of DBParameterGroup to associate with this DBInstance. If no groups are specified no parameter groups will be used.
  • security_groups (list of str or list of DBSecurityGroup objects) – List of names of DBSecurityGroup to authorize on this DBInstance.
  • availability_zone (str) – Name of the availability zone to place DBInstance into.
  • preferred_maintenance_window (str) – The weekly time range (in UTC) during which maintenance can occur. Default is Sun:05:00-Sun:09:00
  • backup_retention_period (int) – The number of days for which automated backups are retained. Setting this to zero disables automated backups.
  • preferred_backup_window (str) – The daily time range during which automated backups are created (if enabled). Must be in h24:mi-hh24:mi format (UTC).
  • multi_az (bool) – If True, specifies the DB Instance will be deployed in multiple availability zones.
  • engine_version (str) – Version number of the database engine to use.
  • auto_minor_version_upgrade (bool) – Indicates that minor engine upgrades will be applied automatically to the Read Replica during the maintenance window. Default is True.
Return type:

boto.rds.dbinstance.DBInstance

Returns:

The new db instance.

create_dbinstance_read_replica(id, source_id, instance_class=None, port=3306, availability_zone=None, auto_minor_version_upgrade=None)

Create a new DBInstance Read Replica.

Parameters:
  • id (str) – Unique identifier for the new instance. Must contain 1-63 alphanumeric characters. First character must be a letter. May not end with a hyphen or contain two consecutive hyphens
  • source_id (str) – Unique identifier for the DB Instance for which this DB Instance will act as a Read Replica.
  • instance_class (str) –

    The compute and memory capacity of the DBInstance. Default is to inherit from the source DB Instance.

    Valid values are:

    • db.m1.small
    • db.m1.large
    • db.m1.xlarge
    • db.m2.xlarge
    • db.m2.2xlarge
    • db.m2.4xlarge
  • port (int) – Port number on which database accepts connections. Default is to inherit from source DB Instance. Valid values [1115-65535]. Defaults to 3306.
  • availability_zone (str) – Name of the availability zone to place DBInstance into.
  • auto_minor_version_upgrade (bool) – Indicates that minor engine upgrades will be applied automatically to the Read Replica during the maintenance window. Default is to inherit this value from the source DB Instance.
Return type:

boto.rds.dbinstance.DBInstance

Returns:

The new db instance.

create_dbsecurity_group(name, description=None)

Create a new security group for your account. This will create the security group within the region you are currently connected to.

Parameters:
  • name (string) – The name of the new security group
  • description (string) – The description of the new security group
Return type:

boto.rds.dbsecuritygroup.DBSecurityGroup

Returns:

The newly created DBSecurityGroup

create_dbsnapshot(snapshot_id, dbinstance_id)

Create a new DB snapshot.

Parameters:
  • snapshot_id (string) – The identifier for the DBSnapshot
  • dbinstance_id (string) – The source identifier for the RDS instance from which the snapshot is created.
Return type:

boto.rds.dbsnapshot.DBSnapshot

Returns:

The newly created DBSnapshot

create_parameter_group(name, engine='MySQL5.1', description='')

Create a new dbparameter group for your account.

Parameters:
  • name (string) – The name of the new dbparameter group
  • engine (str) – Name of database engine.
  • description (string) – The description of the new security group
Return type:

boto.rds.dbsecuritygroup.DBSecurityGroup

Returns:

The newly created DBSecurityGroup

delete_dbinstance(id, skip_final_snapshot=False, final_snapshot_id='')

Delete an existing DBInstance.

Parameters:
  • id (str) – Unique identifier for the new instance.
  • skip_final_snapshot (bool) – This parameter determines whether a final db snapshot is created before the instance is deleted. If True, no snapshot is created. If False, a snapshot is created before deleting the instance.
  • final_snapshot_id (str) – If a final snapshot is requested, this is the identifier used for that snapshot.
Return type:

boto.rds.dbinstance.DBInstance

Returns:

The deleted db instance.

delete_dbsecurity_group(name)

Delete a DBSecurityGroup from your account.

Parameters:key_name (string) – The name of the DBSecurityGroup to delete
delete_dbsnapshot(identifier)

Delete a DBSnapshot

Parameters:identifier (string) – The identifier of the DBSnapshot to delete
delete_parameter_group(name)

Delete a DBSecurityGroup from your account.

Parameters:key_name (string) – The name of the DBSecurityGroup to delete
get_all_dbinstances(instance_id=None, max_records=None, marker=None)

Retrieve all the DBInstances in your account.

Parameters:
  • instance_id (str) – DB Instance identifier. If supplied, only information this instance will be returned. Otherwise, info about all DB Instances will be returned.
  • max_records (int) – The maximum number of records to be returned. If more results are available, a MoreToken will be returned in the response that can be used to retrieve additional records. Default is 100.
  • marker (str) – The marker provided by a previous request.
Return type:

list

Returns:

A list of boto.rds.dbinstance.DBInstance

get_all_dbparameter_groups(groupname=None, max_records=None, marker=None)

Get all parameter groups associated with your account in a region.

Parameters:
  • groupname (str) – The name of the DBParameter group to retrieve. If not provided, all DBParameter groups will be returned.
  • max_records (int) – The maximum number of records to be returned. If more results are available, a MoreToken will be returned in the response that can be used to retrieve additional records. Default is 100.
  • marker (str) – The marker provided by a previous request.
Return type:

list

Returns:

A list of boto.ec2.parametergroup.ParameterGroup

get_all_dbparameters(groupname, source=None, max_records=None, marker=None)

Get all parameters associated with a ParameterGroup

Parameters:
  • groupname (str) – The name of the DBParameter group to retrieve.
  • source (str) – Specifies which parameters to return. If not specified, all parameters will be returned. Valid values are: user|system|engine-default
  • max_records (int) – The maximum number of records to be returned. If more results are available, a MoreToken will be returned in the response that can be used to retrieve additional records. Default is 100.
  • marker (str) – The marker provided by a previous request.
Return type:

boto.ec2.parametergroup.ParameterGroup

Returns:

The ParameterGroup

get_all_dbsecurity_groups(groupname=None, max_records=None, marker=None)

Get all security groups associated with your account in a region.

Parameters:
  • groupnames (list) – A list of the names of security groups to retrieve. If not provided, all security groups will be returned.
  • max_records (int) – The maximum number of records to be returned. If more results are available, a MoreToken will be returned in the response that can be used to retrieve additional records. Default is 100.
  • marker (str) – The marker provided by a previous request.
Return type:

list

Returns:

A list of boto.rds.dbsecuritygroup.DBSecurityGroup

get_all_dbsnapshots(snapshot_id=None, instance_id=None, max_records=None, marker=None)

Get information about DB Snapshots.

Parameters:
  • snapshot_id (str) – The unique identifier of an RDS snapshot. If not provided, all RDS snapshots will be returned.
  • instance_id (str) – The identifier of a DBInstance. If provided, only the DBSnapshots related to that instance will be returned. If not provided, all RDS snapshots will be returned.
  • max_records (int) – The maximum number of records to be returned. If more results are available, a MoreToken will be returned in the response that can be used to retrieve additional records. Default is 100.
  • marker (str) – The marker provided by a previous request.
Return type:

list

Returns:

A list of boto.rds.dbsnapshot.DBSnapshot

get_all_events(source_identifier=None, source_type=None, start_time=None, end_time=None, max_records=None, marker=None)

Get information about events related to your DBInstances, DBSecurityGroups and DBParameterGroups.

Parameters:
  • source_identifier (str) – If supplied, the events returned will be limited to those that apply to the identified source. The value of this parameter depends on the value of source_type. If neither parameter is specified, all events in the time span will be returned.
  • source_type (str) – Specifies how the source_identifier should be interpreted. Valid values are: b-instance | db-security-group | db-parameter-group | db-snapshot
  • start_time (datetime) – The beginning of the time interval for events. If not supplied, all available events will be returned.
  • end_time (datetime) – The ending of the time interval for events. If not supplied, all available events will be returned.
  • max_records (int) – The maximum number of records to be returned. If more results are available, a MoreToken will be returned in the response that can be used to retrieve additional records. Default is 100.
  • marker (str) – The marker provided by a previous request.
Return type:

list

Returns:

A list of class:boto.rds.event.Event

modify_dbinstance(id, param_group=None, security_groups=None, preferred_maintenance_window=None, master_password=None, allocated_storage=None, instance_class=None, backup_retention_period=None, preferred_backup_window=None, multi_az=False, apply_immediately=False)

Modify an existing DBInstance.

Parameters:
  • id (str) – Unique identifier for the new instance.
  • security_groups (list of str or list of DBSecurityGroup objects) – List of names of DBSecurityGroup to authorize on this DBInstance.
  • preferred_maintenance_window (str) – The weekly time range (in UTC) during which maintenance can occur. Default is Sun:05:00-Sun:09:00
  • master_password (str) – Password of master user for the DBInstance. Must be 4-15 alphanumeric characters.
  • allocated_storage (int) – The new allocated storage size, in GBs. Valid values are [5-1024]
  • instance_class (str) –

    The compute and memory capacity of the DBInstance. Changes will be applied at next maintenance window unless apply_immediately is True.

    Valid values are:

    • db.m1.small
    • db.m1.large
    • db.m1.xlarge
    • db.m2.xlarge
    • db.m2.2xlarge
    • db.m2.4xlarge
  • apply_immediately (bool) – If true, the modifications will be applied as soon as possible rather than waiting for the next preferred maintenance window.
  • backup_retention_period (int) – The number of days for which automated backups are retained. Setting this to zero disables automated backups.
  • preferred_backup_window (str) – The daily time range during which automated backups are created (if enabled). Must be in h24:mi-hh24:mi format (UTC).
  • multi_az (bool) – If True, specifies the DB Instance will be deployed in multiple availability zones.
Return type:

boto.rds.dbinstance.DBInstance

Returns:

The modified db instance.

modify_parameter_group(name, parameters=None)

Modify a parameter group for your account.

Parameters:
Return type:

boto.rds.parametergroup.ParameterGroup

Returns:

The newly created ParameterGroup

reboot_dbinstance(id)

Reboot DBInstance.

Parameters:id (str) – Unique identifier of the instance.
Return type:boto.rds.dbinstance.DBInstance
Returns:The rebooting db instance.
reset_parameter_group(name, reset_all_params=False, parameters=None)

Resets some or all of the parameters of a ParameterGroup to the default value

Parameters:
restore_dbinstance_from_dbsnapshot(identifier, instance_id, instance_class, port=None, availability_zone=None)

Create a new DBInstance from a DB snapshot.

Parameters:
  • identifier (string) – The identifier for the DBSnapshot
  • instance_id (string) – The source identifier for the RDS instance from which the snapshot is created.
  • instance_class (str) – The compute and memory capacity of the DBInstance. Valid values are: db.m1.small | db.m1.large | db.m1.xlarge | db.m2.2xlarge | db.m2.4xlarge
  • port (int) – Port number on which database accepts connections. Valid values [1115-65535]. Defaults to 3306.
  • availability_zone (str) – Name of the availability zone to place DBInstance into.
Return type:

boto.rds.dbinstance.DBInstance

Returns:

The newly created DBInstance

restore_dbinstance_from_point_in_time(source_instance_id, target_instance_id, use_latest=False, restore_time=None, dbinstance_class=None, port=None, availability_zone=None)

Create a new DBInstance from a point in time.

Parameters:
  • source_instance_id (string) – The identifier for the source DBInstance.
  • target_instance_id (string) – The identifier of the new DBInstance.
  • use_latest (bool) – If True, the latest snapshot availabile will be used.
  • restore_time (datetime) – The date and time to restore from. Only used if use_latest is False.
  • instance_class (str) – The compute and memory capacity of the DBInstance. Valid values are: db.m1.small | db.m1.large | db.m1.xlarge | db.m2.2xlarge | db.m2.4xlarge
  • port (int) – Port number on which database accepts connections. Valid values [1115-65535]. Defaults to 3306.
  • availability_zone (str) – Name of the availability zone to place DBInstance into.
Return type:

boto.rds.dbinstance.DBInstance

Returns:

The newly created DBInstance

revoke_dbsecurity_group(group_name, ec2_security_group_name=None, ec2_security_group_owner_id=None, cidr_ip=None)

Remove an existing rule from an existing security group. You need to pass in either ec2_security_group_name and ec2_security_group_owner_id OR a CIDR block.

Parameters:
  • group_name (string) – The name of the security group you are removing the rule from.
  • ec2_security_group_name (string) – The name of the EC2 security group from which you are removing access.
  • ec2_security_group_owner_id (string) – The ID of the owner of the EC2 security from which you are removing access.
  • cidr_ip (string) – The CIDR block from which you are removing access. See http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
Return type:

bool

Returns:

True if successful.

revoke_security_group(group_name, ec2_security_group_name=None, ec2_security_group_owner_id=None, cidr_ip=None)

Remove an existing rule from an existing security group. You need to pass in either ec2_security_group_name and ec2_security_group_owner_id OR a CIDR block.

Parameters:
  • group_name (string) – The name of the security group you are removing the rule from.
  • ec2_security_group_name (string) – The name of the EC2 security group from which you are removing access.
  • ec2_security_group_owner_id (string) – The ID of the owner of the EC2 security from which you are removing access.
  • cidr_ip (string) – The CIDR block from which you are removing access. See http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
Return type:

bool

Returns:

True if successful.

boto.rds.connect_to_region(region_name, **kw_params)

Given a valid region name, return a boto.ec2.connection.EC2Connection. Any additional parameters after the region_name are passed on to the connect method of the region object.

Type:str
Parameters:region_name – The name of the region to connect to.
Return type:boto.ec2.connection.EC2Connection or None
Returns:A connection to the given region, or None if an invalid region name is given
boto.rds.regions()

Get all available regions for the RDS service.

Return type:list
Returns:A list of boto.rds.regioninfo.RDSRegionInfo

boto.rds.dbinstance

class boto.rds.dbinstance.DBInstance(connection=None, id=None)

Represents a RDS DBInstance

endElement(name, value, connection)
modify(param_group=None, security_groups=None, preferred_maintenance_window=None, master_password=None, allocated_storage=None, instance_class=None, backup_retention_period=None, preferred_backup_window=None, multi_az=False, apply_immediately=False)

Modify this DBInstance.

Parameters:
  • security_groups (list of str or list of DBSecurityGroup objects) – List of names of DBSecurityGroup to authorize on this DBInstance.
  • preferred_maintenance_window (str) – The weekly time range (in UTC) during which maintenance can occur. Default is Sun:05:00-Sun:09:00
  • master_password (str) – Password of master user for the DBInstance. Must be 4-15 alphanumeric characters.
  • allocated_storage (int) – The new allocated storage size, in GBs. Valid values are [5-1024]
  • instance_class (str) –

    The compute and memory capacity of the DBInstance. Changes will be applied at next maintenance window unless apply_immediately is True.

    Valid values are:

    • db.m1.small
    • db.m1.large
    • db.m1.xlarge
    • db.m2.xlarge
    • db.m2.2xlarge
    • db.m2.4xlarge
  • apply_immediately (bool) – If true, the modifications will be applied as soon as possible rather than waiting for the next preferred maintenance window.
  • backup_retention_period (int) – The number of days for which automated backups are retained. Setting this to zero disables automated backups.
  • preferred_backup_window (str) – The daily time range during which automated backups are created (if enabled). Must be in h24:mi-hh24:mi format (UTC).
  • multi_az (bool) – If True, specifies the DB Instance will be deployed in multiple availability zones.
Return type:

boto.rds.dbinstance.DBInstance

Returns:

The modified db instance.

reboot()

Reboot this DBInstance

Return type:boto.rds.dbsnapshot.DBSnapshot
Returns:The newly created DBSnapshot
snapshot(snapshot_id)

Create a new DB snapshot of this DBInstance.

Parameters:identifier (string) – The identifier for the DBSnapshot
Return type:boto.rds.dbsnapshot.DBSnapshot
Returns:The newly created DBSnapshot
startElement(name, attrs, connection)
stop(skip_final_snapshot=False, final_snapshot_id='')

Delete this DBInstance.

Parameters:
  • skip_final_snapshot (bool) – This parameter determines whether a final db snapshot is created before the instance is deleted. If True, no snapshot is created. If False, a snapshot is created before deleting the instance.
  • final_snapshot_id (str) – If a final snapshot is requested, this is the identifier used for that snapshot.
Return type:

boto.rds.dbinstance.DBInstance

Returns:

The deleted db instance.

update(validate=False)

Update the DB instance’s status information by making a call to fetch the current instance attributes from the service.

Parameters:validate (bool) – By default, if EC2 returns no data about the instance the update method returns quietly. If the validate param is True, however, it will raise a ValueError exception if no data is returned from EC2.
class boto.rds.dbinstance.PendingModifiedValues
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.rds.dbsecuritygroup

Represents an DBSecurityGroup

class boto.rds.dbsecuritygroup.DBSecurityGroup(connection=None, owner_id=None, name=None, description=None)
authorize(cidr_ip=None, ec2_group=None)

Add a new rule to this DBSecurity group. You need to pass in either a CIDR block to authorize or and EC2 SecurityGroup.

@type cidr_ip: string @param cidr_ip: A valid CIDR IP range to authorize

@type ec2_group: boto.ec2.securitygroup.SecurityGroup>

@rtype: bool @return: True if successful.

delete()
endElement(name, value, connection)
revoke(cidr_ip=None, ec2_group=None)

Revoke access to a CIDR range or EC2 SecurityGroup. You need to pass in either a CIDR block or an EC2 SecurityGroup from which to revoke access.

@type cidr_ip: string @param cidr_ip: A valid CIDR IP range to revoke

@type ec2_group: boto.ec2.securitygroup.SecurityGroup>

@rtype: bool @return: True if successful.

startElement(name, attrs, connection)
class boto.rds.dbsecuritygroup.EC2SecurityGroup(parent=None)
endElement(name, value, connection)
startElement(name, attrs, connection)
class boto.rds.dbsecuritygroup.IPRange(parent=None)
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.rds.dbsnapshot

class boto.rds.dbsnapshot.DBSnapshot(connection=None, id=None)

Represents a RDS DB Snapshot

endElement(name, value, connection)
startElement(name, attrs, connection)

boto.rds.event

class boto.rds.event.Event(connection=None)
endElement(name, value, connection)
startElement(name, attrs, connection)

boto.rds.parametergroup

class boto.rds.parametergroup.Parameter(group=None, name=None)

Represents a RDS Parameter

ValidApplyMethods = ['immediate', 'pending-reboot']
ValidApplyTypes = ['static', 'dynamic']
ValidSources = ['user', 'system', 'engine-default']
ValidTypes = {'integer': <type 'int'>, 'boolean': <type 'bool'>, 'string': <type 'str'>}
apply(immediate=False)
endElement(name, value, connection)
get_value()
merge(d, i)
set_value(value)
startElement(name, attrs, connection)
value
class boto.rds.parametergroup.ParameterGroup(connection=None)
add_param(name, value, apply_method)
endElement(name, value, connection)
get_params()
modifiable()
startElement(name, attrs, connection)