Class: AWS::RDS::DBInstance

Inherits:
Core::Resource
  • Object
show all
Defined in:
lib/aws/rds/db_instance.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db_instance_id, options = {}) ⇒ DBInstance

Returns a new instance of DBInstance.

Parameters:

  • db_instance_id (String)
  • options (Hash) (defaults to: {})


66
67
68
69
# File 'lib/aws/rds/db_instance.rb', line 66

def initialize db_instance_id, options = {}
  @db_instance_identifier = db_instance_id
  super
end

Instance Attribute Details

#allocated_storageInteger (readonly)

Returns the current value of allocated_storage.

Returns:

  • (Integer)

    the current value of allocated_storage



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def allocated_storage
  @allocated_storage
end

#auto_minor_version_upgradeBoolean (readonly)

Returns the current value of auto_minor_version_upgrade.

Returns:

  • (Boolean)

    the current value of auto_minor_version_upgrade



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def auto_minor_version_upgrade
  @auto_minor_version_upgrade
end

#availability_zone_nameString (readonly)

Returns the current value of availability_zone_name.

Returns:

  • (String)

    the current value of availability_zone_name



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def availability_zone_name
  @availability_zone_name
end

#backup_retention_periodInteger (readonly)

Returns the current value of backup_retention_period.

Returns:

  • (Integer)

    the current value of backup_retention_period



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def backup_retention_period
  @backup_retention_period
end

#character_set_nameString (readonly)

Returns the current value of character_set_name.

Returns:

  • (String)

    the current value of character_set_name



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def character_set_name
  @character_set_name
end

#creation_date_timeTime (readonly)

Returns the current value of creation_date_time.

Returns:

  • (Time)

    the current value of creation_date_time



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def creation_date_time
  @creation_date_time
end

#db_instance_classString (readonly)

Returns the current value of db_instance_class.

Returns:

  • (String)

    the current value of db_instance_class



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def db_instance_class
  @db_instance_class
end

#db_instance_identifierString (readonly) Also known as: id, db_instance_id

Returns:

  • (String)


72
73
74
# File 'lib/aws/rds/db_instance.rb', line 72

def db_instance_identifier
  @db_instance_identifier
end

#db_instance_statusString (readonly)

Returns the current value of db_instance_status.

Returns:

  • (String)

    the current value of db_instance_status



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def db_instance_status
  @db_instance_status
end

#db_nameString (readonly)

Returns the current value of db_name.

Returns:

  • (String)

    the current value of db_name



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def db_name
  @db_name
end

#endpoint_addressString (readonly)

Returns the current value of endpoint_address.

Returns:

  • (String)

    the current value of endpoint_address



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def endpoint_address
  @endpoint_address
end

#endpoint_portInteger (readonly)

Returns the current value of endpoint_port.

Returns:

  • (Integer)

    the current value of endpoint_port



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def endpoint_port
  @endpoint_port
end

#engineString (readonly)

Returns the current value of engine.

Returns:

  • (String)

    the current value of engine



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def engine
  @engine
end

#engine_versionString (readonly)

Returns the current value of engine_version.

Returns:

  • (String)

    the current value of engine_version



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def engine_version
  @engine_version
end

#iopsInteger (readonly)

Returns the current value of iops.

Returns:

  • (Integer)

    the current value of iops



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def iops
  @iops
end

#latest_restorable_timeTime (readonly)

Returns the current value of latest_restorable_time.

Returns:

  • (Time)

    the current value of latest_restorable_time



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def latest_restorable_time
  @latest_restorable_time
end

#license_modelString (readonly)

Returns the current value of license_model.

Returns:

  • (String)

    the current value of license_model



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def license_model
  @license_model
end

#master_usernameString (readonly)

Returns the current value of master_username.

Returns:

  • (String)

    the current value of master_username



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def master_username
  @master_username
end

#multi_azBoolean (readonly)

Returns the current value of multi_az.

Returns:

  • (Boolean)

    the current value of multi_az



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def multi_az
  @multi_az
end

#preferred_backup_windowString (readonly)

Returns the current value of preferred_backup_window.

Returns:

  • (String)

    the current value of preferred_backup_window



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def preferred_backup_window
  @preferred_backup_window
end

#preferred_maintenance_windowString (readonly)

Returns the current value of preferred_maintenance_window.

Returns:

  • (String)

    the current value of preferred_maintenance_window



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def preferred_maintenance_window
  @preferred_maintenance_window
end

#read_replica_db_instance_identifiersArray<String> (readonly)

Returns the current value of read_replica_db_instance_identifiers.

Returns:

  • (Array<String>)

    the current value of read_replica_db_instance_identifiers



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def read_replica_db_instance_identifiers
  @read_replica_db_instance_identifiers
end

#read_replica_source_db_instance_identifierString (readonly)

Returns the current value of read_replica_source_db_instance_identifier.

Returns:

  • (String)

    the current value of read_replica_source_db_instance_identifier



62
63
64
# File 'lib/aws/rds/db_instance.rb', line 62

def read_replica_source_db_instance_identifier
  @read_replica_source_db_instance_identifier
end

Instance Method Details

#create_snapshot(db_snapshot_id) ⇒ DBSnapshot

Returns:



153
154
155
156
157
158
159
160
161
162
163
# File 'lib/aws/rds/db_instance.rb', line 153

