# InstanceProps

Instance properties for database instances.

- Source: [`aws-rds/lib/props.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-rds/lib/props.ts#L10)
- Type last changed: v2.132.0 · 9 Mar 2024

## Example

TypeScript:

```ts
declare const vpc: ec2.Vpc;
const cluster = new rds.DatabaseCluster(this, 'Database', {
  engine: rds.DatabaseClusterEngine.auroraMysql({
    version: rds.AuroraMysqlEngineVersion.VER_3_03_0,
  }),
  instances: 2,
  instanceProps: {
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL),
    vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC },
    vpc,
  },
});
```

Python:

```python
# vpc: ec2.Vpc

cluster = rds.DatabaseCluster(self, "Database",
    engine=rds.DatabaseClusterEngine.aurora_mysql(
        version=rds.AuroraMysqlEngineVersion.VER_3_03_0
    ),
    instances=2,
    instance_props=rds.InstanceProps(
        instance_type=ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL),
        vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PUBLIC),
        vpc=vpc
    )
)
```

Java:

```java
Vpc vpc;

DatabaseCluster cluster = DatabaseCluster.Builder.create(this, "Database")
        .engine(DatabaseClusterEngine.auroraMysql(AuroraMysqlClusterEngineProps.builder()
                .version(AuroraMysqlEngineVersion.VER_3_03_0)
                .build()))
        .instances(2)
        .instanceProps(InstanceProps.builder()
                .instanceType(InstanceType.of(InstanceClass.BURSTABLE3, InstanceSize.SMALL))
                .vpcSubnets(SubnetSelection.builder().subnetType(SubnetType.PUBLIC).build())
                .vpc(vpc)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;

var cluster = new DatabaseCluster(this, "Database", new DatabaseClusterProps {
    Engine = DatabaseClusterEngine.AuroraMysql(new AuroraMysqlClusterEngineProps {
        Version = AuroraMysqlEngineVersion.VER_3_03_0
    }),
    Instances = 2,
    InstanceProps = new InstanceProps {
        InstanceType = InstanceType.Of(InstanceClass.BURSTABLE3, InstanceSize.SMALL),
        VpcSubnets = new SubnetSelection { SubnetType = SubnetType.PUBLIC },
        Vpc = vpc
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc

cluster := rds.NewDatabaseCluster(this, jsii.String("Database"), &DatabaseClusterProps{
	Engine: rds.DatabaseClusterEngine_AuroraMysql(&AuroraMysqlClusterEngineProps{
		Version: rds.AuroraMysqlEngineVersion_VER_3_03_0(),
	}),
	Instances: jsii.Number(2),
	InstanceProps: &InstanceProps{
		InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_BURSTABLE3, ec2.InstanceSize_SMALL),
		VpcSubnets: &SubnetSelection{
			SubnetType: ec2.SubnetType_PUBLIC,
		},
		Vpc: *Vpc,
	},
})
```

## Properties

- `allowMajorVersionUpgrade`: boolean = false — Whether to allow upgrade of major version for the DB instance.

- `autoMinorVersionUpgrade`: boolean = true — Whether to enable automatic upgrade of minor version for the DB instance.

- `deleteAutomatedBackups`: boolean = true — Whether to remove automated backups immediately after the DB instance is deleted for the DB instance.

- `enablePerformanceInsights`: boolean — Whether to enable Performance Insights for the DB instance.

  **Default:** false, unless ``performanceInsightRetention`` or ``performanceInsightEncryptionKey`` is set.

- `instanceType`: [InstanceType](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InstanceType.html) — What type of instance to start for the replicas.

  **Default:** t3.medium (or, more precisely, db.t3.medium)

- `parameterGroup`: [IParameterGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.IParameterGroup.html) — The DB parameter group to associate with the instance.

  **Default:** no parameter group

- `parameters`: { [key: string]: string } = None — 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.

- `performanceInsightEncryptionKey`: [IKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — The AWS KMS key for encryption of Performance Insights data.

  **Default:** default master key

- `performanceInsightRetention`: [PerformanceInsightRetention](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_rds.PerformanceInsightRetention.html) = 7 — The amount of time, in days, to retain Performance Insights data.

- `preferredMaintenanceWindow`: string — A preferred maintenance window day/time range. Should be specified as a range ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC).

  **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.

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

- `publiclyAccessible`: boolean — Indicates whether the DB instance is an internet-facing instance.

  **Default:** `true` if `vpcSubnets` is `subnetType: SubnetType.PUBLIC`, `false` otherwise

- `securityGroups`: [ISecurityGroup](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html)[] — Security group.

  **Default:** a new security group is created.

- `vpc`: [IVpc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) (required) — What subnets to run the RDS instances in.

  Must be at least 2 subnets in two different AZs.

- `vpcSubnets`: [SubnetSelection](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SubnetSelection.html) — Where to place the instances within the VPC.

  **Default:** the Vpc default strategy if not specified.
