• AnsibleFest
  • Products
  • Community
  • Webinars & Training
  • Blog
Ansible Logo
Documentation
Ansible
5

Installation, Upgrade & Configuration

  • Installation Guide
  • Ansible Porting Guides

Using Ansible

  • User Guide

Contributing to Ansible

  • Ansible Community Guide

Extending Ansible

  • Developer Guide

Common Ansible Scenarios

  • Legacy Public Cloud Guides
  • Network Technology Guides
  • Virtualization and Containerization Guides

Network Automation

  • Network Getting Started
  • Network Advanced Topics
  • Network Developer Guide

Ansible Galaxy

  • Galaxy User Guide
  • Galaxy Developer Guide

Reference & Appendices

  • Collection Index
    • Collections in the Amazon Namespace
    • Collections in the Ansible Namespace
    • Collections in the Arista Namespace
    • Collections in the Awx Namespace
    • Collections in the Azure Namespace
    • Collections in the Check_point Namespace
    • Collections in the Chocolatey Namespace
    • Collections in the Cisco Namespace
    • Collections in the Cloud Namespace
    • Collections in the Cloudscale_ch Namespace
    • Collections in the Community Namespace
      • Community.Aws
        • Description
        • Plugin Index
      • Community.Azure
      • Community.Ciscosmb
      • Community.Crypto
      • Community.Digitalocean
      • Community.Dns
      • Community.Docker
      • Community.Fortios
      • Community.General
      • Community.Google
      • Community.Grafana
      • Community.Hashi_Vault
      • Community.Hrobot
      • Community.Kubernetes
      • Community.Kubevirt
      • Community.Libvirt
      • Community.Mongodb
      • Community.Mysql
      • Community.Network
      • Community.Okd
      • Community.Postgresql
      • Community.Proxysql
      • Community.Rabbitmq
      • Community.Routeros
      • Community.Sap
      • Community.Skydive
      • Community.Sops
      • Community.Vmware
      • Community.Windows
      • Community.Zabbix
    • Collections in the Containers Namespace
    • Collections in the Cyberark Namespace
    • Collections in the Dellemc Namespace
    • Collections in the F5networks Namespace
    • Collections in the Fortinet Namespace
    • Collections in the Frr Namespace
    • Collections in the Gluster Namespace
    • Collections in the Google Namespace
    • Collections in the Hetzner Namespace
    • Collections in the Hpe Namespace
    • Collections in the Ibm Namespace
    • Collections in the Infinidat Namespace
    • Collections in the Infoblox Namespace
    • Collections in the Inspur Namespace
    • Collections in the Junipernetworks Namespace
    • Collections in the Kubernetes Namespace
    • Collections in the Mellanox Namespace
    • Collections in the Netapp Namespace
    • Collections in the Netapp_eseries Namespace
    • Collections in the Netbox Namespace
    • Collections in the Ngine_io Namespace
    • Collections in the Openstack Namespace
    • Collections in the Openvswitch Namespace
    • Collections in the Ovirt Namespace
    • Collections in the Purestorage Namespace
    • Collections in the Sensu Namespace
    • Collections in the Servicenow Namespace
    • Collections in the Splunk Namespace
    • Collections in the T_systems_mms Namespace
    • Collections in the Theforeman Namespace
    • Collections in the Vmware Namespace
    • Collections in the Vyos Namespace
    • Collections in the Wti Namespace
  • Indexes of all modules and plugins
  • Playbook Keywords
  • Return Values
  • Ansible Configuration Settings
  • Controlling how Ansible behaves: precedence rules
  • YAML Syntax
  • Python 3 Support
  • Interpreter Discovery
  • Releases and maintenance
  • Testing Strategies
  • Sanity Tests
  • Frequently Asked Questions
  • Glossary
  • Ansible Reference: Module Utilities
  • Special Variables
  • Red Hat Ansible Automation Platform
  • Ansible Automation Hub
  • Logging Ansible output

Roadmaps

  • Ansible Roadmap




