0

I need to find the ARN for my Db instance using facts keyword provided at RDS Module. The following is a basic play:

- name: Get The RDS Facts from AWS
  rds:
    command: facts
    region: '{{ aws_region }}'
    instance_name: '{{ source_rds_instance_name  }}'
  register: db_facts

The play's output:

TASK: [read_replica_rds | Get The RDS Facts from AWS] ************************* 
ok: [127.0.0.1] => {
   "changed":false,
   "instance": {
      "availability_zone":"ap-southeast-2a",
      "backup_retention":7,
      "create_time":1473670897.052,
      "endpoint":"test-for-cross-region.oe451o1vbl45.ap-southeast-2.rds.amazonaws.com",
      "id":"test-for-cross-region",
      "instance_type":"db.m3.medium",
      "iops":null,
      "maintenance_window":"wed:14:00-wed:14:30",
      "multi_zone":false,
      "port":3306,
      "replication_source":null,
      "status":"available",
      "username":"root",
      "vpc_security_groups":"sg-d3b9e7b7"
   }
}

Since the ARN is not provided in the output, how to retrieve it?

bman
  • 5,016
  • 4
  • 36
  • 69
Kittystone
  • 661
  • 3
  • 9
  • 28

1 Answers1

1

I guess there is no ARN property for DBInstance object in boto.

Why don't you just construct the ARN knowing the instance name?

arn:aws:rds:<region>:<account-id>:db:<db-instance-name>
Konstantin Suvorov
  • 65,183
  • 9
  • 162
  • 193