AWS Fundamentals Logo
AWS Fundamentals
AWS::RDS::DBInstance

RDS DBInstance

The AWS::RDS::DBInstance resource creates an Amazon DB instance. The new DB instance can be an RDS DB instance, or it can be a DB instance in an Aurora DB cluster. For more information about creating an RDS DB instance, see [Creating an Amazon RDS DB instance](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CreateDBInstance.html) in the *Amazon RDS User Guide*. For more information about creating a DB instance in an Aurora DB cluster, see [Creating an Amazon Aurora DB cluster](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.CreateInstance.html) in the *Amazon Aurora User Guide*. If you import an existing DB instance, and the template configuration doesn't match the actual configuration of the DB instance, AWS CloudFormation applies the changes in the template during the import operation. If a DB instance is deleted or replaced during an update, AWS CloudFormation deletes all automated snapshots. However, it retains manual DB snapshots. During an update that requires replacement, you can apply a stack policy to prevent DB instances from being replaced. For more information, see [Prevent Updates to Stack Resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/protect-stack-resources.html). *Updating DB instances* When properties labeled "*Update requires:*[Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)" are updated, AWS CloudFormation first creates a replacement DB instance, then changes references from other dependent resources to point to the replacement DB instance, and finally deletes the old DB instance. We highly recommend that you take a snapshot of the database before updating the stack. If you don't, you lose the data when AWS CloudFormation replaces your DB instance. To preserve your data, perform the following procedure: 1. Deactivate any applications that are using the DB instance so that there's no activity on the DB instance. 1. Create a snapshot of the DB instance. For more information, see [Creating a DB Snapshot](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CreateSnapshot.html). 1. If you want to restore your instance using a DB snapshot, modify the updated template with your DB instance changes and add the DBSnapshotIdentifier property with the ID of the DB snapshot that you want to use. After you restore a DB instance with a DBSnapshotIdentifier property, you can delete the DBSnapshotIdentifier property. When you specify this property for an update, the DB instance is not restored from the DB snapshot again, and the data in the database is not changed. However, if you don't specify the DBSnapshotIdentifier property, an empty DB instance is created, and the original DB instance is deleted. If you specify a property that is different from the previous snapshot restore property, a new DB instance is restored from the specified DBSnapshotIdentifier property, and the original DB instance is deleted. 1. Update the stack. For more information about updating other properties of this resource, see ModifyDBInstance. For more information about updating stacks, see [CloudFormation Stacks Updates](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks.html). *Deleting DB instances* For DB instances that are part of an Aurora DB cluster, you can set a deletion policy for your DB instance to control how AWS CloudFormation handles the DB instance when the stack is deleted. For Amazon RDS DB instances, you can choose to *retain* the DB instance, to *delete* the DB instance, or to *create a snapshot* of the DB instance. The default AWS CloudFormation behavior depends on the DBClusterIdentifier property: 1. For AWS::RDS::DBInstance resources that don't specify the DBClusterIdentifier property, AWS CloudFormation saves a snapshot of the DB instance. 1. For AWS::RDS::DBInstance resources that do specify the DBClusterIdentifier property, AWS CloudFormation deletes the DB instance. For more information, see [DeletionPolicy Attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html).

Properties

83 configurable properties. Click a row to see details.

Filter:
PropertyTypeFlags
AdditionalStorageVolumes
Array<AdditionalStorageVolume>
AllocatedStorage
string
AllowMajorVersionUpgrade
boolean
Write-only
ApplyImmediately
boolean
Write-only
AssociatedRoles
Array<DBInstanceRole>
AutomaticBackupReplicationKmsKeyId
string
Write-only
AutomaticBackupReplicationRegion
string
AutomaticBackupReplicationRetentionPeriod
integer
AutoMinorVersionUpgrade
boolean
AvailabilityZone
string
BackupRetentionPeriod
integer
BackupTarget
string
Create-only
CACertificateIdentifier
string
CertificateRotationRestart
boolean
Write-only
CharacterSetName
string
Create-only
CopyTagsToSnapshot
boolean
CustomIAMInstanceProfile
string
Create-only
DatabaseInsightsMode
string
DBClusterIdentifier
string
Create-only
DBClusterSnapshotIdentifier
string
DBInstanceClass
string
DBInstanceIdentifier
string
Create-only
DBName
string
Create-only
DBParameterGroupName
string
DBSecurityGroups
Array<string>
DBSnapshotIdentifier
string
Write-only
DBSubnetGroupName
string
Create-only
DBSystemId
string
Create-only
DedicatedLogVolume
boolean
DeleteAutomatedBackups
boolean
Write-only
DeletionProtection
boolean
Domain
string
DomainAuthSecretArn
string
DomainDnsIps
Array<string>
DomainFqdn
string
DomainIAMRoleName
string
DomainOu
string
EnableCloudwatchLogsExports
Array<string>
EnableIAMDatabaseAuthentication
boolean
EnablePerformanceInsights
boolean
Engine
string
EngineLifecycleSupport
string
EngineVersion
string
Iops
integer
KmsKeyId
string
Create-only
LicenseModel
string
ManageMasterUserPassword
boolean
MasterUserAuthenticationType
string
Write-only
MasterUsername
string
Create-only
MasterUserPassword
string
Write-only
MasterUserSecret
MasterUserSecret
MaxAllocatedStorage
integer
MonitoringInterval
integer
MonitoringRoleArn
string
MultiAZ
boolean
NcharCharacterSetName
string
Create-only
NetworkType
string
OptionGroupName
string
PerformanceInsightsKMSKeyId
string
PerformanceInsightsRetentionPeriod
integer
Port
string
PreferredBackupWindow
string
PreferredMaintenanceWindow
string
ProcessorFeatures
Array<ProcessorFeature>
PromotionTier
integer
PubliclyAccessible
boolean
ReplicaMode
string
RestoreTime
string
Write-only
SourceDBClusterIdentifier
string
SourceDBInstanceAutomatedBackupsArn
string
Write-only
SourceDBInstanceIdentifier
string
Write-only
SourceDbiResourceId
string
Write-only
SourceRegion
string
Create-onlyWrite-only
StorageEncrypted
boolean
Create-only
StorageThroughput
integer
StorageType
string
Tags
Array<Tag>
TdeCredentialArn
string
Deprecated
TdeCredentialPassword
string
Write-onlyDeprecated
Timezone
string
Create-only
UseDefaultProcessorFeatures
boolean
Write-only
UseLatestRestorableTime
boolean
Write-only
VPCSecurityGroups
Array<string>

