github.com/shvar/terraform@v0.6.9-0.20151215234924-3365cd2231df/website/source/docs/providers/aws/r/db_instance.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_db_instance" 4 sidebar_current: "docs-aws-resource-db-instance" 5 description: |- 6 Provides an RDS instance resource. 7 --- 8 9 # aws\_db\_instance 10 11 Provides an RDS instance resource. 12 13 ## Example Usage 14 15 ``` 16 resource "aws_db_instance" "default" { 17 identifier = "mydb-rds" 18 allocated_storage = 10 19 engine = "mysql" 20 engine_version = "5.6.17" 21 instance_class = "db.t1.micro" 22 name = "mydb" 23 username = "foo" 24 password = "bar" 25 db_subnet_group_name = "my_database_subnet_group" 26 parameter_group_name = "default.mysql5.6" 27 } 28 ``` 29 30 ## Argument Reference 31 32 For more detailed documentation about each argument, refer to 33 the [AWS official documentation](http://docs.aws.amazon.com/AmazonRDS/latest/CommandLineReference/CLIReference-cmd-ModifyDBInstance.html). 34 35 The following arguments are supported: 36 37 * `allocated_storage` - (Required) The allocated storage in gigabytes. 38 * `engine` - (Required) The database engine to use. 39 * `engine_version` - (Optional) The engine version to use. 40 * `identifier` - (Required) The name of the RDS instance 41 * `instance_class` - (Required) The instance type of the RDS instance. 42 * `storage_type` - (Optional) One of "standard" (magnetic), "gp2" (general 43 purpose SSD), or "io1" (provisioned IOPS SSD). The default is "io1" if 44 `iops` is specified, "standard" if not. 45 * `final_snapshot_identifier` - (Optional) The name of your final DB snapshot 46 when this DB instance is deleted. If omitted, no final snapshot will be 47 made. 48 * `skip_final_snapshot` - (Optional) 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. Default is true. 49 * `copy_tags_to_snapshot` – (Optional, boolean) On delete, copy all Instance `tags` to 50 the final snapshot (if `final_snapshot_identifier` is specified). Default 51 `false` 52 * `name` - (Optional) The DB name to create. If omitted, no database is created 53 initially. 54 * `password` - (Required) Password for the master DB user. Note that this may 55 show up in logs, and it will be stored in the state file. 56 * `username` - (Required) Username for the master DB user. 57 * `availability_zone` - (Optional) The AZ for the RDS instance. 58 * `backup_retention_period` - (Optional) The days to retain backups for. Must be 59 `1` or greater to be a source for a [Read Replica][1]. 60 * `backup_window` - (Optional) The backup window. 61 * `iops` - (Optional) The amount of provisioned IOPS. Setting this implies a 62 storage_type of "io1". 63 * `maintenance_window` - (Optional) The window to perform maintenance in. 64 Syntax: "ddd:hh24:mi-ddd:hh24:mi". Eg: "Mon:00:00-Mon:03:00". 65 See [RDS Maintenance Window docs](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/AdjustingTheMaintenanceWindow.html) for more. 66 * `multi_az` - (Optional) Specifies if the RDS instance is multi-AZ 67 * `port` - (Optional) The port on which the DB accepts connections. 68 * `publicly_accessible` - (Optional) Bool to control if instance is publicly accessible. 69 * `vpc_security_group_ids` - (Optional) List of VPC security groups to associate. 70 * `security_group_names` - (Optional/Deprecated) List of DB Security Groups to associate. 71 Only used for [DB Instances on the _EC2-Classic_ Platform](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.html#USER_VPC.FindDefaultVPC). 72 * `db_subnet_group_name` - (Optional) 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. 73 * `parameter_group_name` - (Optional) Name of the DB parameter group to associate. 74 * `storage_encrypted` - (Optional) Specifies whether the DB instance is encrypted. The default is `false` if not specified. 75 * `apply_immediately` - (Optional) Specifies whether any database modifications 76 are applied immediately, or during the next maintenance window. Default is 77 `false`. See [Amazon RDS Documentation for more information.](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html) 78 * `replicate_source_db` - (Optional) Specifies that this resource is a Replicate 79 database, and to use this value as the source database. This correlates to the 80 `identifier` of another Amazon RDS Database to replicate. See 81 [DB Instance Replication][1] and 82 [Working with PostgreSQL and MySQL Read Replicas](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html) for 83 more information on using Replication. 84 * `snapshot_identifier` - (Optional) 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. 85 * `license_model` - (Optional, but required for some DB engines, i.e. Oracle SE1) License model information for this DB instance. 86 * `auto_minor_version_upgrade` - (Optional) Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window. Defaults to true. 87 * `auto_major_version_upgrade` - (Optional) 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. 88 89 ~> **NOTE:** Removing the `replicate_source_db` attribute from an existing RDS 90 Replicate database managed by Terraform will promote the database to a fully 91 standalone database. 92 93 ## Attributes Reference 94 95 The following attributes are exported: 96 97 * `id` - The RDS instance ID. 98 * `address` - The address of the RDS instance. 99 * `arn` - The ARN of the RDS instance. 100 * `allocated_storage` - The amount of allocated storage 101 * `availability_zone` - The availability zone of the instance 102 * `backup_retention_period` - The backup retention period 103 * `backup_window` - The backup window 104 * `endpoint` - The connection endpoint 105 * `engine` - The database engine 106 * `engine_version` - The database engine version 107 * `instance_class`- The RDS instance class 108 * `maintenance_window` - The instance maintenance window 109 * `multi_az` - If the RDS instance is multi AZ enabled 110 * `name` - The database name 111 * `port` - The database port 112 * `status` - The RDS instance status 113 * `username` - The master username for the database 114 * `storage_encrypted` - Specifies whether the DB instance is encrypted 115 116 [1]: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Replication.html