github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/aws/r/rds_cluster.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_rds_cluster" 4 sidebar_current: "docs-aws-resource-rds-cluster" 5 description: |- 6 Provides an RDS Cluster Resource 7 --- 8 9 # aws\_rds\_cluster 10 11 Provides an RDS Cluster Resource. A Cluster Resource defines attributes that are 12 applied to the entire cluster of [RDS Cluster Instances][3]. Use the RDS Cluster 13 resource and RDS Cluster Instances to create and use Amazon Aurora, a MySQL-compatible 14 database engine. 15 16 For more information on Amazon Aurora, see [Aurora on Amazon RDS][2] in the Amazon RDS User Guide. 17 18 Changes to a RDS Cluster can occur when you manually change a 19 parameter, such as `port`, and are reflected in the next maintenance 20 window. Because of this, Terraform may report a difference in its planning 21 phase because a modification has not yet taken place. You can use the 22 `apply_immediately` flag to instruct the service to apply the change immediately 23 (see documentation below). 24 25 ~> **Note:** using `apply_immediately` can result in a 26 brief downtime as the server reboots. See the AWS Docs on [RDS Maintenance][4] 27 for more information. 28 29 ~> **Note:** All arguments including the username and password will be stored in the raw state as plain-text. 30 [Read more about sensitive data in state](/docs/state/sensitive-data.html). 31 32 ## Example Usage 33 34 ```hcl 35 resource "aws_rds_cluster" "default" { 36 cluster_identifier = "aurora-cluster-demo" 37 availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] 38 database_name = "mydb" 39 master_username = "foo" 40 master_password = "bar" 41 backup_retention_period = 5 42 preferred_backup_window = "07:00-09:00" 43 } 44 ``` 45 46 ~> **NOTE:** RDS Clusters resources that are created without any matching 47 RDS Cluster Instances do not currently display in the AWS Console. 48 49 ## Argument Reference 50 51 For more detailed documentation about each argument, refer to 52 the [AWS official documentation](https://docs.aws.amazon.com/AmazonRDS/latest/CommandLineReference/CLIReference-cmd-ModifyDBInstance.html). 53 54 The following arguments are supported: 55 56 * `cluster_identifier` - (Optional, Forces new resources) The cluster identifier. If omitted, Terraform will assign a random, unique identifier. 57 * `cluster_identifier_prefix` - (Optional, Forces new resource) Creates a unique cluster identifier beginning with the specified prefix. Conflicts with `cluster_identifer`. 58 * `database_name` - (Optional) The name for your database of up to 8 alpha-numeric 59 characters. If you do not provide a name, Amazon RDS will not create a 60 database in the DB cluster you are creating 61 * `master_password` - (Required unless a `snapshot_identifier` is provided) Password for the master DB user. Note that this may 62 show up in logs, and it will be stored in the state file 63 * `master_username` - (Required unless a `snapshot_identifier` is provided) Username for the master DB user 64 * `final_snapshot_identifier` - (Optional) The name of your final DB snapshot 65 when this DB cluster is deleted. If omitted, no final snapshot will be 66 made. 67 * `skip_final_snapshot` - (Optional) Determines whether a final DB snapshot is created before the DB cluster is deleted. If true is specified, no DB snapshot is created. If false is specified, a DB snapshot is created before the DB cluster is deleted, using the value from `final_snapshot_identifier`. Default is `false`. 68 * `availability_zones` - (Optional) A list of EC2 Availability Zones that 69 instances in the DB cluster can be created in 70 * `backup_retention_period` - (Optional) The days to retain backups for. Default 71 1 72 * `preferred_backup_window` - (Optional) The daily time range during which automated backups are created if automated backups are enabled using the BackupRetentionPeriod parameter. 73 Default: A 30-minute window selected at random from an 8-hour block of time per region. e.g. 04:00-09:00 74 * `preferred_maintenance_window` - (Optional) The weekly time range during which system maintenance can occur, in (UTC) e.g. wed:04:00-wed:04:30 75 * `port` - (Optional) The port on which the DB accepts connections 76 * `vpc_security_group_ids` - (Optional) List of VPC security groups to associate 77 with the Cluster 78 * `snapshot_identifier` - (Optional) Specifies whether or not to create this cluster 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. 79 * `storage_encrypted` - (Optional) Specifies whether the DB cluster is encrypted. The default is `false` if not specified. 80 * `apply_immediately` - (Optional) Specifies whether any cluster modifications 81 are applied immediately, or during the next maintenance window. Default is 82 `false`. See [Amazon RDS Documentation for more information.](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html) 83 * `db_subnet_group_name` - (Optional) A DB subnet group to associate with this DB instance. **NOTE:** This must match the `db_subnet_group_name` specified on every [`aws_rds_cluster_instance`](/docs/providers/aws/r/rds_cluster_instance.html) in the cluster. 84 * `db_cluster_parameter_group_name` - (Optional) A cluster parameter group to associate with the cluster. 85 * `kms_key_id` - (Optional) The ARN for the KMS encryption key. When specifying `kms_key_id`, `storage_encrypted` needs to be set to true. 86 87 ## Attributes Reference 88 89 The following attributes are exported: 90 91 * `id` - The RDS Cluster Identifier 92 * `cluster_identifier` - The RDS Cluster Identifier 93 * `cluster_members` – List of RDS Instances that are a part of this cluster 94 * `allocated_storage` - The amount of allocated storage 95 * `availability_zones` - The availability zone of the instance 96 * `backup_retention_period` - The backup retention period 97 * `preferred_backup_window` - The backup window 98 * `preferred_maintenance_window` - The maintenance window 99 * `endpoint` - The DNS address of the RDS instance 100 * `reader_endpoint` - A read-only endpoint for the Aurora cluster, automatically 101 load-balanced across replicas 102 * `engine` - The database engine 103 * `engine_version` - The database engine version 104 * `maintenance_window` - The instance maintenance window 105 * `database_name` - The database name 106 * `port` - The database port 107 * `status` - The RDS instance status 108 * `username` - The master username for the database 109 * `storage_encrypted` - Specifies whether the DB cluster is encrypted 110 * `preferred_backup_window` - The daily time range during which the backups happen 111 * `replication_source_identifier` - ARN of the source DB cluster if this DB cluster is created as a Read Replica. 112 113 [1]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Replication.html 114 [2]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Aurora.html 115 [3]: /docs/providers/aws/r/rds_cluster_instance.html 116 [4]: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html 117 118 ## Import 119 120 RDS Clusters can be imported using the `cluster_identifier`, e.g. 121 122 ``` 123 $ terraform import aws_rds_cluster.aurora_cluster aurora-prod-cluster 124 ```