Show / Hide Table of Contents

Namespace Pulumi.Aws.Rds

Classes

Cluster

Manages a RDS Aurora Cluster. To manage cluster instances that inherit configuration from the cluster (when not running the cluster in serverless engine mode), see the aws.rds.ClusterInstance resource. To manage non-Aurora databases (e.g. MySQL, PostgreSQL, SQL Server, etc.), see the aws.rds.Instance resource.

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.

Changes to an RDS Cluster can occur when you manually change a parameter, such as port, 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).

Note: using apply_immediately can result in a brief downtime as the server reboots. See the AWS Docs on RDS Maintenance 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.

Example Usage

Aurora MySQL 2.x (MySQL 5.7)

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var @default = new Aws.Rds.Cluster("default", new Aws.Rds.ClusterArgs
    {
        AvailabilityZones = 
        {
            "us-west-2a",
            "us-west-2b",
            "us-west-2c",
        },
        BackupRetentionPeriod = 5,
        ClusterIdentifier = "aurora-cluster-demo",
        DatabaseName = "mydb",
        Engine = "aurora-mysql",
        EngineVersion = "5.7.mysql_aurora.2.03.2",
        MasterPassword = "bar",
        MasterUsername = "foo",
        PreferredBackupWindow = "07:00-09:00",
    });
}

}

Aurora MySQL 1.x (MySQL 5.6)

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var @default = new Aws.Rds.Cluster("default", new Aws.Rds.ClusterArgs
    {
        AvailabilityZones = 
        {
            "us-west-2a",
            "us-west-2b",
            "us-west-2c",
        },
        BackupRetentionPeriod = 5,
        ClusterIdentifier = "aurora-cluster-demo",
        DatabaseName = "mydb",
        MasterPassword = "bar",
        MasterUsername = "foo",
        PreferredBackupWindow = "07:00-09:00",
    });
}

}

Aurora with PostgreSQL engine

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var postgresql = new Aws.Rds.Cluster("postgresql", new Aws.Rds.ClusterArgs
    {
        AvailabilityZones = 
        {
            "us-west-2a",
            "us-west-2b",
            "us-west-2c",
        },
        BackupRetentionPeriod = 5,
        ClusterIdentifier = "aurora-cluster-demo",
        DatabaseName = "mydb",
        Engine = "aurora-postgresql",
        MasterPassword = "bar",
        MasterUsername = "foo",
        PreferredBackupWindow = "07:00-09:00",
    });
}

}

Aurora Multi-Master Cluster

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = new Aws.Rds.Cluster("example", new Aws.Rds.ClusterArgs
    {
        ClusterIdentifier = "example",
        DbSubnetGroupName = aws_db_subnet_group.Example.Name,
        EngineMode = "multimaster",
        MasterPassword = "barbarbarbar",
        MasterUsername = "foo",
        SkipFinalSnapshot = true,
    });
}

}

ClusterArgs

ClusterEndpoint

Manages an RDS Aurora Cluster Endpoint. You can refer to the User Guide.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var @default = new Aws.Rds.Cluster("default", new Aws.Rds.ClusterArgs
    {
        AvailabilityZones = 
        {
            "us-west-2a",
            "us-west-2b",
            "us-west-2c",
        },
        BackupRetentionPeriod = 5,
        ClusterIdentifier = "aurora-cluster-demo",
        DatabaseName = "mydb",
        MasterPassword = "bar",
        MasterUsername = "foo",
        PreferredBackupWindow = "07:00-09:00",
    });
    var test1 = new Aws.Rds.ClusterInstance("test1", new Aws.Rds.ClusterInstanceArgs
    {
        ApplyImmediately = true,
        ClusterIdentifier = @default.Id,
        Identifier = "test1",
        InstanceClass = "db.t2.small",
    });
    var test2 = new Aws.Rds.ClusterInstance("test2", new Aws.Rds.ClusterInstanceArgs
    {
        ApplyImmediately = true,
        ClusterIdentifier = @default.Id,
        Identifier = "test2",
        InstanceClass = "db.t2.small",
    });
    var test3 = new Aws.Rds.ClusterInstance("test3", new Aws.Rds.ClusterInstanceArgs
    {
        ApplyImmediately = true,
        ClusterIdentifier = @default.Id,
        Identifier = "test3",
        InstanceClass = "db.t2.small",
    });
    var eligible = new Aws.Rds.ClusterEndpoint("eligible", new Aws.Rds.ClusterEndpointArgs
    {
        ClusterEndpointIdentifier = "reader",
        ClusterIdentifier = @default.Id,
        CustomEndpointType = "READER",
        ExcludedMembers = 
        {
            test1.Id,
            test2.Id,
        },
    });
    var @static = new Aws.Rds.ClusterEndpoint("static", new Aws.Rds.ClusterEndpointArgs
    {
        ClusterEndpointIdentifier = "static",
        ClusterIdentifier = @default.Id,
        CustomEndpointType = "READER",
        StaticMembers = 
        {
            test1.Id,
            test3.Id,
        },
    });
}

}

