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