rds - create, delete, or modify an Amazon rds instance

Author:Bruce Pennypacker

Synopsis

New in version 1.3.

Creates, deletes, or modifies rds instances. When creating an instance it can be either a new instance or a read-only replica of an existing instance. This module has a dependency on python-boto >= 2.5. The ‘promote’ command requires boto >= 2.18.0.

Options

parameter required default choices comments
apply_immediately no
  • yes
  • no
Used only when command=modify. If enabled, the modifications will be applied as soon as possible rather than waiting for the next preferred maintenance window.
aws_access_key no
    AWS access key. If not set then the value of the AWS_ACCESS_KEY environment variable is used.
    aws_secret_key no
      AWS secret key. If not set then the value of the AWS_SECRET_KEY environment variable is used.
      backup_retention no
        Number of days backups are retained. Set to 0 to disable backups. Default is 1 day. Valid range: 0-35. Used only when command=create or command=modify.
        backup_window no
          Backup window in format of hh24:mi-hh24:mi. If not specified then a random backup window is assigned. Used only when command=create or command=modify.
          command yes
          • create
          • replicate
          • delete
          • facts
          • modify
          • promote
          • snapshot
          • restore
          Specifies the action to take.
          db_engine no
          • MySQL
          • oracle-se1
          • oracle-se
          • oracle-ee
          • sqlserver-ee
          • sqlserver-se
          • sqlserver-ex
          • sqlserver-web
          • postgres
          The type of database. Used only when command=create.
          db_name no
            Name of a database to create within the instance. If not specified then no database is created. Used only when command=create.
            engine_version no
              Version number of the database engine to use. Used only when command=create. If not specified then the current Amazon RDS default engine version is used.
              instance_name yes
                Database instance identifier.
                instance_type no
                  The instance type of the database. Must be specified when command=create. Optional when command=replicate, command=modify or command=restore. If not specified then the replica inherits the same instance type as the source instance.
                  iops no
                    Specifies the number of IOPS for the instance. Used only when command=create or command=modify. Must be an integer greater than 1000.
                    license_model no
                    • license-included
                    • bring-your-own-license
                    • general-public-license
                    The license model for this DB instance. Used only when command=create or command=restore.
                    maint_window no
                      Maintenance window in format of ddd:hh24:mi-ddd:hh24:mi. (Example: Mon:22:00-Mon:23:15) If not specified then a random maintenance window is assigned. Used only when command=create or command=modify.
                      multi_zone no
                      • yes
                      • no
                      Specifies if this is a Multi-availability-zone deployment. Can not be used in conjunction with zone parameter. Used only when command=create or command=modify.
                      new_instance_name no
                        Name to rename an instance to. Used only when command=modify. (added in Ansible 1.5)
                        option_group no
                          The name of the option group to use. If not specified then the default option group is used. Used only when command=create.
                          parameter_group no
                            Name of the DB parameter group to associate with this instance. If omitted then the RDS default DBParameterGroup will be used. Used only when command=create or command=modify.
                            password no
                              Password for the master database username. Used only when command=create or command=modify.
                              port no
                                Port number that the DB instance uses for connections. Defaults to 3306 for mysql. Must be changed to 1521 for Oracle, 1443 for SQL Server, 5432 for PostgreSQL. Used only when command=create or command=replicate.
                                region yes
                                  The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used.
                                  security_groups no
                                    Comma separated list of one or more security groups. Used only when command=create or command=modify.
                                    size no
                                      Size in gigabytes of the initial storage for the DB instance. Used only when command=create or command=modify.
                                      snapshot no
                                        Name of snapshot to take. When command=delete, if no snapshot name is provided then no snapshot is taken. Used only when command=delete or command=snapshot.
                                        source_instance no
                                          Name of the database to replicate. Used only when command=replicate.
                                          subnet no
                                            VPC subnet group. If specified then a VPC instance is created. Used only when command=create.
                                            upgrade no
                                            • yes
                                            • no
                                            Indicates that minor version upgrades should be applied automatically. Used only when command=create or command=replicate.
                                            username no
                                              Master database username. Used only when command=create.
                                              vpc_security_groups no
                                                Comma separated list of one or more vpc security group ids. Also requires `subnet` to be specified. Used only when command=create or command=modify.
                                                wait no no
                                                • yes
                                                • no
                                                When command=create, replicate, modify or restore then wait for the database to enter the 'available' state. When command=delete wait for the database to be terminated.
                                                wait_timeout no 300
                                                  how long before wait gives up, in seconds
                                                  zone no
                                                    availability zone in which to launch the instance. Used only when command=create, command=replicate or command=restore.

                                                    Note

                                                    Requires boto

                                                    Examples


                                                    # Basic mysql provisioning example
                                                    - rds: >
                                                          command=create
                                                          instance_name=new_database
                                                          db_engine=MySQL
                                                          size=10
                                                          instance_type=db.m1.small
                                                          username=mysql_admin
                                                          password=1nsecure
                                                    
                                                    # Create a read-only replica and wait for it to become available
                                                    - rds: >
                                                          command=replicate
                                                          instance_name=new_database_replica
                                                          source_instance=new_database
                                                          wait=yes
                                                          wait_timeout=600
                                                    
                                                    # Delete an instance, but create a snapshot before doing so
                                                    - rds: >
                                                          command=delete
                                                          instance_name=new_database
                                                          snapshot=new_database_snapshot
                                                    
                                                    # Get facts about an instance
                                                    - rds: >
                                                          command=facts
                                                          instance_name=new_database
                                                          register: new_database_facts
                                                    
                                                    # Rename an instance and wait for the change to take effect
                                                    - rds: >
                                                          command=modify
                                                          instance_name=new_database
                                                          new_instance_name=renamed_database
                                                          wait=yes