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
13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 | |