# Creating an RDS from another RDS's latest automated snapshot

**URL:** <https://forum.ansible.com/t/creating-an-rds-from-another-rdss-latest-automated-snapshot/22859>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [October 21, 2016, 8:57pm UTC](https://forum.ansible.com/t/creating-an-rds-from-another-rdss-latest-automated-snapshot/22859 "2016-10-21T20:57:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lattwood](https://avatars.discourse-cdn.com/v4/letter/l/3ab097/32.png) [@lattwood](https://forum.ansible.com/u/lattwood)\
**Post date:** [October 21, 2016, 8:57pm UTC](https://forum.ansible.com/t/creating-an-rds-from-another-rdss-latest-automated-snapshot/22859/1 "2016-10-21T20:57:07Z")

</div>

I’m working on porting a shell script over to ansible, and I’m trying to capture the ARN of the latest automated snapshot **without** using the aws-cli or creating a standalone module. The shell command that would produce the value I’m looking for is

aws rds describe-db-snapshots   
–query ‘DBSnapshots[?DBInstanceIdentifier==`DB-INSTANCE-NAME`&&SnapshotType==`automated`].{Arn: DBSnapshotArn}’   
–output text | tail -n1

where DB-INSTANCE-NAME is replaced with the actual db instance name.

Coming from Puppet, I would create a parser function inside my roles or profile module written in Ruby. Is there a way to have dynamic variables kept close/in the playbooks, written in python?

Thanks

---

<div class="post-metadata">

**Author:** ![Allen\_Sanabria1](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@Allen\_Sanabria1](https://forum.ansible.com/u/Allen_Sanabria1)\
**Post date:** [October 21, 2016, 9:59pm UTC](https://forum.ansible.com/t/creating-an-rds-from-another-rdss-latest-automated-snapshot/22859/2 "2016-10-21T21:59:08Z")

</div>

You can write a Filter Plugin and use that. Here are some that I have written and you can use that as an example. [https://github.com/linuxdynasty/ld-ansible-filter-plugins](https://github.com/linuxdynasty/ld-ansible-filter-plugins)  
In this example playbook, you can see how I use them. [https://github.com/linuxdynasty/ansible-examples/tree/master/playbooks](https://github.com/linuxdynasty/ansible-examples/tree/master/playbooks)  
You can also read my blog post about it [http://linuxdynasty.org/ansible-filters-and-how-they-can-make-aws-your-playbooks-dynamic/](http://linuxdynasty.org/ansible-filters-and-how-they-can-make-aws-your-playbooks-dynamic/).

You can see how much I love Filters 🙂