Return Values

Values returned after the resource is created. Access these with Fn::GetAtt.

AttributeTypeDescription
AutomaticRestartTimestring-
CertificateDetailsCertificateDetails-
DBInstanceArnstring-
DBInstanceStatusstring-
DbiResourceIdstring-
EndpointEndpoint-
InstanceCreateTimestring-
IsStorageConfigUpgradeAvailableboolean-
LatestRestorableTimestring-
ListenerEndpointEndpoint-
PercentProgressstring-
ReadReplicaDBClusterIdentifiersArray<string>-
ReadReplicaDBInstanceIdentifiersArray<string>-
ResumeFullAutomationModeTimestring-
SecondaryAvailabilityZonestring-
StatusInfosArray<DBInstanceStatusInfo>-

Sample CloudFormation Template

A minimal template with required properties and common optional ones.

template.yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: Sample template for AWS::RDS::DBInstance

Resources:
  MyResource:
    Type: AWS::RDS::DBInstance
    Properties:
      Tags:
        - Key: Environment
          Value: Production

Required IAM Permissions

Permissions CloudFormation needs in your IAM role to manage this resource.

create

ec2:DescribeAccountAttributesec2:DescribeAvailabilityZonesec2:DescribeInternetGatewaysec2:DescribeSecurityGroupsec2:DescribeSubnetsec2:DescribeVpcAttributeec2:DescribeVpcsiam:CreateServiceLinkedRoleiam:GetRoleiam:ListRolesiam:PassRolekms:CreateGrantkms:DescribeKeyrds:AddRoleToDBInstancerds:AddTagsToResourcerds:CreateDBInstancerds:CreateDBInstanceReadReplicards:DescribeDBInstancesrds:DescribeDBClustersrds:DescribeDBClusterSnapshotsrds:DescribeDBInstanceAutomatedBackupsrds:DescribeDBSnapshotsrds:DescribeEventsrds:ModifyDBInstancerds:RebootDBInstancerds:RestoreDBInstanceFromDBSnapshotrds:RestoreDBInstanceToPointInTimerds:StartDBInstanceAutomatedBackupsReplicationsecretsmanager:CreateSecretsecretsmanager:TagResource

read

ec2:DescribeAccountAttributesec2:DescribeAvailabilityZonesec2:DescribeInternetGatewaysec2:DescribeSecurityGroupsec2:DescribeSubnetsec2:DescribeVpcAttributeec2:DescribeVpcsrds:DescribeDBInstances

update

ec2:DescribeAccountAttributesec2:DescribeAvailabilityZonesec2:DescribeInternetGatewaysec2:DescribeSecurityGroupsec2:DescribeSubnetsec2:DescribeVpcAttributeec2:DescribeVpcsiam:CreateServiceLinkedRoleiam:GetRoleiam:ListRolesiam:PassRolekms:CreateGrantkms:DescribeKeyrds:AddRoleToDBInstancerds:AddTagsToResourcerds:DescribeDBClustersrds:DescribeDBEngineVersionsrds:DescribeDBInstancesrds:DescribeDBParameterGroupsrds:DescribeDBInstanceAutomatedBackupsrds:DescribeEventsrds:ModifyDBInstancerds:PromoteReadReplicards:RebootDBInstancerds:RemoveRoleFromDBInstancerds:RemoveTagsFromResourcerds:StartDBInstanceAutomatedBackupsReplicationrds:StopDBInstanceAutomatedBackupsReplicationsecretsmanager:CreateSecretsecretsmanager:TagResource

delete

rds:AddTagsToResourcerds:CreateDBSnapshotrds:DeleteDBInstancerds:DescribeDBInstances

list

rds:DescribeDBInstances

Get the RDS Cheat Sheet

Everything you need to know about RDS on one page. HD quality, print-friendly.

Download Free Infographic

Quick Facts

ServiceRDS
Properties99
Required0
TaggingSupported
Primary IDDBInstanceIdentifier

Supported Operations

CreateReadUpdateDeleteList

Immutable After Creation

These properties cannot be changed after the resource is created. Updating them triggers a replacement.

BackupTargetCharacterSetNameCustomIAMInstanceProfileDBClusterIdentifierDBInstanceIdentifierDBNameDBSubnetGroupNameDBSystemIdKmsKeyIdMasterUsernameNcharCharacterSetNameSourceRegionStorageEncryptedTimezone

External Links