def create_snapshot db_snapshot_id

  options = {}
  options[:db_snapshot_identifier] = db_snapshot_id
  options[:db_instance_identifier] = db_instance_identifier
  resp = client.create_db_snapshot(options)

  DBSnapshot.new_from(:create_db_snapshot, resp,
    resp[:db_snapshot_identifier], :config => config)

end

#delete(options = {}) ⇒ nil

Terminates (deletes) this database instance.

Returns:

  • (nil)


178
179
180
181
# File 'lib/aws/rds/db_instance.rb', line 178

def delete options = {}
  client.delete_db_instance(options.merge(:db_instance_identifier => id))
  nil
end

#exists?Boolean

Returns true if the db instance exists.

Returns:

  • (Boolean)

    Returns true if the db instance exists.



184
185
186
187
188
189
190
191
# File 'lib/aws/rds/db_instance.rb', line 184

def exists?
  begin
    get_resource
    true
  rescue AWS::RDS::Errors::DBInstanceNotFound
    false
  end
end

#modify(options = {}) ⇒ Object

Note:

You do not need to set :db_instance_identifier.

Modifies the database instance.

Parameters:

  • options (Hash) (defaults to: {})
    • :db_instance_identifier - required - (String) The DB Instance identifier. This value is stored as a lowercase string.

    • :allocated_storage - (Integer) The new storage capacity of the RDS instance. This change does not result in an outage and is applied during the next maintenance window unless the ApplyImmediately parameter is specified as true for this request.

    • :db_instance_class - (String) The new compute and memory capacity of the DB Instance. Passing a value for this parameter causes an outage during the change and is applied during the next maintenance window, unless the ApplyImmediately parameter is specified as true for this request.

    • :db_security_groups - (Array<String>) A list of DB Security Groups to authorize on this DB Instance. This change is asynchronously applied as soon as possible.

    • :apply_immediately - (Boolean) Specifies whether or not the modifications in this request and any pending modifications are asynchronously applied as soon as possible, regardless of the PreferredMaintenanceWindow setting for the DB Instance. If this parameter is passed as false , changes to the DB Instance are applied on the next call to RebootDBInstance, the next maintenance reboot, or the next failure reboot, whichever occurs first.

    • :master_user_password - (String) The new password for the DB Instance master user. This change is asynchronously applied as soon as possible. Between the time of the request and the completion of the request, the MasterUserPassword element exists in the PendingModifiedValues element of the operation response.

    • :db_parameter_group_name - (String) The name of the DB Parameter Group to apply to this DB Instance. This change is asynchronously applied as soon as possible for parameters when the ApplyImmediately parameter is specified as true for this request.

    • :backup_retention_period - (Integer) The number of days to retain automated backups. Setting this parameter to a positive number enables backups. Setting this parameter to 0 disables automated backups.

    • :preferred_backup_window - (String) The daily time range during which automated backups are created if automated backups are enabled, as determined by the BackupRetentionPeriod.

    • :preferred_maintenance_window - (String) The weekly time range (in UTC) during which system maintenance can occur, which may result in an outage. This change is made immediately. If moving this window to the current time, there must be at least 120 minutes between the current time and end of the window to ensure pending changes are applied.

    • :multi_az - (Boolean) Specifies if the DB Instance is a Multi-AZ deployment. Constraints: Cannot be specified if the DB Instance is a read replica.

    • :engine_version - (String) The version number of the database engine to upgrade to. For major version upgrades, if a nondefault DB Parameter Group is currently in use, a new DB Parameter Group in the DB Parameter Group Family for the new engine version must be specified. The new DB Parameter Group can be the default for that DB Parameter Group Family. Example: 5.1.42

    • :allow_major_version_upgrade - (Boolean) Indicates that major version upgrades are allowed. Constraints: This parameter must be set to true when specifying a value for the EngineVersion parameter that is a different major version than the DB Instance’s current version.

    • :auto_minor_version_upgrade - (Boolean) Indicates that minor version upgrades will be applied automatically to the DB Instance during the maintenance window.

    • :iops - (Integer) The new provisioned I/O operations per second of the RDS instance. This change does not result in an outage and is applied during the next maintenance window unless the ApplyImmediately parameter is specified as true for this request. Default: Uses existing setting Constraints: Value supplied must be at least 10% greater than the current value. Values that are not at least 10% greater than the existing value are rounded up so that they are 10% greater than the current value. Type: Integer

    • :option_group_name - (String) Indicates that the DB Instance should be associated with the specified option group.

See Also:



143
144
145
# File 'lib/aws/rds/db_instance.rb', line 143

def modify options = {}
  client.modify_db_instance(options.merge(:db_instance_identifier => id))
end

#reboot(options = {}) ⇒ nil

Reboots this databse instance.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :force_failover (Boolean)

    When true, the reboot will be conducted through a MultiAZ failover. Constraint: You cannot specify true if the instance is not configured for MultiAZ.

Returns:

  • (nil)


171
172
173
174
# File 'lib/aws/rds/db_instance.rb', line 171

def reboot options = {}
  client.reboot_db_instance(options.merge(:db_instance_identifier => id))
  nil
end

#snapshotsDBSnapshotCollection



148
149
150
# File 'lib/aws/rds/db_instance.rb', line 148

def snapshots
  DBSnapshotCollection.new(:config => config).db_instance(self)
end