ClusterEndpointArgs

ClusterEndpointState

ClusterInstance

Provides an RDS Cluster Instance Resource. A Cluster Instance Resource defines attributes that are specific to a single instance in a RDS Cluster, specifically running Amazon Aurora.

Unlike other RDS resources that support replication, with Amazon Aurora you do not designate a primary and subsequent replicas. Instead, you simply add RDS Instances and Aurora manages the replication. You can use the count meta-parameter to make multiple instances and join them all to the same RDS Cluster, or you may specify different Cluster Instance resources with various instance_class sizes.

For more information on Amazon Aurora, see Aurora on Amazon RDS in the Amazon RDS User Guide.

NOTE: Deletion Protection from the RDS service can only be enabled at the cluster level, not for individual cluster instances. You can still add the protect CustomResourceOption to this resource configuration if you desire protection from accidental deletion.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var @default = new Aws.Rds.Cluster("default", new Aws.Rds.ClusterArgs
    {
        AvailabilityZones = 
        {
            "us-west-2a",
            "us-west-2b",
            "us-west-2c",
        },
        ClusterIdentifier = "aurora-cluster-demo",
        DatabaseName = "mydb",
        MasterPassword = "barbut8chars",
        MasterUsername = "foo",
    });
    var clusterInstances = new List<Aws.Rds.ClusterInstance>();
    for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        clusterInstances.Add(new Aws.Rds.ClusterInstance($"clusterInstances-{range.Value}", new Aws.Rds.ClusterInstanceArgs
        {
            ClusterIdentifier = @default.Id,
            Identifier = $"aurora-cluster-demo-{range.Value}",
            InstanceClass = "db.r4.large",
        }));
    }
}

}

ClusterInstanceArgs

ClusterInstanceState

ClusterParameterGroup

Provides an RDS DB cluster parameter group resource. Documentation of the available parameters for various Aurora engines can be found at:

  • Aurora MySQL Parameters
  • Aurora PostgreSQL Parameters

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var @default = new Aws.Rds.ClusterParameterGroup("default", new Aws.Rds.ClusterParameterGroupArgs
    {
        Description = "RDS default cluster parameter group",
        Family = "aurora5.6",
        Parameters = 
        {
            new Aws.Rds.Inputs.ClusterParameterGroupParameterArgs
            {
                Name = "character_set_server",
                Value = "utf8",
            },
            new Aws.Rds.Inputs.ClusterParameterGroupParameterArgs
            {
                Name = "character_set_client",
                Value = "utf8",
            },
        },
    });
}

}

ClusterParameterGroupArgs

ClusterParameterGroupState

ClusterSnapshot

Manages an RDS database cluster snapshot for Aurora clusters. For managing RDS database instance snapshots, see the aws.rds.Snapshot resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = new Aws.Rds.ClusterSnapshot("example", new Aws.Rds.ClusterSnapshotArgs
    {
        DbClusterIdentifier = aws_rds_cluster.Example.Id,
        DbClusterSnapshotIdentifier = "resourcetestsnapshot1234",
    });
}

}

ClusterSnapshotArgs

ClusterSnapshotState

ClusterState

EventSubscription

