Class DatabaseClusterFromSnapshot.Builder

java.lang.Object
software.amazon.awscdk.services.rds.DatabaseClusterFromSnapshot.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<DatabaseClusterFromSnapshot>
Enclosing class:
DatabaseClusterFromSnapshot

@Stability(Stable) public static final class DatabaseClusterFromSnapshot.Builder extends Object implements software.amazon.jsii.Builder<DatabaseClusterFromSnapshot>
A fluent builder for DatabaseClusterFromSnapshot.
  • Method Details

    • create

      @Stability(Stable) public static DatabaseClusterFromSnapshot.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of DatabaseClusterFromSnapshot.Builder.
    • engine

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder engine(IClusterEngine engine)
      What kind of database to start.

      Parameters:
      engine - What kind of database to start. This parameter is required.
      Returns:
      this
    • snapshotIdentifier

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder snapshotIdentifier(String snapshotIdentifier)
      The identifier for the DB instance snapshot or DB cluster snapshot to restore from.

      You can use either the name or the Amazon Resource Name (ARN) to specify a DB cluster snapshot. However, you can use only the ARN to specify a DB instance snapshot.

      Parameters:
      snapshotIdentifier - The identifier for the DB instance snapshot or DB cluster snapshot to restore from. This parameter is required.
      Returns:
      this
    • backtrackWindow

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder backtrackWindow(Duration backtrackWindow)
      The number of seconds to set a cluster's target backtrack window to.

      This feature is only supported by the Aurora MySQL database engine and cannot be enabled on existing clusters.

      Default: 0 seconds (no backtrack)

      Parameters:
      backtrackWindow - The number of seconds to set a cluster's target backtrack window to. This parameter is required.
      Returns:
      this
      See Also:
    • backup

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder backup(BackupProps backup)
      Backup settings.

      Default: - Backup retention period for automated backups is 1 day. Backup preferred window is set to a 30-minute window selected at random from an 8-hour block of time for each AWS Region, occurring on a random day of the week.

      Parameters:
      backup - Backup settings. This parameter is required.
      Returns:
      this
      See Also:
    • cloudwatchLogsExports

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder cloudwatchLogsExports(List<String> cloudwatchLogsExports)
      The list of log types that need to be enabled for exporting to CloudWatch Logs.

      Default: - no log exports

      Parameters:
      cloudwatchLogsExports - The list of log types that need to be enabled for exporting to CloudWatch Logs. This parameter is required.
      Returns:
      this
    • cloudwatchLogsRetention

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder cloudwatchLogsRetention(RetentionDays cloudwatchLogsRetention)
      The number of days log events are kept in CloudWatch Logs.

      When updating this property, unsetting it doesn't remove the log retention policy. To remove the retention policy, set the value to Infinity.

      Default: - logs never expire

      Parameters:
      cloudwatchLogsRetention - The number of days log events are kept in CloudWatch Logs. This parameter is required.
      Returns:
      this
    • cloudwatchLogsRetentionRole

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder cloudwatchLogsRetentionRole(IRole cloudwatchLogsRetentionRole)
      The IAM role for the Lambda function associated with the custom resource that sets the retention policy.

      Default: - a new role is created.

      Parameters:
      cloudwatchLogsRetentionRole - The IAM role for the Lambda function associated with the custom resource that sets the retention policy. This parameter is required.
      Returns:
      this
    • clusterIdentifier

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder clusterIdentifier(String clusterIdentifier)
      An optional identifier for the cluster.

      Default: - A name is automatically generated.

      Parameters:
      clusterIdentifier - An optional identifier for the cluster. This parameter is required.
      Returns:
      this
    • copyTagsToSnapshot

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder copyTagsToSnapshot(Boolean copyTagsToSnapshot)
      Whether to copy tags to the snapshot when a snapshot is created.

      Default: - true

      Parameters:
      copyTagsToSnapshot - Whether to copy tags to the snapshot when a snapshot is created. This parameter is required.
      Returns:
      this
    • credentials

      @Stability(Deprecated) @Deprecated public DatabaseClusterFromSnapshot.Builder credentials(Credentials credentials)
      Deprecated.
      use snapshotCredentials which allows to generate a new password
      (deprecated) Credentials for the administrative user.

      Note - using this prop only works with Credentials.fromPassword() with the username of the snapshot, Credentials.fromUsername() with the username and password of the snapshot or Credentials.fromSecret() with a secret containing the username and password of the snapshot.

      Default: - A username of 'admin' (or 'postgres' for PostgreSQL) and SecretsManager-generated password that **will not be applied** to the cluster, use `snapshotCredentials` for the correct behavior.

      Parameters:
      credentials - Credentials for the administrative user. This parameter is required.
      Returns:
      this
    • defaultDatabaseName

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder defaultDatabaseName(String defaultDatabaseName)
      Name of a database which is automatically created inside the cluster.

      Default: - Database is not created in cluster.

      Parameters:
      defaultDatabaseName - Name of a database which is automatically created inside the cluster. This parameter is required.
      Returns:
      this
    • deletionProtection

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder deletionProtection(Boolean deletionProtection)
      Indicates whether the DB cluster should have deletion protection enabled.

      Default: - true if `removalPolicy` is RETAIN, `undefined` otherwise, which will not enable deletion protection. To disable deletion protection after it has been enabled, you must explicitly set this value to `false`.

      Parameters:
      deletionProtection - Indicates whether the DB cluster should have deletion protection enabled. This parameter is required.
      Returns:
      this
    • domain

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder domain(String domain)
      Directory ID for associating the DB cluster with a specific Active Directory.

      Necessary for enabling Kerberos authentication. If specified, the DB cluster joins the given Active Directory, enabling Kerberos authentication. If not specified, the DB cluster will not be associated with any Active Directory, and Kerberos authentication will not be enabled.

      Default: - DB cluster is not associated with an Active Directory; Kerberos authentication is not enabled.

      Parameters:
      domain - Directory ID for associating the DB cluster with a specific Active Directory. This parameter is required.
      Returns:
      this
    • domainRole

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder domainRole(IRole domainRole)
      The IAM role to be used when making API calls to the Directory Service.

      The role needs the AWS-managed policy AmazonRDSDirectoryServiceAccess or equivalent.

      Default: - If `DatabaseClusterBaseProps.domain` is specified, a role with the `AmazonRDSDirectoryServiceAccess` policy is automatically created.

      Parameters:
      domainRole - The IAM role to be used when making API calls to the Directory Service. This parameter is required.
      Returns:
      this
    • enableDataApi

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder enableDataApi(Boolean enableDataApi)
      Whether to enable the Data API for the cluster.

      Default: - false

      Parameters:
      enableDataApi - Whether to enable the Data API for the cluster. This parameter is required.
      Returns:
      this
    • iamAuthentication

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder iamAuthentication(Boolean iamAuthentication)
      Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts.

      Default: false

      Parameters:
      iamAuthentication - Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts. This parameter is required.
      Returns:
      this
    • instanceIdentifierBase

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder instanceIdentifierBase(String instanceIdentifierBase)
      Base identifier for instances.

      Every replica is named by appending the replica number to this string, 1-based.

      Default: - clusterIdentifier is used with the word "Instance" appended. If clusterIdentifier is not provided, the identifier is automatically generated.

      Parameters:
      instanceIdentifierBase - Base identifier for instances. This parameter is required.
      Returns:
      this
    • instanceProps

      @Stability(Deprecated) @Deprecated public DatabaseClusterFromSnapshot.Builder instanceProps(InstanceProps instanceProps)
      Deprecated.
      • use writer and readers instead
      (deprecated) Settings for the individual instances that are launched.

      Parameters:
      instanceProps - Settings for the individual instances that are launched. This parameter is required.
      Returns:
      this
    • instances

      @Stability(Deprecated) @Deprecated public DatabaseClusterFromSnapshot.Builder instances(Number instances)
      Deprecated.
      • use writer and readers instead
      (deprecated) How many replicas/instances to create.

      Has to be at least 1.

      Default: 2

      Parameters:
      instances - How many replicas/instances to create. This parameter is required.
      Returns:
      this
    • instanceUpdateBehaviour

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder instanceUpdateBehaviour(InstanceUpdateBehaviour instanceUpdateBehaviour)
      The ordering of updates for instances.

      Default: InstanceUpdateBehaviour.BULK

      Parameters:
      instanceUpdateBehaviour - The ordering of updates for instances. This parameter is required.
      Returns:
      this
    • monitoringInterval

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder monitoringInterval(Duration monitoringInterval)
      The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instances.

      Default: no enhanced monitoring

      Parameters:
      monitoringInterval - The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instances. This parameter is required.
      Returns:
      this
    • monitoringRole

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder monitoringRole(IRole monitoringRole)
      Role that will be used to manage DB instances monitoring.

      Default: - A role is automatically created for you

      Parameters:
      monitoringRole - Role that will be used to manage DB instances monitoring. This parameter is required.
      Returns:
      this
    • networkType

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder networkType(NetworkType networkType)
      The network type of the DB instance.

      Default: - IPV4

      Parameters:
      networkType - The network type of the DB instance. This parameter is required.
      Returns:
      this
    • parameterGroup

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder parameterGroup(IParameterGroup parameterGroup)
      Additional parameters to pass to the database engine.

      Default: - No parameter group.

      Parameters:
      parameterGroup - Additional parameters to pass to the database engine. This parameter is required.
      Returns:
      this
    • parameters

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder parameters(Map<String,String> parameters)
      The parameters in the DBClusterParameterGroup to create automatically.

      You can only specify parameterGroup or parameters but not both. You need to use a versioned engine to auto-generate a DBClusterParameterGroup.

      Default: - None

      Parameters:
      parameters - The parameters in the DBClusterParameterGroup to create automatically. This parameter is required.
      Returns:
      this
    • port

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder port(Number port)
      What port to listen on.

      Default: - The default for the engine is used.

      Parameters:
      port - What port to listen on. This parameter is required.
      Returns:
      this
    • preferredMaintenanceWindow

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder preferredMaintenanceWindow(String preferredMaintenanceWindow)
      A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC).

      Example: 'Sun:23:45-Mon:00:15'

      Default: - 30-minute window selected at random from an 8-hour block of time for each AWS Region, occurring on a random day of the week.

      Parameters:
      preferredMaintenanceWindow - A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). This parameter is required.
      Returns:
      this
      See Also:
    • readers

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder readers(List<? extends IClusterInstance> readers)
      A list of instances to create as cluster reader instances.

      Default: - no readers are created. The cluster will have a single writer/reader

      Parameters:
      readers - A list of instances to create as cluster reader instances. This parameter is required.
      Returns:
      this
    • removalPolicy

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder removalPolicy(RemovalPolicy removalPolicy)
      The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.

      Default: - RemovalPolicy.SNAPSHOT (remove the cluster and instances, but retain a snapshot of the data)

      Parameters:
      removalPolicy - The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update. This parameter is required.
      Returns:
      this
    • s3ExportBuckets

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder s3ExportBuckets(List<? extends IBucket> s3ExportBuckets)
      S3 buckets that you want to load data into. This feature is only supported by the Aurora database engine.

      This property must not be used if s3ExportRole is used.

      For MySQL:

      Default: - None

      Parameters:
      s3ExportBuckets - S3 buckets that you want to load data into. This feature is only supported by the Aurora database engine. This parameter is required.
      Returns:
      this
      See Also:
    • s3ExportRole

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder s3ExportRole(IRole s3ExportRole)
      Role that will be associated with this DB cluster to enable S3 export.

      This feature is only supported by the Aurora database engine.

      This property must not be used if s3ExportBuckets is used.

      For MySQL:

      Default: - New role is created if `s3ExportBuckets` is set, no role is defined otherwise

      Parameters:
      s3ExportRole - Role that will be associated with this DB cluster to enable S3 export. This parameter is required.
      Returns:
      this
      See Also:
    • s3ImportBuckets

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder s3ImportBuckets(List<? extends IBucket> s3ImportBuckets)
      S3 buckets that you want to load data from. This feature is only supported by the Aurora database engine.

      This property must not be used if s3ImportRole is used.

      For MySQL:

      Default: - None

      Parameters:
      s3ImportBuckets - S3 buckets that you want to load data from. This feature is only supported by the Aurora database engine. This parameter is required.
      Returns:
      this
      See Also:
    • s3ImportRole

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder s3ImportRole(IRole s3ImportRole)
      Role that will be associated with this DB cluster to enable S3 import.

      This feature is only supported by the Aurora database engine.

      This property must not be used if s3ImportBuckets is used.

      For MySQL:

      Default: - New role is created if `s3ImportBuckets` is set, no role is defined otherwise

      Parameters:
      s3ImportRole - Role that will be associated with this DB cluster to enable S3 import. This parameter is required.
      Returns:
      this
      See Also:
    • securityGroups

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder securityGroups(List<? extends ISecurityGroup> securityGroups)
      Security group.

      Default: a new security group is created.

      Parameters:
      securityGroups - Security group. This parameter is required.
      Returns:
      this
    • serverlessV2MaxCapacity

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder serverlessV2MaxCapacity(Number serverlessV2MaxCapacity)
      The maximum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster.

      You can specify ACU values in half-step increments, such as 40, 40.5, 41, and so on. The largest value that you can use is 128 (256GB).

      The maximum capacity must be higher than 0.5 ACUs.

      Default: 2

      Parameters:
      serverlessV2MaxCapacity - The maximum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster. This parameter is required.
      Returns:
      this
      See Also:
    • serverlessV2MinCapacity

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder serverlessV2MinCapacity(Number serverlessV2MinCapacity)
      The minimum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster.

      You can specify ACU values in half-step increments, such as 8, 8.5, 9, and so on. The smallest value that you can use is 0.5.

      Default: 0.5

      Parameters:
      serverlessV2MinCapacity - The minimum number of Aurora capacity units (ACUs) for a DB instance in an Aurora Serverless v2 cluster. This parameter is required.
      Returns:
      this
      See Also:
    • snapshotCredentials

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder snapshotCredentials(SnapshotCredentials snapshotCredentials)
      Master user credentials.

      Note - It is not possible to change the master username for a snapshot; however, it is possible to provide (or generate) a new password.

      Default: - The existing username and password from the snapshot will be used.

      Parameters:
      snapshotCredentials - Master user credentials. This parameter is required.
      Returns:
      this
    • storageEncrypted

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder storageEncrypted(Boolean storageEncrypted)
      Whether to enable storage encryption.

      Default: - true if storageEncryptionKey is provided, false otherwise

      Parameters:
      storageEncrypted - Whether to enable storage encryption. This parameter is required.
      Returns:
      this
    • storageEncryptionKey

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder storageEncryptionKey(IKey storageEncryptionKey)
      The KMS key for storage encryption.

      If specified, storageEncrypted will be set to true.

      Default: - if storageEncrypted is true then the default master key, no key otherwise

      Parameters:
      storageEncryptionKey - The KMS key for storage encryption. This parameter is required.
      Returns:
      this
    • storageType

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder storageType(DBClusterStorageType storageType)
      The storage type to be associated with the DB cluster.

      Default: - DBClusterStorageType.AURORA_IOPT1

      Parameters:
      storageType - The storage type to be associated with the DB cluster. This parameter is required.
      Returns:
      this
    • subnetGroup

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder subnetGroup(ISubnetGroup subnetGroup)
      Existing subnet group for the cluster.

      Default: - a new subnet group will be created.

      Parameters:
      subnetGroup - Existing subnet group for the cluster. This parameter is required.
      Returns:
      this
    • vpc

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder vpc(IVpc vpc)
      What subnets to run the RDS instances in.

      Must be at least 2 subnets in two different AZs.

      Parameters:
      vpc - What subnets to run the RDS instances in. This parameter is required.
      Returns:
      this
    • vpcSubnets

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder vpcSubnets(SubnetSelection vpcSubnets)
      Where to place the instances within the VPC.

      Default: - the Vpc default strategy if not specified.

      Parameters:
      vpcSubnets - Where to place the instances within the VPC. This parameter is required.
      Returns:
      this
    • writer

      @Stability(Stable) public DatabaseClusterFromSnapshot.Builder writer(IClusterInstance writer)
      The instance to use for the cluster writer.

      Default: required if instanceProps is not provided

      Parameters:
      writer - The instance to use for the cluster writer. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public DatabaseClusterFromSnapshot build()
      Specified by:
      build in interface software.amazon.jsii.Builder<DatabaseClusterFromSnapshot>
      Returns:
      a newly built instance of DatabaseClusterFromSnapshot.