Class Instance
Provides an RDS instance resource. A DB instance is an isolated database environment in the cloud. A DB instance can contain multiple user-created databases.
Changes to a DB instance can occur when you manually change a parameter, such as
allocated_storage, and are reflected in the next maintenance window. Because
of this, this provider may report a difference in its planning phase because a
modification has not yet taken place. You can use the apply_immediately flag
to instruct the service to apply the change immediately (see documentation
below).
When upgrading the major version of an engine, allow_major_version_upgrade
must be set to true.
Note: using
apply_immediatelycan result in a brief downtime as the server reboots. See the AWS Docs on [RDS Maintenance][2] for more information.
Note: All arguments including the username and password will be stored in the raw state as plain-text. Read more about sensitive data in state.
RDS Instance Class Types
Amazon RDS supports three types of instance classes: Standard, Memory Optimized, and Burstable Performance. For more information please read the AWS RDS documentation about DB Instance Class Types
Example Usage
Basic Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var @default = new Aws.Rds.Instance("default", new Aws.Rds.InstanceArgs
{
AllocatedStorage = 20,
Engine = "mysql",
EngineVersion = "5.7",
InstanceClass = "db.t2.micro",
Name = "mydb",
ParameterGroupName = "default.mysql5.7",
Password = "foobarbaz",
StorageType = "gp2",
Username = "foo",
});
}
}
Storage Autoscaling
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.Rds.Instance("example", new Aws.Rds.InstanceArgs
{
AllocatedStorage = 50,
MaxAllocatedStorage = 100,
});
}
}
Inherited Members
Namespace: Pulumi.Aws.Rds
Assembly: Pulumi.Aws.dll
Syntax
public class Instance : CustomResource
Constructors
View SourceInstance(String, InstanceArgs, CustomResourceOptions)
Create a Instance resource with the given unique name, arguments, and options.
Declaration
public Instance(string name, InstanceArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| InstanceArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceAddress
The hostname of the RDS instance. See also endpoint and port.
Declaration
public Output<string> Address { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
AllocatedStorage
The allocated storage in gibibytes. If max_allocated_storage is configured, this argument represents the initial storage allocation and differences from the configuration will be ignored automatically when Storage Autoscaling occurs.
Declaration
public Output<int> AllocatedStorage { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
AllowMajorVersionUpgrade
Indicates that major version upgrades are allowed. Changing this parameter does not result in an outage and the change is asynchronously applied as soon as possible.
Declaration
public Output<bool?> AllowMajorVersionUpgrade { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
ApplyImmediately
Specifies whether any database modifications
are applied immediately, or during the next maintenance window. Default is
false. See Amazon RDS Documentation for more
information.
Declaration
public Output<bool> ApplyImmediately { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Boolean> |
Arn
The ARN of the RDS instance.
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
AutoMinorVersionUpgrade
Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window. Defaults to true.
Declaration
public Output<bool?> AutoMinorVersionUpgrade { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
AvailabilityZone
The AZ for the RDS instance.
Declaration
public Output<string> AvailabilityZone { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
BackupRetentionPeriod
The days to retain backups for. Must be
between 0 and 35. Must be greater than 0 if the database is used as a source for a Read Replica. [See Read Replica][1].
Declaration
public Output<int> BackupRetentionPeriod { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
BackupWindow
The daily time range (in UTC) during which
automated backups are created if they are enabled. Example: "09:46-10:16". Must
not overlap with maintenance_window.
Declaration
public Output<string> BackupWindow { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
CaCertIdentifier
The identifier of the CA certificate for the DB instance.
Declaration
public Output<string> CaCertIdentifier { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
CharacterSetName
The character set name to use for DB encoding in Oracle and Microsoft SQL instances (collation). This can't be changed. See Oracle Character Sets Supported in Amazon RDS or Server-Level Collation for Microsoft SQL Server for more information.
Declaration
public Output<string> CharacterSetName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
CopyTagsToSnapshot
Copy all Instance tags to snapshots. Default is false.
Declaration
public Output<bool?> CopyTagsToSnapshot { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
DbSubnetGroupName
Name of DB subnet group. DB instance will
be created in the VPC associated with the DB subnet group. If unspecified, will
be created in the default VPC, or in EC2 Classic, if available. When working
with read replicas, it should be specified only if the source database
specifies an instance in another AWS Region. See DBSubnetGroupName in API
action CreateDBInstanceReadReplica
for additional read replica contraints.
Declaration
public Output<string> DbSubnetGroupName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DeleteAutomatedBackups
Specifies whether to remove automated backups immediately after the DB instance is deleted. Default is true.
Declaration
public Output<bool?> DeleteAutomatedBackups { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
DeletionProtection
If the DB instance should have deletion protection enabled. The database can't be deleted when this value is set to true. The default is false.
Declaration
public Output<bool?> DeletionProtection { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Domain
The ID of the Directory Service Active Directory domain to create the instance in.
Declaration
public Output<string> Domain { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
DomainIamRoleName
The name of the IAM role to be used when making API calls to the Directory Service.
Declaration
public Output<string> DomainIamRoleName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
EnabledCloudwatchLogsExports
List of log types to enable for exporting to CloudWatch logs. If omitted, no logs will be exported. Valid values (depending on engine). MySQL and MariaDB: audit, error, general, slowquery. PostgreSQL: postgresql, upgrade. MSSQL: agent , error. Oracle: alert, audit, listener, trace.
Declaration
public Output<ImmutableArray<string>> EnabledCloudwatchLogsExports { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
Endpoint
The connection endpoint in address:port format.
Declaration
public Output<string> Endpoint { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Engine
(Required unless a snapshot_identifier or replicate_source_db
is provided) The database engine to use. For supported values, see the Engine parameter in API action CreateDBInstance.
Note that for Amazon Aurora instances the engine must match the DB cluster's engine'.
For information on the difference between the available Aurora MySQL engines
see Comparison between Aurora MySQL 1 and Aurora MySQL 2
in the Amazon RDS User Guide.
Declaration
public Output<string> Engine { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
EngineVersion
The engine version to use. If auto_minor_version_upgrade
is enabled, you can provide a prefix of the version such as 5.7 (for 5.7.10) and
this attribute will ignore differences in the patch version automatically (e.g. 5.7.17).
For supported values, see the EngineVersion parameter in API action CreateDBInstance.
Note that for Amazon Aurora instances the engine version must match the DB cluster's engine version'.
Declaration
public Output<string> EngineVersion { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
FinalSnapshotIdentifier
The name of your final DB snapshot
when this DB instance is deleted. Must be provided if skip_final_snapshot is
set to false.
Declaration
public Output<string> FinalSnapshotIdentifier { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
HostedZoneId
The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record).
Declaration
public Output<string> HostedZoneId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
IamDatabaseAuthenticationEnabled
Specifies whether or mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled.
Declaration
public Output<bool?> IamDatabaseAuthenticationEnabled { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Identifier
The name of the RDS instance, if omitted, this provider will assign a random, unique identifier.
Declaration
public Output<string> Identifier { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
IdentifierPrefix
Creates a unique
identifier beginning with the specified prefix. Conflicts with identifier.
Declaration
public Output<string> IdentifierPrefix { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
InstanceClass
The instance type of the RDS instance.
Declaration
public Output<string> InstanceClass { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Iops
The amount of provisioned IOPS. Setting this implies a storage_type of "io1".
Declaration
public Output<int?> Iops { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
KmsKeyId
The ARN for the KMS encryption key. If creating an encrypted replica, set this to the destination KMS ARN.
Declaration
public Output<string> KmsKeyId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
LicenseModel
(Optional, but required for some DB engines, i.e. Oracle SE1) License model information for this DB instance.
Declaration
public Output<string> LicenseModel { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
MaintenanceWindow
The window to perform maintenance in. Syntax: "ddd:hh24:mi-ddd:hh24:mi". Eg: "Mon:00:00-Mon:03:00". See RDS Maintenance Window docs for more information.
Declaration
public Output<string> MaintenanceWindow { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
MaxAllocatedStorage
When configured, the upper limit to which Amazon RDS can automatically scale the storage of the DB instance. Configuring this will automatically ignore differences to allocated_storage. Must be greater than or equal to allocated_storage or 0 to disable Storage Autoscaling.
Declaration
public Output<int?> MaxAllocatedStorage { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
MonitoringInterval
The interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60.
Declaration
public Output<int?> MonitoringInterval { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
MonitoringRoleArn
The ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. You can find more information on the AWS Documentation what IAM permissions are needed to allow Enhanced Monitoring for RDS Instances.
Declaration
public Output<string> MonitoringRoleArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
MultiAz
Specifies if the RDS instance is multi-AZ
Declaration
public Output<bool> MultiAz { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Boolean> |
Name
The name of the database to create when the DB instance is created. If this parameter is not specified, no database is created in the DB instance. Note that this does not apply for Oracle or SQL Server engines. See the AWS documentation for more details on what applies for those engines.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
OptionGroupName
Name of the DB option group to associate.
Declaration
public Output<string> OptionGroupName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ParameterGroupName
Name of the DB parameter group to associate.
Declaration
public Output<string> ParameterGroupName { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Password
(Required unless a snapshot_identifier or replicate_source_db
is provided) Password for the master DB user. Note that this may show up in
logs, and it will be stored in the state file.
Declaration
public Output<string> Password { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PerformanceInsightsEnabled
Specifies whether Performance Insights are enabled. Defaults to false.
Declaration
public Output<bool?> PerformanceInsightsEnabled { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
PerformanceInsightsKmsKeyId
The ARN for the KMS key to encrypt Performance Insights data. When specifying performance_insights_kms_key_id, performance_insights_enabled needs to be set to true. Once KMS key is set, it can never be changed.
Declaration
public Output<string> PerformanceInsightsKmsKeyId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PerformanceInsightsRetentionPeriod
The amount of time in days to retain Performance Insights data. Either 7 (7 days) or 731 (2 years). When specifying performance_insights_retention_period, performance_insights_enabled needs to be set to true. Defaults to '7'.
Declaration
public Output<int> PerformanceInsightsRetentionPeriod { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
Port
The port on which the DB accepts connections.
Declaration
public Output<int> Port { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
PubliclyAccessible
Bool to control if instance is publicly
accessible. Default is false.
Declaration
public Output<bool?> PubliclyAccessible { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Replicas
Declaration
public Output<ImmutableArray<string>> Replicas { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
ReplicateSourceDb
Specifies that this resource is a Replicate
database, and to use this value as the source database. This correlates to the
identifier of another Amazon RDS Database to replicate (if replicating within
a single region) or ARN of the Amazon RDS Database to replicate (if replicating
cross-region). Note that if you are
creating a cross-region replica of an encrypted database you will also need to
specify a kms_key_id. See [DB Instance Replication][1] and Working with
PostgreSQL and MySQL Read Replicas
for more information on using Replication.
Declaration
public Output<string> ReplicateSourceDb { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ResourceId
The RDS Resource ID of this instance.
Declaration
public Output<string> ResourceId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
S3Import
Restore from a Percona Xtrabackup in S3. See Importing Data into an Amazon RDS MySQL DB Instance
Declaration
public Output<InstanceS3Import> S3Import { get; }
Property Value
| Type | Description |
|---|---|
| Output<InstanceS3Import> |
SecurityGroupNames
List of DB Security Groups to associate. Only used for DB Instances on the EC2-Classic Platform.
Declaration
public Output<ImmutableArray<string>> SecurityGroupNames { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
SkipFinalSnapshot
Determines whether a final DB snapshot is
created before the DB instance is deleted. If true is specified, no DBSnapshot
is created. If false is specified, a DB snapshot is created before the DB
instance is deleted, using the value from final_snapshot_identifier. Default
is false.
Declaration
public Output<bool?> SkipFinalSnapshot { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
SnapshotIdentifier
Specifies whether or not to create this database from a snapshot. This correlates to the snapshot ID you'd find in the RDS console, e.g: rds:production-2015-06-26-06-05.
Declaration
public Output<string> SnapshotIdentifier { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Status
The RDS instance status.
Declaration
public Output<string> Status { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
StorageEncrypted
Specifies whether the DB instance is
encrypted. Note that if you are creating a cross-region read replica this field
is ignored and you should instead declare kms_key_id with a valid ARN. The
default is false if not specified.
Declaration
public Output<bool?> StorageEncrypted { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
StorageType
One of "standard" (magnetic), "gp2" (general
purpose SSD), or "io1" (provisioned IOPS SSD). The default is "io1" if iops is
specified, "gp2" if not.
Declaration
public Output<string> StorageType { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Tags
A map of tags to assign to the resource.
Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
Timezone
Time zone of the DB instance. timezone is currently
only supported by Microsoft SQL Server. The timezone can only be set on
creation. See MSSQL User
Guide
for more information.
Declaration
public Output<string> Timezone { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Username
(Required unless a snapshot_identifier or replicate_source_db
is provided) Username for the master DB user.
Declaration
public Output<string> Username { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
VpcSecurityGroupIds
List of VPC security groups to associate.
Declaration
public Output<ImmutableArray<string>> VpcSecurityGroupIds { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
Methods
View SourceGet(String, Input<String>, InstanceState, CustomResourceOptions)
Get an existing Instance resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Instance Get(string name, Input<string> id, InstanceState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| InstanceState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Instance |