Provides a DB event subscription resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var defaultInstance = new Aws.Rds.Instance("defaultInstance", new Aws.Rds.InstanceArgs
    {
        AllocatedStorage = 10,
        DbSubnetGroupName = "my_database_subnet_group",
        Engine = "mysql",
        EngineVersion = "5.6.17",
        InstanceClass = "db.t2.micro",
        Name = "mydb",
        ParameterGroupName = "default.mysql5.6",
        Password = "bar",
        Username = "foo",
    });
    var defaultTopic = new Aws.Sns.Topic("defaultTopic", new Aws.Sns.TopicArgs
    {
    });
    var defaultEventSubscription = new Aws.Rds.EventSubscription("defaultEventSubscription", new Aws.Rds.EventSubscriptionArgs
    {
        EventCategories = 
        {
            "availability",
            "deletion",
            "failover",
            "failure",
            "low storage",
            "maintenance",
            "notification",
            "read replica",
            "recovery",
            "restoration",
        },
        SnsTopic = defaultTopic.Arn,
        SourceIds = 
        {
            defaultInstance.Id,
        },
        SourceType = "db-instance",
    });
}

}

Attributes

The following additional atttributes are provided:

  • id - The name of the RDS event notification subscription
  • arn - The Amazon Resource Name of the RDS event notification subscription
  • customer_aws_id - The AWS customer account associated with the RDS event notification subscription

EventSubscriptionArgs

EventSubscriptionState

GetCluster

GetClusterArgs

GetClusterResult

GetClusterSnapshot

GetClusterSnapshotArgs

GetClusterSnapshotResult

GetEventCategories

GetEventCategoriesArgs

GetEventCategoriesResult

GetInstance

GetInstanceArgs

GetInstanceResult

GetSnapshot

GetSnapshotArgs

GetSnapshotResult

GlobalCluster

Manages an RDS Global Cluster, which is an Aurora global database spread across multiple regions. The global database contains a single primary cluster with read-write capability, and a read-only secondary cluster that receives data from the primary cluster through high-speed replication performed by the Aurora storage subsystem.

More information about Aurora global databases can be found in the Aurora User Guide.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var primary = new Aws.Provider("primary", new Aws.ProviderArgs
    {
        Region = "us-east-2",
    });
    var secondary = new Aws.Provider("secondary", new Aws.ProviderArgs
    {
        Region = "us-west-2",
    });
    var example = new Aws.Rds.GlobalCluster("example", new Aws.Rds.GlobalClusterArgs
    {
        GlobalClusterIdentifier = "example",
    });
    var primaryCluster = new Aws.Rds.Cluster("primaryCluster", new Aws.Rds.ClusterArgs
    {
        EngineMode = "global",
        GlobalClusterIdentifier = example.Id,
    });
    var primaryClusterInstance = new Aws.Rds.ClusterInstance("primaryClusterInstance", new Aws.Rds.ClusterInstanceArgs
    {
        ClusterIdentifier = primaryCluster.Id,
    });
    var secondaryCluster = new Aws.Rds.Cluster("secondaryCluster", new Aws.Rds.ClusterArgs
    {
        EngineMode = "global",
        GlobalClusterIdentifier = example.Id,
    });
    var secondaryClusterInstance = new Aws.Rds.ClusterInstance("secondaryClusterInstance", new Aws.Rds.ClusterInstanceArgs
    {
        ClusterIdentifier = secondaryCluster.Id,
    });
}

}

GlobalClusterArgs

GlobalClusterState

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_immediately can 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,
    });
}

}

InstanceArgs

InstanceState

OptionGroup

Provides an RDS DB option group resource. Documentation of the available options for various RDS engines can be found at:

  • MariaDB Options
  • Microsoft SQL Server Options
  • MySQL Options
  • Oracle Options

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = new Aws.Rds.OptionGroup("example", new Aws.Rds.OptionGroupArgs
    {
        EngineName = "sqlserver-ee",
        MajorEngineVersion = "11.00",
        Options = 
        {
            new Aws.Rds.Inputs.OptionGroupOptionArgs
            {
                OptionName = "Timezone",
                OptionSettings = 
                {
                    new Aws.Rds.Inputs.OptionGroupOptionOptionSettingArgs
                    {
                        Name = "TIME_ZONE",
                        Value = "UTC",
                    },
                },
            },
            new Aws.Rds.Inputs.OptionGroupOptionArgs
            {
                OptionName = "SQLSERVER_BACKUP_RESTORE",
                OptionSettings = 
                {
                    new Aws.Rds.Inputs.OptionGroupOptionOptionSettingArgs
                    {
                        Name = "IAM_ROLE_ARN",
                        Value = aws_iam_role.Example.Arn,
                    },
                },
            },
            new Aws.Rds.Inputs.OptionGroupOptionArgs
            {
                OptionName = "TDE",
            },
        },
        OptionGroupDescription = "Option Group",
    });
}

}

