restore_db_cluster_from_s3
¶
restore_db_cluster_from_s3(
*,
config_overrides: Optional[RDSClientConfig] = None,
availability_zones: Optional[AvailabilityZones] = None,
backup_retention_period: Optional[IntegerOptional] = None,
character_set_name: Optional[String] = None,
database_name: Optional[String] = None,
db_cluster_identifier: Optional[String] = None,
db_cluster_parameter_group_name: Optional[String] = None,
vpc_security_group_ids: Optional[VpcSecurityGroupIdList] = None,
db_subnet_group_name: Optional[String] = None,
engine: Optional[String] = None,
engine_version: Optional[String] = None,
port: Optional[IntegerOptional] = None,
master_username: Optional[String] = None,
master_user_password: Optional[SensitiveString] = None,
option_group_name: Optional[String] = None,
preferred_backup_window: Optional[String] = None,
preferred_maintenance_window: Optional[String] = None,
tags: Optional[TagList] = None,
storage_encrypted: Optional[BooleanOptional] = None,
kms_key_id: Optional[String] = None,
enable_iam_database_authentication: Optional[BooleanOptional] = None,
source_engine: Optional[String] = None,
source_engine_version: Optional[String] = None,
s3_bucket_name: Optional[String] = None,
s3_prefix: Optional[String] = None,
s3_ingestion_role_arn: Optional[String] = None,
backtrack_window: Optional[LongOptional] = None,
enable_cloudwatch_logs_exports: Optional[LogTypeList] = None,
deletion_protection: Optional[BooleanOptional] = None,
copy_tags_to_snapshot: Optional[BooleanOptional] = None,
domain: Optional[String] = None,
domain_iam_role_name: Optional[String] = None,
storage_type: Optional[String] = None,
network_type: Optional[String] = None,
serverless_v2_scaling_configuration: Optional[
ServerlessV2ScalingConfiguration
] = None,
manage_master_user_password: Optional[BooleanOptional] = None,
master_user_secret_kms_key_id: Optional[String] = None,
engine_lifecycle_support: Optional[String] = None,
tag_specifications: Optional[TagSpecificationList] = None,
associated_roles: Optional[DBClusterAssociatedRoles] = None,
) -> RestoreDBClusterFromS3Result
Creates an Amazon Aurora DB cluster from MySQL data stored in an Amazon S3 bucket. Amazon RDS must be authorized to access the Amazon S3 bucket and the data must be created using the Percona XtraBackup utility as described in Migrating Data from MySQL by Using an Amazon S3 Bucket in the Amazon Aurora User Guide.
This operation only restores the DB cluster, not the DB instances for that DB cluster. You must invoke the CreateDBInstance operation to create DB instances for the restored DB cluster, specifying the identifier of the restored DB cluster in DBClusterIdentifier. You can create DB instances only after the RestoreDBClusterFromS3 operation has completed and the DB cluster is available.
For more information on Amazon Aurora, see What is Amazon Aurora? in the Amazon Aurora User Guide.
This operation only applies to Aurora DB clusters. The source DB engine must be MySQL.
You can use the AssociatedRoles parameter to associate one or more Amazon Web Services Identity and Access Management (IAM) roles with the Aurora DB cluster when you restore it from Amazon S3.
Parameters:
-
availability_zones(Optional[AvailabilityZones], default:None) –A list of Availability Zones (AZs) where instances in the restored DB cluster can be created.
-
backup_retention_period(Optional[IntegerOptional], default:None) –The number of days for which automated backups of the restored DB cluster are retained. You must specify a minimum value of 1.
Default: 1
Constraints:
-
Must be a value from 1 to 35
-
-
character_set_name(Optional[String], default:None) –A value that indicates that the restored DB cluster should be associated with the specified CharacterSet.
-
database_name(Optional[String], default:None) –The database name for the restored DB cluster.
-
db_cluster_identifier(Optional[String], default:None) –The name of the DB cluster to create from the source data in the Amazon S3 bucket. This parameter isn't case-sensitive.
Constraints:
-
Must contain from 1 to 63 letters, numbers, or hyphens.
-
First character must be a letter.
-
Can't end with a hyphen or contain two consecutive hyphens.
Example:
my-cluster1 -
-
db_cluster_parameter_group_name(Optional[String], default:None) –The name of the DB cluster parameter group to associate with the restored DB cluster. If this argument is omitted, the default parameter group for the engine version is used.
Constraints:
-
If supplied, must match the name of an existing DBClusterParameterGroup.
-
-
vpc_security_group_ids(Optional[VpcSecurityGroupIdList], default:None) –A list of EC2 VPC security groups to associate with the restored DB cluster.
-
db_subnet_group_name(Optional[String], default:None) –A DB subnet group to associate with the restored DB cluster.
Constraints: If supplied, must match the name of an existing DBSubnetGroup.
Example:
mydbsubnetgroup -
engine(Optional[String], default:None) –The name of the database engine to be used for this DB cluster.
Valid Values:
aurora-mysql(for Aurora MySQL) -
engine_version(Optional[String], default:None) –The version number of the database engine to use.
To list all of the available engine versions for
aurora-mysql(Aurora MySQL), use the following command:aws rds describe-db-engine-versions --engine aurora-mysql --query "DBEngineVersions[].EngineVersion"Aurora MySQL
Examples:
5.7.mysql_aurora.2.12.0,8.0.mysql_aurora.3.04.0 -
port(Optional[IntegerOptional], default:None) –The port number on which the instances in the restored DB cluster accept connections.
Default:
3306 -
master_username(Optional[String], default:None) –The name of the master user for the restored DB cluster.
Constraints:
-
Must be 1 to 16 letters or numbers.
-
First character must be a letter.
-
Can't be a reserved word for the chosen database engine.
-
-
master_user_password(Optional[SensitiveString], default:None) –The password for the master database user. This password can contain any printable ASCII character except "/", """, or "@".
Constraints:
-
Must contain from 8 to 41 characters.
-
Can't be specified if
ManageMasterUserPasswordis turned on.
-
-
option_group_name(Optional[String], default:None) –A value that indicates that the restored DB cluster should be associated with the specified option group.
Permanent options can't be removed from an option group. An option group can't be removed from a DB cluster once it is associated with a DB cluster.
-
preferred_backup_window(Optional[String], default:None) –The daily time range during which automated backups are created if automated backups are enabled using the
BackupRetentionPeriodparameter.The default is a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region. To view the time blocks available, see Backup window in the Amazon Aurora User Guide.
Constraints:
-
Must be in the format
hh24:mi-hh24:mi. -
Must be in Universal Coordinated Time (UTC).
-
Must not conflict with the preferred maintenance window.
-
Must be at least 30 minutes.
-
-
preferred_maintenance_window(Optional[String], default:None) –The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC).
Format:
ddd:hh24:mi-ddd:hh24:miThe default is a 30-minute window selected at random from an 8-hour block of time for each Amazon Web Services Region, occurring on a random day of the week. To see the time blocks available, see Adjusting the Preferred Maintenance Window in the Amazon Aurora User Guide.
Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun.
Constraints: Minimum 30-minute window.
-
storage_encrypted(Optional[BooleanOptional], default:None) –Specifies whether the restored DB cluster is encrypted.
-
kms_key_id(Optional[String], default:None) –The Amazon Web Services KMS key identifier for an encrypted DB cluster.
The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN.
If the StorageEncrypted parameter is enabled, and you do not specify a value for the
KmsKeyIdparameter, then Amazon RDS will use your default KMS key. There is a default KMS key for your Amazon Web Services account. Your Amazon Web Services account has a different default KMS key for each Amazon Web Services Region. -
enable_iam_database_authentication(Optional[BooleanOptional], default:None) –Specifies whether to enable mapping of Amazon Web Services Identity and Access Management (IAM) accounts to database accounts. By default, mapping isn't enabled.
For more information, see IAM Database Authentication in the Amazon Aurora User Guide.
-
source_engine(Optional[String], default:None) –The identifier for the database engine that was backed up to create the files stored in the Amazon S3 bucket.
Valid Values:
mysql -
source_engine_version(Optional[String], default:None) –The version of the database that the backup files were created from.
MySQL versions 5.7 and 8.0 are supported.
Example:
5.7.40,8.0.28 -
s3_bucket_name(Optional[String], default:None) –The name of the Amazon S3 bucket that contains the data used to create the Amazon Aurora DB cluster.
-
s3_prefix(Optional[String], default:None) –The prefix for all of the file names that contain the data used to create the Amazon Aurora DB cluster. If you do not specify a SourceS3Prefix value, then the Amazon Aurora DB cluster is created by using all of the files in the Amazon S3 bucket.
-
s3_ingestion_role_arn(Optional[String], default:None) –The Amazon Resource Name (ARN) of the Amazon Web Services Identity and Access Management (IAM) role that authorizes Amazon RDS to access the Amazon S3 bucket on your behalf.
-
backtrack_window(Optional[LongOptional], default:None) –The target backtrack window, in seconds. To disable backtracking, set this value to 0.
Currently, Backtrack is only supported for Aurora MySQL DB clusters.
Default: 0
Constraints:
-
If specified, this value must be set to a number from 0 to 259,200 (72 hours).
-
-
enable_cloudwatch_logs_exports(Optional[LogTypeList], default:None) –The list of logs that the restored DB cluster is to export to CloudWatch Logs. The values in the list depend on the DB engine being used.
Aurora MySQL
Possible values are
audit,error,general,instance,slowquery, andiam-db-auth-error.Aurora PostgreSQL
Possible value are
instance,postgresql, andiam-db-auth-error.For more information about exporting CloudWatch Logs for Amazon RDS, see Publishing Database Logs to Amazon CloudWatch Logs in the Amazon RDS User Guide.
For more information about exporting CloudWatch Logs for Amazon Aurora, see Publishing Database Logs to Amazon CloudWatch Logs in the Amazon Aurora User Guide.
-
deletion_protection(Optional[BooleanOptional], default:None) –Specifies whether to enable deletion protection for the DB cluster. The database can't be deleted when deletion protection is enabled. By default, deletion protection isn't enabled.
-
copy_tags_to_snapshot(Optional[BooleanOptional], default:None) –Specifies whether to copy all tags from the restored DB cluster to snapshots of the restored DB cluster. The default is not to copy them.
-
domain(Optional[String], default:None) –Specify the Active Directory directory ID to restore the DB cluster in. The domain must be created prior to this operation.
For Amazon Aurora DB clusters, Amazon RDS can use Kerberos Authentication to authenticate users that connect to the DB cluster. For more information, see Kerberos Authentication in the Amazon Aurora User Guide.
-
domain_iam_role_name(Optional[String], default:None) –Specify the name of the IAM role to be used when making API calls to the Directory Service.
-
storage_type(Optional[String], default:None) –Specifies the storage type to be associated with the DB cluster.
Valid Values:
aurora,aurora-iopt1Default:
auroraValid for: Aurora DB clusters only
-
network_type(Optional[String], default:None) –The network type of the DB cluster.
Valid Values:
-
IPV4 -
DUAL
The network type is determined by the
DBSubnetGroupspecified for the DB cluster. ADBSubnetGroupcan support only the IPv4 protocol or the IPv4 and the IPv6 protocols (DUAL).For more information, see Working with a DB instance in a VPC in the Amazon Aurora User Guide.
-
-
manage_master_user_password(Optional[BooleanOptional], default:None) –Specifies whether to manage the master user password with Amazon Web Services Secrets Manager.
For more information, see Password management with Amazon Web Services Secrets Manager in the Amazon RDS User Guide and Password management with Amazon Web Services Secrets Manager in the Amazon Aurora User Guide.
Constraints:
-
Can't manage the master user password with Amazon Web Services Secrets Manager if
MasterUserPasswordis specified.
-
-
master_user_secret_kms_key_id(Optional[String], default:None) –The Amazon Web Services KMS key identifier to encrypt a secret that is automatically generated and managed in Amazon Web Services Secrets Manager.
This setting is valid only if the master user password is managed by RDS in Amazon Web Services Secrets Manager for the DB cluster.
The Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To use a KMS key in a different Amazon Web Services account, specify the key ARN or alias ARN.
If you don't specify
MasterUserSecretKmsKeyId, then theaws/secretsmanagerKMS key is used to encrypt the secret. If the secret is in a different Amazon Web Services account, then you can't use theaws/secretsmanagerKMS key to encrypt the secret, and you must use a customer managed KMS key.There is a default KMS key for your Amazon Web Services account. Your Amazon Web Services account has a different default KMS key for each Amazon Web Services Region.
-
engine_lifecycle_support(Optional[String], default:None) –The lifecycle type for this DB cluster.
By default, this value is set to
open-source-rds-extended-support, which enrolls your DB cluster into Amazon RDS Extended Support. At the end of standard support, you can avoid charges for Extended Support by setting the value toopen-source-rds-extended-support-disabled. In this case, RDS automatically upgrades your restored DB cluster to a higher engine version, if the major engine version is past its end of standard support date.You can use this setting to enroll your DB cluster into Amazon RDS Extended Support. With RDS Extended Support, you can run the selected major engine version on your DB cluster past the end of standard support for that engine version. For more information, see the following sections:
-
Amazon Aurora - Amazon RDS Extended Support with Amazon Aurora in the Amazon Aurora User Guide
-
Amazon RDS - Amazon RDS Extended Support with Amazon RDS in the Amazon RDS User Guide
Valid for Cluster Type: Aurora DB clusters and Multi-AZ DB clusters
Valid Values:
open-source-rds-extended-support | open-source-rds-extended-support-disabledDefault:
open-source-rds-extended-support -
-
tag_specifications(Optional[TagSpecificationList], default:None) –Tags to assign to resources associated with the DB cluster.
Valid Values:
-
cluster-auto-backup- The DB cluster's automated backup.
-
-
associated_roles(Optional[DBClusterAssociatedRoles], default:None) –A list of Amazon Web Services Identity and Access Management (IAM) roles to associate with the DB cluster when it's restored from Amazon S3. Each role grants the DB cluster permission to access other Amazon Web Services on your behalf. For each role, specify a role ARN and, optionally, the feature name (such as
s3Import,s3Export, orLambda).
Raises:
-
DBClusterAlreadyExistsFault–The user already has a DB cluster with the given identifier.
-
DBClusterNotFoundFault–DBClusterIdentifierdoesn't refer to an existing DB cluster. -
DBClusterParameterGroupNotFoundFault–DBClusterParameterGroupNamedoesn't refer to an existing DB cluster parameter group. -
DBClusterQuotaExceededFault–The user attempted to create a new DB cluster and the user has already reached the maximum allowed DB cluster quota.
-
DBClusterRoleQuotaExceededFault–You have exceeded the maximum number of IAM roles that can be associated with the specified DB cluster.
-
DBSubnetGroupNotFoundFault–DBSubnetGroupNamedoesn't refer to an existing DB subnet group. -
DomainNotFoundFault–Domaindoesn't refer to an existing Active Directory domain. -
InsufficientStorageClusterCapacityFault–There is insufficient storage available for the current action. You might be able to resolve this error by updating your subnet group to use different Availability Zones that have more storage available.
-
InvalidDBClusterStateFault–The requested operation can't be performed while the cluster is in this state.
-
InvalidDBSubnetGroupStateFault–The DB subnet group cannot be deleted because it's in use.
-
InvalidS3BucketFault–The specified Amazon S3 bucket name can't be found or Amazon RDS isn't authorized to access the specified Amazon S3 bucket. Verify the SourceS3BucketName and S3IngestionRoleArn values and try again.
-
InvalidSubnet–The requested subnet is invalid, or multiple subnets were requested that are not all in a common VPC.
-
InvalidVPCNetworkStateFault–The DB subnet group doesn't cover all Availability Zones after it's created because of users' change.
-
KMSKeyNotAccessibleFault–An error occurred accessing an Amazon Web Services KMS key.
-
NetworkTypeNotSupported–The network type is invalid for the DB instance. Valid nework type values are
IPV4andDUAL. -
StorageQuotaExceededFault–The request would result in the user exceeding the allowed amount of storage available across all DB instances.
-
StorageTypeNotSupportedFault–The specified
StorageTypecan't be associated with the DB instance. -
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To restore an Amazon Aurora DB cluster from Amazon S3 The following example restores an Amazon Aurora MySQL version 5.7-compatible DB cluster from a MySQL 5.7 DB backup file in Amazon S3.
>>> client.restore_db_cluster_from_s3(db_cluster_identifier='cluster-s3-restore', engine='aurora-mysql', master_username='admin', master_user_password='mypassword', source_engine='mysql', source_engine_version='5.7.28', s3_bucket_name='mybucket', s3_prefix='test-backup', s3_ingestion_role_arn='arn:aws:iam::123456789012:role/service-role/TestBackup')
Source code in docs_src/capo_rds/_services/rds.py
13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 | |