Amazon-rds – Failed to create instance: Standalone DB Instances are not supported for Amazon RDS Aurora

amazon-rds

Question

What is the cause of Failed to create instance: Standalone DB Instances are not supported for Amazon RDS Aurora? Run the ansible script to create RDS Aurora but getting the error. If "aurora" is changed to "MySQL", no issue.

Ansible Script (Role)

- rds:
    region:          "{{ ec2_region }}"
    zone:             "{{ ec2_zone }}"
    command: create
    instance_name: new-database
    db_engine: "aurora"
    size: 20
    instance_type: db.t2.small
    username: admin
    password: 1nsecure

Error Message

fatal: [localhost]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "apply_immediately": false,
            "aws_access_key": null,
            "aws_secret_key": null,
            "backup_retention": null,
            "backup_window": null,
            "character_set_name": null,
            "command": "create",
            "db_engine": "aurora",
            "db_name": null,
            "ec2_url": null,
            "engine_version": null,
            "force_failover": false,
            "instance_name": "new-database",
            "instance_type": "db.t2.small",
            "iops": null,
            "license_model": null,
            "maint_window": null,
            "multi_zone": null,
            "new_instance_name": null,
            "option_group": null,
            "parameter_group": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 3306,
            "profile": null,
            "publicly_accessible": null,
            "region": "ap-southeast-2",
            "security_groups": null,
            "security_token": null,
            "size": "20",
            "snapshot": null,
            "source_instance": null,
            "subnet": null,
            "tags": null,
            "upgrade": false,
            "username": "mysql_admin",
            "validate_certs": true,
            "vpc_security_groups": null,
            "wait": false,
            "wait_timeout": 300,
            "zone": "ap-southeast-2a"
        }
    },
    "msg": "Failed to create instance: Standalone DB Instances are not supported for the specified engine"
}

Research

Add RDS support for dbengine Aurora #3180 tells below but not sure how to add the cluster in RDS Ansible.

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to create instance: Standalone DB Instances are not supported for the specified engine"}

It's because you need to have an Aurora cluster created before you try and create the Aurora instance and you must pass the cluster name as one of the arguments when calling the create_db_instance API action.

Best Answer

Aurora databases use the database cluster API rather than the database API.

This means in terraform for instance you need to create them via the rds_cluster and rds_cluster_instance resources.

In ansible using this module might work: https://github.com/manicminer/ansible-modules-rds-cluster