OptionGroupArgs

OptionGroupState

ParameterGroup

Provides an RDS DB parameter group resource .Documentation of the available parameters for various RDS engines can be found at:

  • Aurora MySQL Parameters
  • Aurora PostgreSQL Parameters
  • MariaDB Parameters
  • Oracle Parameters
  • PostgreSQL Parameters

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var @default = new Aws.Rds.ParameterGroup("default", new Aws.Rds.ParameterGroupArgs
    {
        Family = "mysql5.6",
        Parameters = 
        {
            new Aws.Rds.Inputs.ParameterGroupParameterArgs
            {
                Name = "character_set_server",
                Value = "utf8",
            },
            new Aws.Rds.Inputs.ParameterGroupParameterArgs
            {
                Name = "character_set_client",
                Value = "utf8",
            },
        },
    });
}

}

ParameterGroupArgs

ParameterGroupState

RoleAssociation

Manages an RDS DB Instance association with an IAM Role. Example use cases:

  • Amazon RDS Oracle integration with Amazon S3
  • Importing Amazon S3 Data into an RDS PostgreSQL DB Instance

To manage the RDS DB Instance IAM Role for Enhanced Monitoring, see the aws.rds.Instance resource monitoring_role_arn argument instead.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = new Aws.Rds.RoleAssociation("example", new Aws.Rds.RoleAssociationArgs
    {
        DbInstanceIdentifier = aws_db_instance.Example.Id,
        FeatureName = "S3_INTEGRATION",
        RoleArn = aws_iam_role.Example.Id,
    });
}

}

RoleAssociationArgs

RoleAssociationState

SecurityGroup

Provides an RDS security group resource. This is only for DB instances in the EC2-Classic Platform. For instances inside a VPC, use the aws_db_instance.vpc_security_group_ids attribute instead.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var @default = new Aws.Rds.SecurityGroup("default", new Aws.Rds.SecurityGroupArgs
    {
        Ingress = 
        {
            new Aws.Rds.Inputs.SecurityGroupIngressArgs
            {
                Cidr = "10.0.0.0/24",
            },
        },
    });
}

}

SecurityGroupArgs

SecurityGroupState

Snapshot

Manages an RDS database instance snapshot. For managing RDS database cluster snapshots, see the aws.rds.ClusterSnapshot resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var bar = new Aws.Rds.Instance("bar", new Aws.Rds.InstanceArgs
    {
        AllocatedStorage = 10,
        BackupRetentionPeriod = 0,
        Engine = "MySQL",
        EngineVersion = "5.6.21",
        InstanceClass = "db.t2.micro",
        MaintenanceWindow = "Fri:09:00-Fri:09:30",
        Name = "baz",
        ParameterGroupName = "default.mysql5.6",
        Password = "barbarbarbar",
        Username = "foo",
    });
    var test = new Aws.Rds.Snapshot("test", new Aws.Rds.SnapshotArgs
    {
        DbInstanceIdentifier = bar.Id,
        DbSnapshotIdentifier = "testsnapshot1234",
    });
}

}

SnapshotArgs

SnapshotState

SubnetGroup

Provides an RDS DB subnet group resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var @default = new Aws.Rds.SubnetGroup("default", new Aws.Rds.SubnetGroupArgs
    {
        SubnetIds = 
        {
            aws_subnet.Frontend.Id,
            aws_subnet.Backend.Id,
        },
        Tags = 
        {
            { "Name", "My DB subnet group" },
        },
    });
}

}

SubnetGroupArgs

SubnetGroupState

Back to top Copyright 2016-2020, Pulumi Corporation.