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: {})


68
69
70
71
# File 'lib/aws/rds/db_instance.rb', line 68

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

def db_instance_class
  @db_instance_class
end

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

Returns:

  • (String)


74
75
76
# File 'lib/aws/rds/db_instance.rb', line 74

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

def db_name
  @db_name
end

#endpoint_addressString (readonly)

Returns the current value of endpoint_address.

Returns:

  • (String)

    the current value of endpoint_address



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

def endpoint_address
  @endpoint_address
end

#endpoint_portInteger (readonly)

Returns the current value of endpoint_port.

Returns:

  • (Integer)

    the current value of endpoint_port



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

def endpoint_port
  @endpoint_port
end

#engineString (readonly)

Returns the current value of engine.

Returns:

  • (String)

    the current value of engine



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

def engine
  @engine
end

#engine_versionString (readonly)

Returns the current value of engine_version.

Returns:

  • (String)

    the current value of engine_version



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

def engine_version
  @engine_version
end

#iopsInteger (readonly)

Returns the current value of iops.

Returns:

  • (Integer)

    the current value of iops



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

def license_model
  @license_model
end

#master_usernameString (readonly)

Returns the current value of master_username.

Returns:

  • (String)

    the current value of master_username



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

def master_username
  @master_username
end

#multi_azBoolean (readonly)

Returns the current value of multi_az.

Returns:

  • (Boolean)

    the current value of multi_az



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

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



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

def read_replica_source_db_instance_identifier
  @read_replica_source_db_instance_identifier
end

#vpc_idString? (readonly)

Returns the current value of vpc_id.

Returns:

  • (String, nil)

    the current value of vpc_id



64
65
66
# File 'lib/aws/rds/db_instance.rb', line 64

def vpc_id
  @vpc_id
end

Instance Method Details

#create_snapshot(db_snapshot_id) ⇒ DBSnapshot

Returns:



164
165
166
167
168
169
170
171
172
173
174
# File 'lib/aws/rds/db_instance.rb', line 164

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)


189
190
191
192
# File 'lib/aws/rds/db_instance.rb', line 189

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.



195
196
197
198
199
200
201
202
# File 'lib/aws/rds/db_instance.rb', line 195

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) A list of DB Security Groups to authorize on this DB Instance. This change is asynchronously applied as soon as possible.
    • :vpc_security_group_ids - (Array) A list of Ec2 Vpc Security Groups to authorize on this DB Instance. This change is asynchronously applied as soon as possible. Constraints: Must be 1 to 255 alphanumeric characters First character must be a letter Cannot end with a hyphen or contain two consecutive hyphens
    • :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.
    • :new_db_instance_identifier - (String) The new DB Instance identifier for the DB Instance when renaming a DB Instance. This value is stored as a lowercase string. Constraints: Must contain from 1 to 63 alphanumeric characters or hyphens First character must be a letter Cannot end with a hyphen or contain two consecutive hyphens

See Also:



154
155
156
# File 'lib/aws/rds/db_instance.rb', line 154

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)


182
183
184
185
# File 'lib/aws/rds/db_instance.rb', line 182

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

#snapshotsDBSnapshotCollection



159
160
161
# File 'lib/aws/rds/db_instance.rb', line 159

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

#vpcEC2::VPC?

Returns:



144
145
146
147
148
# File 'lib/aws/rds/db_instance.rb', line 144

def vpc
  if vpc_id
    EC2::VPC.new(vpc_id, :config => config)
  end
end