create_db_cluster
¶
create_db_cluster(
*,
config_overrides: Optional[DocDBClientConfig] = None,
availability_zones: Optional[AvailabilityZones] = None,
backup_retention_period: Optional[IntegerOptional] = 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[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,
pre_signed_url: Optional[String] = None,
enable_cloudwatch_logs_exports: Optional[LogTypeList] = None,
deletion_protection: Optional[BooleanOptional] = None,
global_cluster_identifier: Optional[GlobalClusterIdentifier] = None,
storage_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,
network_type: Optional[String] = None,
copy_tags_to_snapshot: Optional[BooleanOptional] = None,
) -> CreateDBClusterResult
Creates a new Amazon DocumentDB cluster.
Parameters:
-
availability_zones(Optional[AvailabilityZones], default:None) –A list of Amazon EC2 Availability Zones that instances in the cluster can be created in.
-
backup_retention_period(Optional[IntegerOptional], default:None) –The number of days for which automated backups are retained. You must specify a minimum value of 1.
Default: 1
Constraints:
-
Must be a value from 1 to 35.
-
-
db_cluster_identifier(Optional[String], default:None) –The cluster identifier. This parameter is stored as a lowercase string.
Constraints:
-
Must contain from 1 to 63 letters, numbers, or hyphens.
-
The first character must be a letter.
-
Cannot end with a hyphen or contain two consecutive hyphens.
Example:
my-cluster -
-
db_cluster_parameter_group_name(Optional[String], default:None) –The name of the cluster parameter group to associate with this cluster.
-
vpc_security_group_ids(Optional[VpcSecurityGroupIdList], default:None) –A list of EC2 VPC security groups to associate with this cluster.
-
db_subnet_group_name(Optional[String], default:None) –A subnet group to associate with this cluster.
Constraints: Must match the name of an existing
DBSubnetGroup. Must not be default.Example:
mySubnetgroup -
engine(Optional[String], default:None) –The name of the database engine to be used for this cluster.
Valid values:
docdb -
engine_version(Optional[String], default:None) –The version number of the database engine to use. The
--engine-versionwill default to the latest major engine version. For production workloads, we recommend explicitly declaring this parameter with the intended major engine version. -
port(Optional[IntegerOptional], default:None) –The port number on which the instances in the cluster accept connections.
-
master_username(Optional[String], default:None) –The name of the master user for the cluster.
Constraints:
-
Must be from 1 to 63 letters or numbers.
-
The first character must be a letter.
-
Cannot be a reserved word for the chosen database engine.
-
-
master_user_password(Optional[String], default:None) –The password for the master database user. This password can contain any printable ASCII character except forward slash (/), double quote ("), or the "at" symbol (@).
Constraints: Must contain from 8 to 100 characters.
-
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.
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.
Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
Constraints: Minimum 30-minute window.
-
tags(Optional[TagList], default:None) –The tags to be assigned to the cluster.
-
storage_encrypted(Optional[BooleanOptional], default:None) –Specifies whether the cluster is encrypted.
-
kms_key_id(Optional[String], default:None) –The KMS key identifier for an encrypted cluster.
The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are creating a cluster using the same Amazon Web Services account that owns the KMS encryption key that is used to encrypt the new cluster, you can use the KMS key alias instead of the ARN for the KMS encryption key.
If an encryption key is not specified in
KmsKeyId:-
If the
StorageEncryptedparameter istrue, Amazon DocumentDB uses your default encryption key.
KMS creates the default encryption key for your Amazon Web Services account. Your Amazon Web Services account has a different default encryption key for each Amazon Web Services Regions.
-
-
pre_signed_url(Optional[String], default:None) –Not currently supported.
-
enable_cloudwatch_logs_exports(Optional[LogTypeList], default:None) –A list of log types that need to be enabled for exporting to Amazon CloudWatch Logs. You can enable audit logs or profiler logs. For more information, see Auditing Amazon DocumentDB Events and Profiling Amazon DocumentDB Operations.
-
deletion_protection(Optional[BooleanOptional], default:None) –Specifies whether this cluster can be deleted. If
DeletionProtectionis enabled, the cluster cannot be deleted unless it is modified andDeletionProtectionis disabled.DeletionProtectionprotects clusters from being accidentally deleted. -
global_cluster_identifier(Optional[GlobalClusterIdentifier], default:None) –The cluster identifier of the new global cluster.
-
storage_type(Optional[String], default:None) –The storage type to associate with the DB cluster.
For information on storage types for Amazon DocumentDB clusters, see Cluster storage configurations in the Amazon DocumentDB Developer Guide.
Valid values for storage type -
standard | iopt1Default value is
standardWhen you create an Amazon DocumentDB cluster with the storage type set to
iopt1, the storage type is returned in the response. The storage type isn't returned when you set it tostandard. -
serverless_v2_scaling_configuration(Optional[ServerlessV2ScalingConfiguration], default:None) –Contains the scaling configuration of an Amazon DocumentDB Serverless cluster.
-
manage_master_user_password(Optional[BooleanOptional], default:None) –Specifies whether to manage the master user password with Amazon Web Services Secrets Manager.
Constraint: You 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 Amazon DocumentDB 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.
-
network_type(Optional[String], default:None) –The network type of the cluster.
The network type is determined by the
DBSubnetGroupspecified for the cluster. ADBSubnetGroupcan support only the IPv4 protocol or the IPv4 and the IPv6 protocols (DUAL).For more information, see DocumentDB clusters in a VPC in the Amazon DocumentDB Developer Guide.
Valid Values:
IPV4|DUAL -
copy_tags_to_snapshot(Optional[BooleanOptional], default:None) –Specifies whether to copy all tags from the DB cluster to snapshots of the DB cluster. The default is not to copy them.
Raises:
-
DBClusterAlreadyExistsFault–You already have a cluster with the given identifier.
-
DBClusterNotFoundFault–DBClusterIdentifierdoesn't refer to an existing cluster. -
DBClusterParameterGroupNotFoundFault–DBClusterParameterGroupNamedoesn't refer to an existing cluster parameter group. -
DBClusterQuotaExceededFault–The cluster can't be created because you have reached the maximum allowed quota of clusters.
-
DBInstanceNotFoundFault–DBInstanceIdentifierdoesn't refer to an existing instance. -
DBSubnetGroupDoesNotCoverEnoughAZs–Subnets in the subnet group should cover at least two Availability Zones unless there is only one Availability Zone.
-
DBSubnetGroupNotFoundFault–DBSubnetGroupNamedoesn't refer to an existing subnet group. -
GlobalClusterNotFoundFault–The
GlobalClusterIdentifierdoesn't refer to an existing global cluster. -
InsufficientStorageClusterCapacityFault–There is not enough 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 cluster isn't in a valid state.
-
InvalidDBInstanceStateFault–The specified instance isn't in the available state.
-
InvalidDBSubnetGroupStateFault–The subnet group can't be deleted because it's in use.
-
InvalidGlobalClusterStateFault–The requested operation can't be performed while the cluster is in this state.
-
InvalidSubnet–The requested subnet is not valid, or multiple subnets were requested that are not all in a common virtual private cloud (VPC).
-
InvalidVPCNetworkStateFault–The subnet group doesn't cover all Availability Zones after it is created because of changes that were made.
-
KMSKeyNotAccessibleFault–An error occurred when accessing an KMS key.
-
NetworkTypeNotSupported–The network type is not supported by either
DBSubnetGroupor the DB engine version. -
StorageQuotaExceededFault–The request would cause you to exceed the allowed amount of storage available across all instances.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_docdb/_services/doc_db.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | |