IronTom
IronTom

Reputation: 13

How do I stop an AWS RDS instance with Ansible?

How do I stop an RDS instance with Ansible rds_instances module?

ansible --version

ansible 2.9.10

I am trying with the following:

- name: Stopping RDS instances for
  rds_instance:
    id: "instance_id" # I have tried also db_instance_identifier, and tried using multiple values from rds_info...
    state: stopped

I will get the following error:

To create DB instance requires the parameters: ['DBInstanceIdentifier', 'DBInstanceClass', 'Engine']

If I specify the missing parameters (although those are not marked as required in the docs), I will get a different error:

The error was: botocore.exceptions.ClientError: An error occurred
(InvalidParameterValue) when calling the CreateDBInstance operation:
Invalid master password

Debug does not yield any more new answers.

Upvotes: 0

Views: 728

Answers (1)

IronTom
IronTom

Reputation: 13

Doh.

I was missing the profile/region parameters, hence it was not able to find the RDS instance. It was looking in a completely different AWS account, because using the default profile. Ansible didn't find the DB, so failed with a creation error.

- name: Stopping RDS instances for
  rds_instance:
    id: "instance_id"
    state: stopped
    profile: "{{ profile }}"
    region: "{{ region }}"

Upvotes: 1

Related Questions