Ansible
  • »
  • Collection Index »
  • Collections in the Community Namespace »
  • Community.Aws »
  • community.aws.rds module – create, delete, or modify Amazon rds instances, rds snapshots, and related facts


community.aws.rds module – create, delete, or modify Amazon rds instances, rds snapshots, and related facts

Note

This module is part of the community.aws collection (version 2.4.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.aws.

To use it in a playbook, specify: community.aws.rds.

New in version 1.0.0: of community.aws

  • DEPRECATED

  • Synopsis

  • Requirements

  • Parameters

  • Notes

  • Examples

  • Return Values

  • Status

DEPRECATED

Removed in

version 3.0.0

Why

The rds module is based upon a deprecated version of the AWS SDK.

Alternative

Use community.aws.rds_instance, community.aws.rds_instance_info, and community.aws.rds_instance_snapshot.

Synopsis

  • Creates, deletes, or modifies rds resources.

  • When creating an instance it can be either a new instance or a read-only replica of an existing instance.

  • The ‘promote’ command requires boto >= 2.18.0. Certain features such as tags rely on boto.rds2 (boto >= 2.26.0).

  • Please use the boto3 based community.aws.rds_instance instead.

Requirements

The below requirements are needed on the host that executes this module.

  • boto >= 2.49.0

  • boto3 >= 1.15.0

  • botocore >= 1.18.0

  • python >= 3.6

Parameters

Parameter

Comments

apply_immediately

boolean

When apply_immediately=true, the modifications will be applied as soon as possible rather than waiting for the next preferred maintenance window.

Used only when command=modify.

Choices:

  • no ← (default)

  • yes

aws_access_key

aliases: ec2_access_key, access_key

string

AWS access key. If not set then the value of the AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY or EC2_ACCESS_KEY environment variable is used.

If profile is set this parameter is ignored.

Passing the aws_access_key and profile options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.

aws_ca_bundle

path

The location of a CA Bundle to use when validating SSL certificates.

Not used by boto 2 based modules.

Note: The CA Bundle is read ‘module’ side and may need to be explicitly copied from the controller if not run locally.

aws_config

dictionary

A dictionary to modify the botocore configuration.

Parameters can be found at https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config.

Only the ‘user_agent’ key is used for boto modules. See http://boto.cloudhackers.com/en/latest/boto_config_tut.html#boto for more boto configuration.

aws_secret_key

aliases: ec2_secret_key, secret_key

string

AWS secret key. If not set then the value of the AWS_SECRET_ACCESS_KEY, AWS_SECRET_KEY, or EC2_SECRET_KEY environment variable is used.

If profile is set this parameter is ignored.

Passing the aws_secret_key and profile options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.

backup_retention

string

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

string

Backup window in format of hh24:mi-hh24:mi. (Example: 18:00-20:30)

Times are specified in UTC.

If not specified then a random backup window is assigned.

Used only when command=create or command=modify.

character_set_name

string

Associate the DB instance with a specified character set.

Used with command=create.

command

string / required

Specifies the action to take. The ‘reboot’ option is available starting at version 2.0.

Choices:

  • create

  • replicate

  • delete

  • facts

  • modify

  • promote

  • snapshot

  • reboot

  • restore

db_engine

string

The type of database.

Used only when command=create.

mariadb was added in version 2.2.

Choices:

  • mariadb

  • MySQL

  • oracle-se1

  • oracle-se2

  • oracle-se

  • oracle-ee

  • sqlserver-ee

  • sqlserver-se

  • sqlserver-ex

  • sqlserver-web

  • postgres

  • aurora

db_name

string

Name of a database to create within the instance.

If not specified then no database is created.

Used only when command=create.

debug_botocore_endpoint_logs

boolean

Use a botocore.endpoint logger to parse the unique (rather than total) “resource:action” API calls made during a task, outputing the set to the resource_actions key in the task results. Use the aws_resource_action callback to output to total list made during a playbook. The ANSIBLE_DEBUG_BOTOCORE_LOGS environment variable may also be used.

Choices:

  • no ← (default)

  • yes

ec2_url

aliases: aws_endpoint_url, endpoint_url

string

URL to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2_URL environment variable, if any, is used.

engine_version

string

Version number of the database engine to use.

If not specified then the current Amazon RDS default engine version is used

Used only when command=create.

force_failover

boolean

If enabled, the reboot is done using a MultiAZ failover.

Used only when command=reboot.

Choices:

  • no ← (default)

  • yes

instance_name

string

Database instance identifier.

Required except when using command=facts or command=delete on just a snapshot.

instance_type

aliases: type

string

The instance type of the database.

If not specified then the replica inherits the same instance type as the source instance.

Required when command=create.

Optional when command=replicate, command=modify or command=restore.

iops

string

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

string

The license model for this DB instance.

Used only when command=create or command=restore.

Choices:

  • license-included

  • bring-your-own-license

  • general-public-license

  • postgresql-license

maint_window

string

Maintenance window in format of ddd:hh24:mi-ddd:hh24:mi. (Example: Mon:22:00-Mon:23:15)

Times are specified in UTC.

If not specified then a random maintenance window is assigned.

Used only when command=create or command=modify.

multi_zone

boolean

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.

Choices:

  • no

  • yes

new_instance_name

string

Name to rename an instance to.

Used only when command=modify.

option_group

string

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

string

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

string

Password for the master database username.

Used only when command=create or command=modify.

port

integer

Port number that the DB instance uses for connections.

Used only when command=create or command=replicate.

Defaults to the standard ports for each db_engine: 3306 for MySQL and MariaDB, 1521 for Oracle 1433 for SQL Server, 5432 for PostgreSQL.

profile

aliases: aws_profile

string

Using profile will override aws_access_key, aws_secret_key and security_token and support for passing them at the same time as profile has been deprecated.

aws_access_key, aws_secret_key and security_token will be made mutually exclusive with profile after 2022-06-01.

publicly_accessible

string

Explicitly set whether the resource should be publicly accessible or not.

Used with command=create, command=replicate.

Requires boto >= 2.26.0

region

aliases: aws_region, ec2_region

string

The AWS region to use. If not specified then the value of the AWS_REGION or EC2_REGION environment variable, if any, is used. See http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region

security_groups

string

Comma separated list of one or more security groups.

Used only when command=create or command=modify.

security_token

aliases: aws_security_token, access_token

string

AWS STS security token. If not set then the value of the AWS_SECURITY_TOKEN or EC2_SECURITY_TOKEN environment variable is used.

If profile is set this parameter is ignored.

Passing the security_token and profile options at the same time has been deprecated and the options will be made mutually exclusive after 2022-06-01.

size

string

Size in gigabytes of the initial storage for the DB instance.

Used only when command=create or command=modify.

snapshot

string

Name of snapshot to take.

When command=delete, if no snapshot name is provided then no snapshot is taken.

When command=delete, if no instance_name is provided the snapshot is deleted.

Used with command=facts, command=delete or command=snapshot.

source_instance

string

Name of the database to replicate.

Used only when command=replicate.

subnet

string

VPC subnet group.

If specified then a VPC instance is created.

Used only when command=create.

tags

dictionary

tags dict to apply to a resource.

Used with command=create, command=replicate, command=restore.

Requires boto >= 2.26.0

upgrade

boolean

Indicates that minor version upgrades should be applied automatically.

Used only when command=create or command=modify or command=restore or command=replicate.

Choices:

  • no ← (default)

  • yes

username

string

Master database username.

Used only when command=create.

validate_certs

boolean

When set to “no”, SSL certificates will not be validated for communication with the AWS APIs.

Choices:

  • no

  • yes ← (default)

vpc_security_groups

list / elements=string

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

boolean

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.

Choices:

  • no ← (default)

  • yes

wait_timeout

integer

How long before wait gives up, in seconds.

Used when wait=true.

Default: 300

zone

aliases: aws_zone, ec2_zone

string

availability zone in which to launch the instance.

Used only when command=create, command=replicate or command=restore.

Can not be used in conjunction with multi_zone parameter.

Notes

Note

  • If parameters are not set within the module, the following environment variables can be used in decreasing order of precedence AWS_URL or EC2_URL, AWS_PROFILE or AWS_DEFAULT_PROFILE, AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY or EC2_ACCESS_KEY, AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY or EC2_SECRET_KEY, AWS_SECURITY_TOKEN or EC2_SECURITY_TOKEN, AWS_REGION or EC2_REGION, AWS_CA_BUNDLE

  • When no credentials are explicitly provided the AWS SDK (boto3) that Ansible uses will fall back to its configuration files (typically ~/.aws/credentials). See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html for more information.

  • Modules based on the original AWS SDK (boto) may read their default configuration from different files. See https://boto.readthedocs.io/en/latest/boto_config_tut.html for more information.

  • AWS_REGION or EC2_REGION can be typically be used to specify the AWS region, when required, but this can also be defined in the configuration files.

Examples

- name: Basic mysql provisioning example
  community.aws.rds:
    command: create
    instance_name: new-database
    db_engine: MySQL
    size: 10
    instance_type: db.m1.small
    username: mysql_admin
    password: 1nsecure
    tags:
      Environment: testing
      Application: cms

- name: Create a read-only replica and wait for it to become available
  community.aws.rds:
    command: replicate
    instance_name: new-database-replica
    source_instance: new_database
    wait: yes
    wait_timeout: 600

- name: Delete an instance, but create a snapshot before doing so
  community.aws.rds:
    command: delete
    instance_name: new-database
    snapshot: new_database_snapshot

- name: Get facts about an instance
  community.aws.rds:
    command: facts
    instance_name: new-database
  register: new_database_facts

- name: Rename an instance and wait for the change to take effect
  community.aws.rds:
    command: modify
    instance_name: new-database
    new_instance_name: renamed-database
    wait: yes

- name: Reboot an instance and wait for it to become available again
  community.aws.rds:
    command: reboot
    instance_name: database
    wait: yes

# Restore a Postgres db instance from a snapshot, wait for it to become available again, and
#  then modify it to add your security group. Also, display the new endpoint.
#  Note that the "publicly_accessible" option is allowed here just as it is in the AWS CLI
- community.aws.rds:
    command: restore
    snapshot: mypostgres-snapshot
    instance_name: MyNewInstanceName
    region: us-west-2
    zone: us-west-2b
    subnet: default-vpc-xx441xxx
    publicly_accessible: yes
    wait: yes
    wait_timeout: 600
    tags:
        Name: pg1_test_name_tag
  register: rds

- community.aws.rds:
    command: modify
    instance_name: MyNewInstanceName
    region: us-west-2
    vpc_security_groups: sg-xxx945xx

- ansible.builtin.debug:
    msg: "The new db endpoint is {{ rds.instance.endpoint }}"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

instance

complex

the rds instance

Returned: always

allocated_storage

string

the allocated storage size in gigabytes (GB)

Returned: when RDS instance exists

Sample: “100”

auto_minor_version_upgrade

boolean

indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window

Returned: when RDS instance exists

Sample: “true”

backup_window

string

the daily time range during which automated backups are created if automated backups are enabled

Returned: when RDS instance exists and automated backups are enabled

Sample: “03:00-03:30”

character_set_name

string

the name of the character set that this instance is associated with

Returned: when RDS instance exists

Sample: “AL32UTF8”

db_name

string

the name of the database to create when the DB instance is created

Returned: when RDS instance exists

Sample: “ASERTG”

db_subnet_groups

complex

information on the subnet group associated with this RDS instance

Returned: when RDS instance exists

description

string

the subnet group associated with the DB instance

Returned: when RDS instance exists

Sample: “Subnets for the UAT RDS SQL DB Instance”

name

string

the name of the DB subnet group

Returned: when RDS instance exists

Sample: “samplesubnetgrouprds-j6paiqkxqp4z”

status

string

the status of the DB subnet group

Returned: when RDS instance exists

Sample: “complete”

subnets

complex

the description of the DB subnet group

Returned: when RDS instance exists

availability_zone

complex

subnet availability zone information

Returned: when RDS instance exists

name

string

availability zone

Returned: when RDS instance exists

Sample: “eu-west-1b”

provisioned_iops_capable

boolean

whether provisioned iops are available in AZ subnet

Returned: when RDS instance exists

Sample: “false”

identifier

string

the identifier of the subnet

Returned: when RDS instance exists

Sample: “subnet-3fdba63e”

status

string

the status of the subnet

Returned: when RDS instance exists

Sample: “active”

endpoint

string

the endpoint uri of the database instance

Returned: when RDS instance exists

Sample: “my-ansible-database.asdfaosdgih.us-east-1.rds.amazonaws.com”

engine

string

the name of the database engine

Returned: when RDS instance exists

Sample: “oracle-se”

engine_version

string

the version of the database engine

Returned: when RDS instance exists

Sample: “11.2.0.4.v6”

latest_restorable_time

string

the latest time to which a database can be restored with point-in-time restore

Returned: when RDS instance exists

Sample: “1489707802.0”

license_model

string

the license model information

Returned: when RDS instance exists

Sample: “bring-your-own-license”

option_groups

complex

the list of option group memberships for this RDS instance

Returned: when RDS instance exists

option_group_name

string

the option group name for this RDS instance

Returned: when RDS instance exists

Sample: “default:oracle-se-11-2”

status

string

the status of the RDS instance’s option group membership

Returned: when RDS instance exists

Sample: “in-sync”

parameter_groups

complex

the list of DB parameter groups applied to this RDS instance

Returned: when RDS instance exists and parameter groups are defined

parameter_apply_status

string

the status of parameter updates

Returned: when RDS instance exists

Sample: “in-sync”

parameter_group_name

string

the name of the DP parameter group

Returned: when RDS instance exists

Sample: “testawsrpprodb01spfile-1ujg7nrs7sgyz”

pending_modified_values

complex

a dictionary of changes to the RDS instance that are pending

Returned: when RDS instance exists

allocated_storage

string

the new allocated storage size for this RDS instance that will be applied or is in progress

Returned: when RDS instance exists

Sample: “null”

backup_retention_period

string

the pending number of days for which automated backups are retained

Returned: when RDS instance exists

Sample: “null”

db_instance_class

string

the new DB instance class for this RDS instance that will be applied or is in progress

Returned: when RDS instance exists

Sample: “null”

db_instance_identifier

string

the new DB instance identifier this RDS instance that will be applied or is in progress

Returned: when RDS instance exists

Sample: “null”

engine_version

string

indicates the database engine version

Returned: when RDS instance exists

Sample: “null”

iops

string

the new provisioned IOPS value for this RDS instance that will be applied or is being applied

Returned: when RDS instance exists

Sample: “null”

master_user_password

string

the pending or in-progress change of the master credentials for this RDS instance

Returned: when RDS instance exists

Sample: “null”

multi_az

string

indicates that the single-AZ RDS instance is to change to a multi-AZ deployment

Returned: when RDS instance exists

Sample: “null”

port

string

specifies the pending port for this RDS instance

Returned: when RDS instance exists

Sample: “null”

port

integer

the listening port of the database instance

Returned: when RDS instance exists

Sample: 3306

publicly_accessible

boolean

the accessibility options for the DB instance

Returned: when RDS instance exists

Sample: “true”

read_replica_source_dbinstance_identifier

string

the identifier of the source DB instance if this RDS instance is a read replica

Returned: when read replica RDS instance exists

Sample: “null”

secondary_availability_zone

string

the name of the secondary AZ for a DB instance with multi-AZ support

Returned: when RDS instance exists and is multi-AZ

Sample: “eu-west-1b”

Status

  • This module will be removed in version 3.0.0. [deprecated]

  • For more information see DEPRECATED.

Authors

  • Bruce Pennypacker (@bpennypacker)

  • Will Thames (@willthames)

Collection links

Issue Tracker Repository (Sources)

Previous Next

© Copyright Ansible project contributors. Last updated on May 19, 2022.