DatabaseInstanceFromSnapshotProps¶
-
class
aws_cdk.aws_rds.
DatabaseInstanceFromSnapshotProps
(*, vpc, auto_minor_version_upgrade=None, availability_zone=None, backup_retention=None, cloudwatch_logs_exports=None, cloudwatch_logs_retention=None, cloudwatch_logs_retention_role=None, copy_tags_to_snapshot=None, delete_automated_backups=None, deletion_protection=None, domain=None, domain_role=None, enable_performance_insights=None, iam_authentication=None, instance_identifier=None, iops=None, max_allocated_storage=None, monitoring_interval=None, monitoring_role=None, multi_az=None, option_group=None, parameter_group=None, performance_insight_encryption_key=None, performance_insight_retention=None, port=None, preferred_backup_window=None, preferred_maintenance_window=None, processor_features=None, publicly_accessible=None, removal_policy=None, s3_export_buckets=None, s3_export_role=None, s3_import_buckets=None, s3_import_role=None, security_groups=None, storage_type=None, subnet_group=None, vpc_placement=None, vpc_subnets=None, engine, allocated_storage=None, allow_major_version_upgrade=None, database_name=None, instance_type=None, license_model=None, parameters=None, timezone=None, snapshot_identifier, credentials=None)¶ Bases:
aws_cdk.aws_rds.DatabaseInstanceSourceProps
Construction properties for a DatabaseInstanceFromSnapshot.
- Parameters
vpc (
IVpc
) – The VPC network where the DB subnet group should be created.auto_minor_version_upgrade (
Optional
[bool
]) – Indicates that minor engine upgrades are applied automatically to the DB instance during the maintenance window. Default: trueavailability_zone (
Optional
[str
]) – The name of the Availability Zone where the DB instance will be located. Default: - no preferencebackup_retention (
Optional
[Duration
]) – The number of days during which automatic DB snapshots are retained. Set to zero to disable backups. When creating a read replica, you must enable automatic backups on the source database instance by setting the backup retention to a value other than zero. Default: - Duration.days(1) for source instances, disabled for read replicascloudwatch_logs_exports (
Optional
[Sequence
[str
]]) – The list of log types that need to be enabled for exporting to CloudWatch Logs. Default: - no log exportscloudwatch_logs_retention (
Optional
[RetentionDays
]) – 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 toInfinity
. Default: - logs never expirecloudwatch_logs_retention_role (
Optional
[IRole
]) – The IAM role for the Lambda function associated with the custom resource that sets the retention policy. Default: - a new role is created.copy_tags_to_snapshot (
Optional
[bool
]) – Indicates whether to copy all of the user-defined tags from the DB instance to snapshots of the DB instance. Default: truedelete_automated_backups (
Optional
[bool
]) – Indicates whether automated backups should be deleted or retained when you delete a DB instance. Default: falsedeletion_protection (
Optional
[bool
]) – Indicates whether the DB instance should have deletion protection enabled. Default: - true ifremovalPolicy
is RETAIN, false otherwisedomain (
Optional
[str
]) – The Active Directory directory ID to create the DB instance in. Default: - Do not join domaindomain_role (
Optional
[IRole
]) – 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: - The role will be created for you if {@link DatabaseInstanceNewProps#domain} is specifiedenable_performance_insights (
Optional
[bool
]) – Whether to enable Performance Insights for the DB instance. Default: - false, unlessperformanceInsightRentention
orperformanceInsightEncryptionKey
is set.iam_authentication (
Optional
[bool
]) – Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts. Default: falseinstance_identifier (
Optional
[str
]) – A name for the DB instance. If you specify a name, AWS CloudFormation converts it to lowercase. Default: - a CloudFormation generated nameiops (
Union
[int
,float
,None
]) – The number of I/O operations per second (IOPS) that the database provisions. The value must be equal to or greater than 1000. Default: - no provisioned iopsmax_allocated_storage (
Union
[int
,float
,None
]) – Upper limit to which RDS can scale the storage in GiB(Gibibyte). Default: - No autoscaling of RDS instancemonitoring_interval (
Optional
[Duration
]) – The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instance. Default: - no enhanced monitoringmonitoring_role (
Optional
[IRole
]) – Role that will be used to manage DB instance monitoring. Default: - A role is automatically created for youmulti_az (
Optional
[bool
]) – Specifies if the database instance is a multiple Availability Zone deployment. Default: falseoption_group (
Optional
[IOptionGroup
]) – The option group to associate with the instance. Default: - no option groupparameter_group (
Optional
[IParameterGroup
]) – The DB parameter group to associate with the instance. Default: - no parameter groupperformance_insight_encryption_key (
Optional
[IKey
]) – The AWS KMS key for encryption of Performance Insights data. Default: - default master keyperformance_insight_retention (
Optional
[PerformanceInsightRetention
]) – The amount of time, in days, to retain Performance Insights data. Default: 7port (
Union
[int
,float
,None
]) – The port for the instance. Default: - the default port for the chosen engine.preferred_backup_window (
Optional
[str
]) – The daily time range during which automated backups are performed. Constraints: - Must be in the formathh24:mi-hh24:mi
. - Must be in Universal Coordinated Time (UTC). - Must not conflict with the preferred maintenance window. - Must be at least 30 minutes. Default: - a 30-minute window selected at random from an 8-hour block of time for each AWS Region. To see the time blocks available, see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindowpreferred_maintenance_window (
Optional
[str
]) – The weekly time range (in UTC) during which system maintenance can occur. Format:ddd:hh24:mi-ddd:hh24:mi
Constraint: Minimum 30-minute window Default: - 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. To see the time blocks available, see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenanceprocessor_features (
Optional
[ProcessorFeatures
]) – The number of CPU cores and the number of threads per core. Default: - the default number of CPU cores and threads per core for the chosen instance class. See https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#USER_ConfigureProcessorpublicly_accessible (
Optional
[bool
]) – Indicates whether the DB instance is an internet-facing instance. Default: -true
ifvpcSubnets
issubnetType: SubnetType.PUBLIC
,false
otherwiseremoval_policy (
Optional
[RemovalPolicy
]) – The CloudFormation policy to apply when the instance is removed from the stack or replaced during an update. Default: - RemovalPolicy.SNAPSHOT (remove the resource, but retain a snapshot of the data)s3_export_buckets (
Optional
[Sequence
[IBucket
]]) – S3 buckets that you want to load data into. This property must not be used ifs3ExportRole
is used. For Microsoft SQL Server: Default: - Nones3_export_role (
Optional
[IRole
]) – Role that will be associated with this DB instance to enable S3 export. This property must not be used ifs3ExportBuckets
is used. For Microsoft SQL Server: Default: - New role is created ifs3ExportBuckets
is set, no role is defined otherwises3_import_buckets (
Optional
[Sequence
[IBucket
]]) – S3 buckets that you want to load data from. This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines. This property must not be used ifs3ImportRole
is used. For Microsoft SQL Server: Default: - Nones3_import_role (
Optional
[IRole
]) – Role that will be associated with this DB instance to enable S3 import. This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines. This property must not be used ifs3ImportBuckets
is used. For Microsoft SQL Server: Default: - New role is created ifs3ImportBuckets
is set, no role is defined otherwisesecurity_groups (
Optional
[Sequence
[ISecurityGroup
]]) – The security groups to assign to the DB instance. Default: - a new security group is createdstorage_type (
Optional
[StorageType
]) – The storage type. Storage types supported are gp2, io1, standard. Default: GP2subnet_group (
Optional
[ISubnetGroup
]) – Existing subnet group for the instance. Default: - a new subnet group will be created.vpc_placement (
Optional
[SubnetSelection
]) – (deprecated) The type of subnets to add to the created DB subnet group. Default: - private subnetsvpc_subnets (
Optional
[SubnetSelection
]) – The type of subnets to add to the created DB subnet group. Default: - private subnetsengine (
IInstanceEngine
) – The database engine.allocated_storage (
Union
[int
,float
,None
]) – The allocated storage size, specified in gigabytes (GB). Default: 100allow_major_version_upgrade (
Optional
[bool
]) – Whether to allow major version upgrades. Default: falsedatabase_name (
Optional
[str
]) – The name of the database. Default: - no nameinstance_type (
Optional
[InstanceType
]) – The name of the compute and memory capacity for the instance. Default: - m5.large (or, more specifically, db.m5.large)license_model (
Optional
[LicenseModel
]) – The license model. Default: - RDS default license modelparameters (
Optional
[Mapping
[str
,str
]]) – The parameters in the DBParameterGroup to create automatically. You can only specify parameterGroup or parameters but not both. You need to use a versioned engine to auto-generate a DBParameterGroup. Default: - Nonetimezone (
Optional
[str
]) – The time zone of the instance. This is currently supported only by Microsoft Sql Server. Default: - RDS default timezonesnapshot_identifier (
str
) – The name or Amazon Resource Name (ARN) of the DB snapshot that’s used to restore the DB instance. If you’re restoring from a shared manual DB snapshot, you must specify the ARN of the snapshot.credentials (
Optional
[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.
- ExampleMetadata
infused
Example:
# vpc: ec2.Vpc # source_instance: rds.DatabaseInstance rds.DatabaseInstanceFromSnapshot(self, "Instance", snapshot_identifier="my-snapshot", engine=rds.DatabaseInstanceEngine.postgres(version=rds.PostgresEngineVersion.VER_12_3), # optional, defaults to m5.large instance_type=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), vpc=vpc ) rds.DatabaseInstanceReadReplica(self, "ReadReplica", source_database_instance=source_instance, instance_type=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.LARGE), vpc=vpc )
Attributes
-
allocated_storage
¶ The allocated storage size, specified in gigabytes (GB).
- Default
100
- Return type
Union
[int
,float
,None
]
-
allow_major_version_upgrade
¶ Whether to allow major version upgrades.
- Default
false
- Return type
Optional
[bool
]
-
auto_minor_version_upgrade
¶ Indicates that minor engine upgrades are applied automatically to the DB instance during the maintenance window.
- Default
true
- Return type
Optional
[bool
]
-
availability_zone
¶ The name of the Availability Zone where the DB instance will be located.
- Default
no preference
- Return type
Optional
[str
]
-
backup_retention
¶ The number of days during which automatic DB snapshots are retained.
Set to zero to disable backups. When creating a read replica, you must enable automatic backups on the source database instance by setting the backup retention to a value other than zero.
- Default
Duration.days(1) for source instances, disabled for read replicas
- Return type
Optional
[Duration
]
-
cloudwatch_logs_exports
¶ The list of log types that need to be enabled for exporting to CloudWatch Logs.
- Default
no log exports
- Return type
Optional
[List
[str
]]
-
cloudwatch_logs_retention
¶ 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
- Return type
Optional
[RetentionDays
]
-
cloudwatch_logs_retention_role
¶ The IAM role for the Lambda function associated with the custom resource that sets the retention policy.
- Default
a new role is created.
- Return type
Optional
[IRole
]
Indicates whether to copy all of the user-defined tags from the DB instance to snapshots of the DB instance.
- Default
true
- Return type
Optional
[bool
]
-
credentials
¶ 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.
- Return type
Optional
[SnapshotCredentials
]
-
database_name
¶ The name of the database.
- Default
no name
- Return type
Optional
[str
]
-
delete_automated_backups
¶ Indicates whether automated backups should be deleted or retained when you delete a DB instance.
- Default
false
- Return type
Optional
[bool
]
-
deletion_protection
¶ Indicates whether the DB instance should have deletion protection enabled.
- Default
true if
removalPolicy
is RETAIN, false otherwise
- Return type
Optional
[bool
]
-
domain
¶ The Active Directory directory ID to create the DB instance in.
- Default
Do not join domain
- Return type
Optional
[str
]
-
domain_role
¶ The IAM role to be used when making API calls to the Directory Service.
The role needs the AWS-managed policy AmazonRDSDirectoryServiceAccess or equivalent.
-
enable_performance_insights
¶ Whether to enable Performance Insights for the DB instance.
- Default
false, unless
performanceInsightRentention
orperformanceInsightEncryptionKey
is set.
- Return type
Optional
[bool
]
-
engine
¶ The database engine.
- Return type
-
iam_authentication
¶ Whether to enable mapping of AWS Identity and Access Management (IAM) accounts to database accounts.
- Default
false
- Return type
Optional
[bool
]
-
instance_identifier
¶ A name for the DB instance.
If you specify a name, AWS CloudFormation converts it to lowercase.
- Default
a CloudFormation generated name
- Return type
Optional
[str
]
-
instance_type
¶ The name of the compute and memory capacity for the instance.
- Default
m5.large (or, more specifically, db.m5.large)
- Return type
Optional
[InstanceType
]
-
iops
¶ The number of I/O operations per second (IOPS) that the database provisions.
The value must be equal to or greater than 1000.
- Default
no provisioned iops
- Return type
Union
[int
,float
,None
]
-
license_model
¶ The license model.
- Default
RDS default license model
- Return type
Optional
[LicenseModel
]
-
max_allocated_storage
¶ Upper limit to which RDS can scale the storage in GiB(Gibibyte).
- Default
No autoscaling of RDS instance
- See
- Return type
Union
[int
,float
,None
]
-
monitoring_interval
¶ The interval, in seconds, between points when Amazon RDS collects enhanced monitoring metrics for the DB instance.
- Default
no enhanced monitoring
- Return type
Optional
[Duration
]
-
monitoring_role
¶ Role that will be used to manage DB instance monitoring.
- Default
A role is automatically created for you
- Return type
Optional
[IRole
]
-
multi_az
¶ Specifies if the database instance is a multiple Availability Zone deployment.
- Default
false
- Return type
Optional
[bool
]
-
option_group
¶ The option group to associate with the instance.
- Default
no option group
- Return type
Optional
[IOptionGroup
]
-
parameter_group
¶ The DB parameter group to associate with the instance.
- Default
no parameter group
- Return type
Optional
[IParameterGroup
]
-
parameters
¶ The parameters in the DBParameterGroup to create automatically.
You can only specify parameterGroup or parameters but not both. You need to use a versioned engine to auto-generate a DBParameterGroup.
- Default
None
- Return type
Optional
[Mapping
[str
,str
]]
-
performance_insight_encryption_key
¶ The AWS KMS key for encryption of Performance Insights data.
- Default
default master key
- Return type
Optional
[IKey
]
-
performance_insight_retention
¶ The amount of time, in days, to retain Performance Insights data.
- Default
7
- Return type
Optional
[PerformanceInsightRetention
]
-
port
¶ The port for the instance.
- Default
the default port for the chosen engine.
- Return type
Union
[int
,float
,None
]
-
preferred_backup_window
¶ The daily time range during which automated backups are performed.
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.
- Default
a 30-minute window selected at random from an 8-hour block of
time for each AWS Region. To see the time blocks available, see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow
- Return type
Optional
[str
]
-
preferred_maintenance_window
¶ The weekly time range (in UTC) during which system maintenance can occur.
Format:
ddd:hh24:mi-ddd:hh24:mi
Constraint: Minimum 30-minute window- Default
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. To see the time blocks available, see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance
- Return type
Optional
[str
]
-
processor_features
¶ The number of CPU cores and the number of threads per core.
- Default
the default number of CPU cores and threads per core for the
chosen instance class.
- Return type
Optional
[ProcessorFeatures
]
-
publicly_accessible
¶ Indicates whether the DB instance is an internet-facing instance.
- Default
true
ifvpcSubnets
issubnetType: SubnetType.PUBLIC
,false
otherwise
- Return type
Optional
[bool
]
-
removal_policy
¶ The CloudFormation policy to apply when the instance is removed from the stack or replaced during an update.
- Default
RemovalPolicy.SNAPSHOT (remove the resource, but retain a snapshot of the data)
- Return type
Optional
[RemovalPolicy
]
-
s3_export_buckets
¶ S3 buckets that you want to load data into.
This property must not be used if
s3ExportRole
is used.For Microsoft SQL Server:
- Default
None
- See
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html
- Return type
Optional
[List
[IBucket
]]
-
s3_export_role
¶ Role that will be associated with this DB instance to enable S3 export.
This property must not be used if
s3ExportBuckets
is used.For Microsoft SQL Server:
- Default
New role is created if
s3ExportBuckets
is set, no role is defined otherwise
- See
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-s3-integration.html
- Return type
Optional
[IRole
]
-
s3_import_buckets
¶ S3 buckets that you want to load data from.
This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines.
This property must not be used if
s3ImportRole
is used.For Microsoft SQL Server:
- Default
None
- See
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html
- Return type
Optional
[List
[IBucket
]]
-
s3_import_role
¶ Role that will be associated with this DB instance to enable S3 import.
This feature is only supported by the Microsoft SQL Server, Oracle, and PostgreSQL engines.
This property must not be used if
s3ImportBuckets
is used.For Microsoft SQL Server:
- Default
New role is created if
s3ImportBuckets
is set, no role is defined otherwise
- See
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html
- Return type
Optional
[IRole
]
-
security_groups
¶ The security groups to assign to the DB instance.
- Default
a new security group is created
- Return type
Optional
[List
[ISecurityGroup
]]
-
snapshot_identifier
¶ The name or Amazon Resource Name (ARN) of the DB snapshot that’s used to restore the DB instance.
If you’re restoring from a shared manual DB snapshot, you must specify the ARN of the snapshot.
- Return type
str
-
storage_type
¶ The storage type.
Storage types supported are gp2, io1, standard.
- Default
GP2
- See
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD
- Return type
Optional
[StorageType
]
-
subnet_group
¶ Existing subnet group for the instance.
- Default
a new subnet group will be created.
- Return type
Optional
[ISubnetGroup
]
-
timezone
¶ The time zone of the instance.
This is currently supported only by Microsoft Sql Server.
- Default
RDS default timezone
- Return type
Optional
[str
]
-
vpc_placement
¶ (deprecated) The type of subnets to add to the created DB subnet group.
- Default
private subnets
- Deprecated
use
vpcSubnets
- Stability
deprecated
- Return type
Optional
[SubnetSelection
]
-
vpc_subnets
¶ The type of subnets to add to the created DB subnet group.
- Default
private subnets
- Return type
Optional
[SubnetSelection
]