Class DatabaseInstanceFromSnapshot
A database instance restored from a snapshot.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.RDS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class DatabaseInstanceFromSnapshot : DatabaseInstanceBase, IDatabaseInstance, IResource, IConnectable, ISecretAttachmentTarget, IDBInstanceRef, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class DatabaseInstanceFromSnapshot Inherits DatabaseInstanceBase Implements IDatabaseInstance, IResource, IConnectable, ISecretAttachmentTarget, IDBInstanceRef, IConstruct, IDependable, IEnvironmentAware
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
Examples
Vpc vpc;
var engine = DatabaseInstanceEngine.Postgres(new PostgresInstanceEngineProps { Version = PostgresEngineVersion.VER_16_3 });
var myKey = new Key(this, "MyKey");
new DatabaseInstanceFromSnapshot(this, "InstanceFromSnapshotWithCustomizedSecret", new DatabaseInstanceFromSnapshotProps {
Engine = engine,
Vpc = vpc,
SnapshotIdentifier = "mySnapshot",
Credentials = SnapshotCredentials.FromGeneratedSecret("username", new SnapshotCredentialsFromGeneratedPasswordOptions {
EncryptionKey = myKey,
ExcludeCharacters = "!&*^#@()",
ReplicaRegions = new [] { new ReplicaRegion { Region = "eu-west-1" }, new ReplicaRegion { Region = "eu-west-2" } }
})
});
Synopsis
Constructors
| DatabaseInstanceFromSnapshot(Construct, string, IDatabaseInstanceFromSnapshotProps) | A database instance restored from a snapshot. |
Properties
| CloudwatchLogGroups | The log group is created when |
| Connections | Access to network connections. |
| DbInstanceEndpointAddress | The instance endpoint address. |
| DbInstanceEndpointPort | The instance endpoint port. |
| EnableIamAuthentication | A database instance restored from a snapshot. |
| Engine | The engine of this database Instance. |
| InstanceEndpoint | The instance endpoint. |
| InstanceIdentifier | The instance identifier. |
| InstanceResourceId | The AWS Region-unique, immutable identifier for the DB instance. |
| InstanceType | A database instance restored from a snapshot. |
| NewCfnProps | A database instance restored from a snapshot. |
| PROPERTY_INJECTION_ID | Uniquely identifies this class. |
| Secret | The AWS Secrets Manager secret attached to the instance. |
| SourceCfnProps | A database instance restored from a snapshot. |
| Vpc | The VPC where this database instance is deployed. |
| VpcPlacement | A database instance restored from a snapshot. |
Methods
| AddRotationMultiUser(string, IRotationMultiUserOptions) | Adds the multi user rotation to this instance. |
| AddRotationSingleUser(IRotationSingleUserOptions?) | Adds the single user rotation of the master password to this instance. |
| GrantConnect(IGrantable, string?) | Grant the given identity connection access to the database. |
| SetLogRetention() | A database instance restored from a snapshot. |
Constructors
DatabaseInstanceFromSnapshot(Construct, string, IDatabaseInstanceFromSnapshotProps)
A database instance restored from a snapshot.
public DatabaseInstanceFromSnapshot(Construct scope, string id, IDatabaseInstanceFromSnapshotProps props)
Parameters
- scope Construct
- id string
- props IDatabaseInstanceFromSnapshotProps
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
Examples
Vpc vpc;
var engine = DatabaseInstanceEngine.Postgres(new PostgresInstanceEngineProps { Version = PostgresEngineVersion.VER_16_3 });
var myKey = new Key(this, "MyKey");
new DatabaseInstanceFromSnapshot(this, "InstanceFromSnapshotWithCustomizedSecret", new DatabaseInstanceFromSnapshotProps {
Engine = engine,
Vpc = vpc,
SnapshotIdentifier = "mySnapshot",
Credentials = SnapshotCredentials.FromGeneratedSecret("username", new SnapshotCredentialsFromGeneratedPasswordOptions {
EncryptionKey = myKey,
ExcludeCharacters = "!&*^#@()",
ReplicaRegions = new [] { new ReplicaRegion { Region = "eu-west-1" }, new ReplicaRegion { Region = "eu-west-2" } }
})
});
Properties
CloudwatchLogGroups
The log group is created when cloudwatchLogsExports is set.
public virtual IDictionary<string, ILogGroup> CloudwatchLogGroups { get; }
Property Value
IDictionary<string, ILogGroup>
Remarks
Each export value will create a separate log group.
Connections
Access to network connections.
public override Connections_ Connections { get; }
Property Value
Overrides
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
DbInstanceEndpointAddress
The instance endpoint address.
public override string DbInstanceEndpointAddress { get; }
Property Value
Overrides
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
DbInstanceEndpointPort
The instance endpoint port.
public override string DbInstanceEndpointPort { get; }
Property Value
Overrides
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
EnableIamAuthentication
A database instance restored from a snapshot.
protected override bool? EnableIamAuthentication { get; set; }
Property Value
bool?
Overrides
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
Engine
The engine of this database Instance.
public override IInstanceEngine? Engine { get; }
Property Value
Overrides
Remarks
May be not known for imported Instances if it wasn't provided explicitly, or for read replicas.
InstanceEndpoint
The instance endpoint.
public override Endpoint InstanceEndpoint { get; }
Property Value
Overrides
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
InstanceIdentifier
The instance identifier.
public override string InstanceIdentifier { get; }
Property Value
Overrides
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
InstanceResourceId
The AWS Region-unique, immutable identifier for the DB instance.
public override string? InstanceResourceId { get; }
Property Value
Overrides
Remarks
This identifier is found in AWS CloudTrail log entries whenever the AWS KMS key for the DB instance is accessed.
InstanceType
A database instance restored from a snapshot.
protected virtual InstanceType InstanceType { get; }
Property Value
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
Examples
Vpc vpc;
var engine = DatabaseInstanceEngine.Postgres(new PostgresInstanceEngineProps { Version = PostgresEngineVersion.VER_16_3 });
var myKey = new Key(this, "MyKey");
new DatabaseInstanceFromSnapshot(this, "InstanceFromSnapshotWithCustomizedSecret", new DatabaseInstanceFromSnapshotProps {
Engine = engine,
Vpc = vpc,
SnapshotIdentifier = "mySnapshot",
Credentials = SnapshotCredentials.FromGeneratedSecret("username", new SnapshotCredentialsFromGeneratedPasswordOptions {
EncryptionKey = myKey,
ExcludeCharacters = "!&*^#@()",
ReplicaRegions = new [] { new ReplicaRegion { Region = "eu-west-1" }, new ReplicaRegion { Region = "eu-west-2" } }
})
});
NewCfnProps
A database instance restored from a snapshot.
protected virtual ICfnDBInstanceProps NewCfnProps { get; }
Property Value
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
Examples
Vpc vpc;
var engine = DatabaseInstanceEngine.Postgres(new PostgresInstanceEngineProps { Version = PostgresEngineVersion.VER_16_3 });
var myKey = new Key(this, "MyKey");
new DatabaseInstanceFromSnapshot(this, "InstanceFromSnapshotWithCustomizedSecret", new DatabaseInstanceFromSnapshotProps {
Engine = engine,
Vpc = vpc,
SnapshotIdentifier = "mySnapshot",
Credentials = SnapshotCredentials.FromGeneratedSecret("username", new SnapshotCredentialsFromGeneratedPasswordOptions {
EncryptionKey = myKey,
ExcludeCharacters = "!&*^#@()",
ReplicaRegions = new [] { new ReplicaRegion { Region = "eu-west-1" }, new ReplicaRegion { Region = "eu-west-2" } }
})
});
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
Secret
The AWS Secrets Manager secret attached to the instance.
public virtual ISecret? Secret { get; }
Property Value
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
SourceCfnProps
A database instance restored from a snapshot.
protected virtual ICfnDBInstanceProps SourceCfnProps { get; }
Property Value
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
Examples
Vpc vpc;
var engine = DatabaseInstanceEngine.Postgres(new PostgresInstanceEngineProps { Version = PostgresEngineVersion.VER_16_3 });
var myKey = new Key(this, "MyKey");
new DatabaseInstanceFromSnapshot(this, "InstanceFromSnapshotWithCustomizedSecret", new DatabaseInstanceFromSnapshotProps {
Engine = engine,
Vpc = vpc,
SnapshotIdentifier = "mySnapshot",
Credentials = SnapshotCredentials.FromGeneratedSecret("username", new SnapshotCredentialsFromGeneratedPasswordOptions {
EncryptionKey = myKey,
ExcludeCharacters = "!&*^#@()",
ReplicaRegions = new [] { new ReplicaRegion { Region = "eu-west-1" }, new ReplicaRegion { Region = "eu-west-2" } }
})
});
Vpc
The VPC where this database instance is deployed.
public virtual IVpc Vpc { get; }
Property Value
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
VpcPlacement
A database instance restored from a snapshot.
protected virtual ISubnetSelection? VpcPlacement { get; }
Property Value
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
Examples
Vpc vpc;
var engine = DatabaseInstanceEngine.Postgres(new PostgresInstanceEngineProps { Version = PostgresEngineVersion.VER_16_3 });
var myKey = new Key(this, "MyKey");
new DatabaseInstanceFromSnapshot(this, "InstanceFromSnapshotWithCustomizedSecret", new DatabaseInstanceFromSnapshotProps {
Engine = engine,
Vpc = vpc,
SnapshotIdentifier = "mySnapshot",
Credentials = SnapshotCredentials.FromGeneratedSecret("username", new SnapshotCredentialsFromGeneratedPasswordOptions {
EncryptionKey = myKey,
ExcludeCharacters = "!&*^#@()",
ReplicaRegions = new [] { new ReplicaRegion { Region = "eu-west-1" }, new ReplicaRegion { Region = "eu-west-2" } }
})
});
Methods
AddRotationMultiUser(string, IRotationMultiUserOptions)
Adds the multi user rotation to this instance.
public virtual SecretRotation AddRotationMultiUser(string id, IRotationMultiUserOptions options)
Parameters
- id string
- options IRotationMultiUserOptions
Returns
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
AddRotationSingleUser(IRotationSingleUserOptions?)
Adds the single user rotation of the master password to this instance.
public virtual SecretRotation AddRotationSingleUser(IRotationSingleUserOptions? options = null)
Parameters
- options IRotationSingleUserOptions
the options for the rotation, if you want to override the defaults.
Returns
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
GrantConnect(IGrantable, string?)
Grant the given identity connection access to the database.
public override Grant GrantConnect(IGrantable grantee, string? dbUser = null)
Parameters
- grantee IGrantable
the Principal to grant the permissions to.
- dbUser string
the name of the database user to allow connecting as to the db instance, or the default database user, obtained from the Secret, if not specified.
Returns
Overrides
Remarks
[disable-awslint:no-grants]
SetLogRetention()
A database instance restored from a snapshot.
protected virtual void SetLogRetention()
Remarks
Resource: AWS::RDS::DBInstance
ExampleMetadata: infused
Examples
Vpc vpc;
var engine = DatabaseInstanceEngine.Postgres(new PostgresInstanceEngineProps { Version = PostgresEngineVersion.VER_16_3 });
var myKey = new Key(this, "MyKey");
new DatabaseInstanceFromSnapshot(this, "InstanceFromSnapshotWithCustomizedSecret", new DatabaseInstanceFromSnapshotProps {
Engine = engine,
Vpc = vpc,
SnapshotIdentifier = "mySnapshot",
Credentials = SnapshotCredentials.FromGeneratedSecret("username", new SnapshotCredentialsFromGeneratedPasswordOptions {
EncryptionKey = myKey,
ExcludeCharacters = "!&*^#@()",
ReplicaRegions = new [] { new ReplicaRegion { Region = "eu-west-1" }, new ReplicaRegion { Region = "eu-west-2" } }
})
});