You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::RDS::DBSnapshot

Inherits:
Aws::Resources::Resource show all
Defined in:
(unknown)

Instance Attribute Summary collapse

Attributes inherited from Aws::Resources::Resource

#client, #identifiers

Instance Method Summary collapse

Methods inherited from Aws::Resources::Resource

add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until

Methods included from Aws::Resources::OperationMethods

#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations

Constructor Details

#initialize(instance_id, snapshot_id, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object

Overloads:

  • #initialize(instance_id, snapshot_id, options = {}) ⇒ Object

    Parameters:

    • instance_id (String)
    • snapshot_id (String)

    Options Hash (options):

    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

  • #initialize(options = {}) ⇒ Object

    Options Hash (options):

    • :instance_id (required, String)
    • :snapshot_id (required, String)
    • :client (Client)

      When `:client is not given, the options hash is used to construct a new Client object.

Instance Attribute Details

#allocated_storageInteger (readonly)

Specifies the allocated storage size in gigabytes (GB).

Returns:

  • (Integer)

    Specifies the allocated storage size in gigabytes (GB).

#availability_zoneString (readonly)

Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.

Returns:

  • (String)

    Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.

#db_instance_identifierString (readonly)

Specifies the DB instance identifier of the DB instance this DB snapshot was created from.

Returns:

  • (String)

    Specifies the DB instance identifier of the DB instance this DB snapshot was created from.

#db_snapshot_arnString (readonly)

The Amazon Resource Name (ARN) for the DB snapshot.

Returns:

  • (String)

    The Amazon Resource Name (ARN) for the DB snapshot.

#db_snapshot_identifierString (readonly)

Specifies the identifier for the DB snapshot.

Returns:

  • (String)

    Specifies the identifier for the DB snapshot.

#encryptedBoolean (readonly)

Specifies whether the DB snapshot is encrypted.

Returns:

  • (Boolean)

    Specifies whether the DB snapshot is encrypted.

#engineString (readonly)

Specifies the name of the database engine.

Returns:

  • (String)

    Specifies the name of the database engine.

#engine_versionString (readonly)

Specifies the version of the database engine.

Returns:

  • (String)

    Specifies the version of the database engine.

#iam_database_authentication_enabledBoolean (readonly)

True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled, and otherwise false.

Returns:

  • (Boolean)

    True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled, and otherwise false.

#instance_create_timeTime (readonly)

Specifies the time when the snapshot was taken, in Universal Coordinated Time (UTC).

Returns:

  • (Time)

    Specifies the time when the snapshot was taken, in Universal Coordinated Time (UTC).

#instance_idString (readonly)

Returns:

  • (String)

#iopsInteger (readonly)

Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.

Returns:

  • (Integer)

    Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.

#kms_key_idString (readonly)

If Encrypted is true, the AWS KMS key identifier for the encrypted DB snapshot.

Returns:

  • (String)

    If Encrypted is true, the AWS KMS key identifier for the encrypted DB snapshot.

#license_modelString (readonly)

License model information for the restored DB instance.

Returns:

  • (String)

    License model information for the restored DB instance.

#master_usernameString (readonly)

Provides the master username for the DB snapshot.

Returns:

  • (String)

    Provides the master username for the DB snapshot.

#option_group_nameString (readonly)

Provides the option group name for the DB snapshot.

Returns:

  • (String)

    Provides the option group name for the DB snapshot.

#percent_progressInteger (readonly)

The percentage of the estimated data that has been transferred.

Returns:

  • (Integer)

    The percentage of the estimated data that has been transferred.

#portInteger (readonly)

Specifies the port that the database engine was listening on at the time of the snapshot.

Returns:

  • (Integer)

    Specifies the port that the database engine was listening on at the time of the snapshot.

#snapshot_create_timeTime (readonly)

Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).

Returns:

  • (Time)

    Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).

#snapshot_idString (readonly)

Returns:

  • (String)

#snapshot_typeString (readonly)

Provides the type of the DB snapshot.

Returns:

  • (String)

    Provides the type of the DB snapshot.

#source_db_snapshot_identifierString (readonly)

The DB snapshot Amazon Resource Name (ARN) that the DB snapshot was copied from. It only has value in case of cross-customer or cross-region copy.

Returns:

  • (String)

    The DB snapshot Amazon Resource Name (ARN) that the DB snapshot was copied from.

#source_regionString (readonly)

The AWS Region that the DB snapshot was created in or copied from.

Returns:

  • (String)

    The AWS Region that the DB snapshot was created in or copied from.

#statusString (readonly)

Specifies the status of this DB snapshot.

Returns:

  • (String)

    Specifies the status of this DB snapshot.

#storage_typeString (readonly)

Specifies the storage type associated with DB snapshot.

Returns:

  • (String)

    Specifies the storage type associated with DB snapshot.

#tde_credential_arnString (readonly)

The ARN from the key store with which to associate the instance for TDE encryption.

Returns:

  • (String)

    The ARN from the key store with which to associate the instance for TDE encryption.

#timezoneString (readonly)

The time zone of the DB snapshot. In most cases, the Timezone element is empty. Timezone content appears only for snapshots taken from Microsoft SQL Server DB instances that were created with a time zone specified.

Returns:

  • (String)

    The time zone of the DB snapshot.

#vpc_idString (readonly)

Provides the VPC ID associated with the DB snapshot.

Returns:

  • (String)

    Provides the VPC ID associated with the DB snapshot.

Instance Method Details

#attributesCollection<DBSnapshotAttribute>

Returns a Collection of Aws::RDS::DBSnapshotAttribute resources. No API requests are made until you call an enumerable method on the collection. Client#describe_db_snapshot_attributes will be called multiple times until every Aws::RDS::DBSnapshotAttribute has been yielded.

Examples:

Request syntax example with placeholder values


dbsnapshot.attributes()

Enumerating Aws::RDS::DBSnapshotAttribute resources.

dbsnapshot.attributes.each do |dbsnapshotattribute|
  # yields each dbsnapshotattribute
end

Enumerating Aws::RDS::DBSnapshotAttribute resources with a limit.

dbsnapshot.attributes.limit(10).each do |dbsnapshotattribute|
  # yields at most 10 attributes
end

Returns:

See Also:

#copy(options = {}) ⇒ DBSnapshot

Examples:

Request syntax example with placeholder values


dbsnapshot.copy({
  target_db_snapshot_identifier: "String", # required
  kms_key_id: "String",
  tags: [
    {
      key: "String",
      value: "String",
    },
  ],
  copy_tags: false,
  pre_signed_url: "String",
  option_group_name: "String",
  destination_region: "String",
  source_region: "String",
})

Basic usage

dbsnapshot = dbsnapshot.copy(options)
dbsnapshot.snapshot_id
#=> "dbsnapshot-snapshot-id"

Options Hash (options):

  • :target_db_snapshot_identifier (required, String)

    The identifier for the copy of the snapshot.

    Constraints:

    • Cannot be null, empty, or blank

    • Must contain from 1 to 255 letters, numbers, or hyphens

    • First character must be a letter

    • Cannot end with a hyphen or contain two consecutive hyphens

    Example: my-db-snapshot

  • :kms_key_id (String)

    The AWS KMS key ID for an encrypted DB snapshot. The KMS key ID is the Amazon Resource Name (ARN), KMS key identifier, or the KMS key alias for the KMS encryption key.

    If you copy an encrypted DB snapshot from your AWS account, you can specify a value for this parameter to encrypt the copy with a new KMS encryption key. If you don\'t specify a value for this parameter, then the copy of the DB snapshot is encrypted with the same KMS key as the source DB snapshot.

    If you copy an encrypted DB snapshot that is shared from another AWS account, then you must specify a value for this parameter.

    If you specify this parameter when you copy an unencrypted snapshot, the copy is encrypted.

    If you copy an encrypted snapshot to a different AWS Region, then you must specify a KMS key for the destination AWS Region. KMS encryption keys are specific to the AWS Region that they are created in, and you can\'t use encryption keys from one AWS Region in another AWS Region.

  • :tags (Array<Types::Tag>)

    A list of tags. For more information, see Tagging Amazon RDS Resources.

  • :copy_tags (Boolean)

    True to copy all tags from the source DB snapshot to the target DB snapshot, and otherwise false. The default is false.

  • :pre_signed_url (String)

    The URL that contains a Signature Version 4 signed request for the CopyDBSnapshot API action in the source AWS Region that contains the source DB snapshot to copy.

    You must specify this parameter when you copy an encrypted DB snapshot from another AWS Region by using the Amazon RDS API. You can specify the --source-region option instead of this parameter when you copy an encrypted DB snapshot from another AWS Region by using the AWS CLI.

    The presigned URL must be a valid request for the CopyDBSnapshot API action that can be executed in the source AWS Region that contains the encrypted DB snapshot to be copied. The presigned URL request must contain the following parameter values:

    • DestinationRegion - The AWS Region that the encrypted DB snapshot is copied to. This AWS Region is the same one where the CopyDBSnapshot action is called that contains this presigned URL.

      For example, if you copy an encrypted DB snapshot from the us-west-2 AWS Region to the us-east-1 AWS Region, then you call the CopyDBSnapshot action in the us-east-1 AWS Region and provide a presigned URL that contains a call to the CopyDBSnapshot action in the us-west-2 AWS Region. For this example, the DestinationRegion in the presigned URL must be set to the us-east-1 AWS Region.

    • KmsKeyId - The AWS KMS key identifier for the key to use to encrypt the copy of the DB snapshot in the destination AWS Region. This is the same identifier for both the CopyDBSnapshot action that is called in the destination AWS Region, and the action contained in the presigned URL.

    • SourceDBSnapshotIdentifier - The DB snapshot identifier for the encrypted snapshot to be copied. This identifier must be in the Amazon Resource Name (ARN) format for the source AWS Region. For example, if you are copying an encrypted DB snapshot from the us-west-2 AWS Region, then your SourceDBSnapshotIdentifier looks like the following example: arn:aws:rds:us-west-2:123456789012:snapshot:mysql-instance1-snapshot-20161115.

    To learn how to generate a Signature Version 4 signed request, see Authenticating Requests: Using Query Parameters (AWS Signature Version 4) and Signature Version 4 Signing Process.

  • :option_group_name (String)

    The name of an option group to associate with the copy of the snapshot.

    Specify this option if you are copying a snapshot from one AWS Region to another, and your DB instance uses a nondefault option group. If your source DB instance uses Transparent Data Encryption for Oracle or Microsoft SQL Server, you must specify this option when copying across AWS Regions. For more information, see Option Group Considerations.

  • :destination_region (String)
  • :source_region (String)

    The region which you are copying an encrypted snapshot from.

    This is a required paramter that allows SDK to compute a pre-signed Url and populate PreSignedURL parameter on your behalf.

Returns:

See Also:

#create(options = {}) ⇒ DBSnapshot

Examples:

Request syntax example with placeholder values


dbsnapshot.create({
  tags: [
    {
      key: "String",
      value: "String",
    },
  ],
})

Basic usage

dbsnapshot = dbsnapshot.create(options)
dbsnapshot.snapshot_id
#=> "dbsnapshot-snapshot-id"

Options Hash (options):

Returns:

See Also:

#deleteDBSnapshot

Examples:

Request syntax example with placeholder values


dbsnapshot.delete()

Basic usage

dbsnapshot = dbsnapshot.delete(options)
dbsnapshot.snapshot_id
#=> "dbsnapshot-snapshot-id"

Returns:

See Also:

#events(options = {}) ⇒ Collection<Event>

Returns a Collection of Event resources. No API requests are made until you call an enumerable method on the collection. Client#describe_events will be called multiple times until every Event has been yielded.

Examples:

Request syntax example with placeholder values


dbsnapshot.events({
  start_time: Time.now,
  end_time: Time.now,
  duration: 1,
  event_categories: ["String"],
  filters: [
    {
      name: "String", # required
      values: ["String"], # required
    },
  ],
  max_records: 1,
  marker: "String",
})

Enumerating Event resources.

dbsnapshot.events.each do |event|
  # yields each event
end

Enumerating Event resources with a limit.

dbsnapshot.events.limit(10).each do |event|
  # yields at most 10 events
end

Options Hash (options):

  • :start_time (Time)

    The beginning of the time interval to retrieve events for, specified in ISO 8601 format. For more information about ISO 8601, go to the ISO8601 Wikipedia page.

    Example: 2009-07-08T18:00Z

  • :end_time (Time)

    The end of the time interval for which to retrieve events, specified in ISO 8601 format. For more information about ISO 8601, go to the ISO8601 Wikipedia page.

    Example: 2009-07-08T18:00Z

  • :duration (Integer)

    The number of minutes to retrieve events for.

    Default: 60

  • :event_categories (Array<String>)

    A list of event categories that trigger notifications for a event notification subscription.

  • :filters (Array<Types::Filter>)

    This parameter is not currently supported.

  • :max_records (Integer)

    The maximum number of records to include in the response. If more records exist than the specified MaxRecords value, a pagination token called a marker is included in the response so that the remaining results can be retrieved.

    Default: 100

    Constraints: Minimum 20, maximum 100.

  • :marker (String)

    An optional pagination token provided by a previous DescribeEvents request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by MaxRecords.

Returns:

See Also:

#instanceDBInstance

Returns:

See Also:

#option_groupOptionGroup?

Returns:

#restore(options = {}) ⇒ DBInstance

Examples:

Request syntax example with placeholder values


dbsnapshot.restore({
  db_instance_identifier: "String", # required
  db_instance_class: "String",
  port: 1,
  availability_zone: "String",
  db_subnet_group_name: "String",
  multi_az: false,
  publicly_accessible: false,
  auto_minor_version_upgrade: false,
  license_model: "String",
  db_name: "String",
  engine: "String",
  iops: 1,
  option_group_name: "String",
  tags: [
    {
      key: "String",
      value: "String",
    },
  ],
  storage_type: "String",
  tde_credential_arn: "String",
  tde_credential_password: "String",
  domain: "String",
  copy_tags_to_snapshot: false,
  domain_iam_role_name: "String",
  enable_iam_database_authentication: false,
})

Basic usage

dbinstance = dbsnapshot.restore(options)
dbinstance.id
#=> "dbinstance-id"

Options Hash (options):

  • :db_instance_identifier (required, String)

    Name of the DB instance to create from the DB snapshot. This parameter isn\'t case-sensitive.

    Constraints:

    • Must contain from 1 to 63 numbers, letters, or hyphens

    • First character must be a letter

    • Cannot end with a hyphen or contain two consecutive hyphens

    Example: my-snapshot-id

  • :db_instance_class (String)

    The compute and memory capacity of the Amazon RDS DB instance, for example, db.m4.large. Not all DB instance classes are available in all AWS Regions, or for all database engines. For the full list of DB instance classes, and availability for your engine, see DB Instance Class in the Amazon RDS User Guide.

    Default: The same DBInstanceClass as the original DB instance.

  • :port (Integer)

    The port number on which the database accepts connections.

    Default: The same port as the original DB instance

    Constraints: Value must be 1150-65535

  • :availability_zone (String)

    The EC2 Availability Zone that the DB instance is created in.

    Default: A random, system-chosen Availability Zone.

    Constraint: You can\'t specify the AvailabilityZone parameter if the MultiAZ parameter is set to true.

    Example: us-east-1a

  • :db_subnet_group_name (String)

    The DB subnet group name to use for the new instance.

    Constraints: If supplied, must match the name of an existing DBSubnetGroup.

    Example: mySubnetgroup

  • :multi_az (Boolean)

    Specifies if the DB instance is a Multi-AZ deployment.

    Constraint: You can\'t specify the AvailabilityZone parameter if the MultiAZ parameter is set to true.

  • :publicly_accessible (Boolean)

    Specifies the accessibility options for the DB instance. A value of true specifies an Internet-facing instance with a publicly resolvable DNS name, which resolves to a public IP address. A value of false specifies an internal instance with a DNS name that resolves to a private IP address.

    Default: The default behavior varies depending on whether a VPC has been requested or not. The following list shows the default behavior in each case.

    • Default VPC: true

    • VPC: false

    If no DB subnet group has been specified as part of the request and the PubliclyAccessible value has not been set, the DB instance is publicly accessible. If a specific DB subnet group has been specified as part of the request and the PubliclyAccessible value has not been set, the DB instance is private.

  • :auto_minor_version_upgrade (Boolean)

    Indicates that minor version upgrades are applied automatically to the DB instance during the maintenance window.

  • :license_model (String)

    License model information for the restored DB instance.

    Default: Same as source.

    Valid values: license-included | bring-your-own-license | general-public-license

  • :db_name (String)

    The database name for the restored DB instance.

    This parameter doesn\'t apply to the MySQL, PostgreSQL, or MariaDB engines.

  • :engine (String)

    The database engine to use for the new instance.

    Default: The same as source

    Constraint: Must be compatible with the engine of the source. You can restore a MariaDB 10.1 DB instance from a MySQL 5.6 snapshot.

    Valid Values:

    • aurora

    • aurora-postgresql

    • mariadb

    • mysql

    • oracle-ee

    • oracle-se2

    • oracle-se1

    • oracle-se

    • postgres

    • sqlserver-ee

    • sqlserver-se

    • sqlserver-ex

    • sqlserver-web

  • :iops (Integer)

    Specifies the amount of provisioned IOPS for the DB instance, expressed in I/O operations per second. If this parameter is not specified, the IOPS value is taken from the backup. If this parameter is set to 0, the new instance is converted to a non-PIOPS instance. The conversion takes additional time, though your DB instance is available for connections before the conversion starts.

    The provisioned IOPS value must follow the requirements for your database engine. For more information, see Amazon RDS Provisioned IOPS Storage to Improve Performance.

    Constraints: Must be an integer greater than 1000.

  • :option_group_name (String)

    The name of the option group to be used for the restored DB instance.

    Permanent options, such as the TDE option for Oracle Advanced Security TDE, can\'t be removed from an option group, and that option group can\'t be removed from a DB instance once it is associated with a DB instance

  • :tags (Array<Types::Tag>)

    A list of tags. For more information, see Tagging Amazon RDS Resources.

  • :storage_type (String)

    Specifies the storage type to be associated with the DB instance.

    Valid values: standard | gp2 | io1

    If you specify io1, you must also include a value for the Iops parameter.

    Default: io1 if the Iops parameter is specified, otherwise standard

  • :tde_credential_arn (String)

    The ARN from the key store with which to associate the instance for TDE encryption.

  • :tde_credential_password (String)

    The password for the given ARN from the key store in order to access the device.

  • :domain (String)

    Specify the Active Directory Domain to restore the instance in.

  • :copy_tags_to_snapshot (Boolean)

    True to copy all tags from the restored DB instance to snapshots of the DB instance, and otherwise false. The default is false.

  • :domain_iam_role_name (String)

    Specify the name of the IAM role to be used when making API calls to the Directory Service.

  • :enable_iam_database_authentication (Boolean)

    True to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts, and otherwise false.

    You can enable IAM database authentication for the following database engines

    • For MySQL 5.6, minor version 5.6.34 or higher

    • For MySQL 5.7, minor version 5.7.16 or higher

    • Aurora 5.6 or higher.

    Default: false

Returns:

See Also:

#subscribe_to(options = {}) ⇒ EventSubscription

Examples:

Request syntax example with placeholder values


dbsnapshot.subscribe_to({
  subscription_name: "String", # required
})

Basic usage

eventsubscription = dbsnapshot.subscribe_to(options)
eventsubscription.name
#=> "eventsubscription-name"

Options Hash (options):

  • :subscription_name (required, String)

    The name of the RDS event notification subscription you want to add a source identifier to.

Returns:

See Also:

#unsubscribe_from(options = {}) ⇒ EventSubscription

Examples:

Request syntax example with placeholder values


dbsnapshot.unsubscribe_from({
  subscription_name: "String", # required
})

Basic usage

eventsubscription = dbsnapshot.unsubscribe_from(options)
eventsubscription.name
#=> "eventsubscription-name"

Options Hash (options):

  • :subscription_name (required, String)

    The name of the RDS event notification subscription you want to remove a source identifier from.

Returns:

See Also: