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 gibibytes (GiB).

Returns:

  • (Integer)

    Specifies the allocated storage size in gibibytes (GiB).

#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.

#dbi_resource_idString (readonly)

The identifier for the source DB instance, which can\'t be changed and which is unique to an AWS Region.

Returns:

  • (String)

    The identifier for the source DB instance, which can\'t be changed and which is unique to an AWS Region.

#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 in Coordinated Universal Time (UTC) when the DB instance, from which the snapshot was taken, was created.

Returns:

  • (Time)

    Specifies the time in Coordinated Universal Time (UTC) when the DB instance, from which the snapshot was taken, was created.

#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.

#processor_featuresArray<Types::ProcessorFeature> (readonly)

The number of CPU cores and the number of threads per core for the DB instance class of the DB instance when the DB snapshot was created.

Returns:

  • (Array<Types::ProcessorFeature>)

    The number of CPU cores and the number of threads per core for the DB instance class of the DB instance when the DB snapshot was created.

#snapshot_create_timeTime (readonly)

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

Returns:

  • (Time)

    Specifies when the snapshot was taken in Coordinated Universal 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.

#tag_listArray<Types::Tag> (readonly)

A list of tags. For more information, see Tagging Amazon RDS Resources in the Amazon RDS User Guide.

Returns:

#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",
  target_custom_availability_zone: "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:

    • Can\'t be null, empty, or blank

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

    • First character must be a letter

    • Can\'t 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 in the Amazon RDS User Guide.

  • :copy_tags (Boolean)

    A value that indicates whether to copy all tags from the source DB snapshot to the target DB snapshot. By default, tags are not copied.

  • :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. Don\'t specify PreSignedUrl when you are copying an encrypted DB snapshot in the same AWS Region.

    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.

    If you are using an AWS SDK tool or the AWS CLI, you can specify SourceRegion (or --source-region for the AWS CLI) instead of specifying PreSignedUrl manually. Specifying SourceRegion autogenerates a pre-signed URL that is a valid request for the operation that can be executed in the source AWS Region.

  • :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 in the Amazon RDS User Guide.

  • :target_custom_availability_zone (String)

    The external custom Availability Zone (CAZ) identifier for the target CAZ.

    Example: rds-caz-aiqhTgQv.

  • :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 isn\'t 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 you can retrieve the remaining results.

    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",
  vpc_security_group_ids: ["String"],
  domain: "String",
  copy_tags_to_snapshot: false,
  domain_iam_role_name: "String",
  enable_iam_database_authentication: false,
  enable_cloudwatch_logs_exports: ["String"],
  processor_features: [
    {
      name: "String",
      value: "String",
    },
  ],
  use_default_processor_features: false,
  db_parameter_group_name: "String",
  deletion_protection: 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

    • Can\'t 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 Availability Zone (AZ) where the DB instance will be created.

    Default: A random, system-chosen Availability Zone.

    Constraint: You can\'t specify the AvailabilityZone parameter if the DB instance is a Multi-AZ deployment.

    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)

    A value that indicates whether the DB instance is a Multi-AZ deployment.

    Constraint: You can\'t specify the AvailabilityZone parameter if the DB instance is a Multi-AZ deployment.

  • :publicly_accessible (Boolean)

    A value that indicates whether the DB instance is publicly accessible.

    When the DB instance is publicly accessible, its DNS endpoint resolves to the private IP address from within the DB instance\'s VPC, and to the public IP address from outside of the DB instance\'s VPC. Access to the DB instance is ultimately controlled by the security group it uses, and that public access is not permitted if the security group assigned to the DB instance doesn\'t permit it.

    When the DB instance isn\'t publicly accessible, it is an internal DB instance with a DNS name that resolves to a private IP address.

    For more information, see CreateDBInstance.

  • :auto_minor_version_upgrade (Boolean)

    A value that indicates whether 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. For example, you can restore a MariaDB 10.1 DB instance from a MySQL 5.6 snapshot.

    Valid Values:

    • 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 isn\'t 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 in the Amazon RDS User Guide.

    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 in the Amazon RDS User Guide.

  • :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 gp2

  • :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.

  • :vpc_security_group_ids (Array<String>)

    A list of EC2 VPC security groups to associate with this DB instance.

    Default: The default EC2 VPC security group for the DB subnet group\'s VPC.

  • :domain (String)

    Specify the Active Directory directory ID to restore the DB instance in. The domain must be created prior to this operation. Currently, only MySQL, Microsoft SQL Server, Oracle, and PostgreSQL DB instances can be created in an Active Directory Domain.

    For more information, see Kerberos Authentication in the Amazon RDS User Guide.

  • :copy_tags_to_snapshot (Boolean)

    A value that indicates whether to copy all tags from the restored DB instance to snapshots of the DB instance. By default, tags are not copied.

  • :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)

    A value that indicates whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts. By default, mapping is disabled.

    For more information about IAM database authentication, see IAM Database Authentication for MySQL and PostgreSQL in the Amazon RDS User Guide.

  • :enable_cloudwatch_logs_exports (Array<String>)

    The list of logs that the restored DB instance is to export to CloudWatch Logs. The values in the list depend on the DB engine being used. For more information, see Publishing Database Logs to Amazon CloudWatch Logs in the Amazon RDS User Guide.

  • :processor_features (Array<Types::ProcessorFeature>)

    The number of CPU cores and the number of threads per core for the DB instance class of the DB instance.

  • :use_default_processor_features (Boolean)

    A value that indicates whether the DB instance class of the DB instance uses its default processor features.

  • :db_parameter_group_name (String)

    The name of the DB parameter group to associate with this DB instance.

    If you do not specify a value for DBParameterGroupName, then the default DBParameterGroup for the specified DB engine is used.

    Constraints:

    • If supplied, must match the name of an existing DBParameterGroup.

    • Must be 1 to 255 letters, numbers, or hyphens.

    • First character must be a letter.

    • Can\'t end with a hyphen or contain two consecutive hyphens.

  • :deletion_protection (Boolean)

    A value that indicates whether the DB instance has deletion protection enabled. The database can\'t be deleted when deletion protection is enabled. By default, deletion protection is disabled. For more information, see Deleting a DB Instance.

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: