# AWS retries upon throttling errors

**URL:** <https://forum.ansible.com/t/aws-retries-upon-throttling-errors/21095>\
**Category:** Ansible Developer\
**Tags:** aws\
**Created:** [April 7, 2016, 4:00pm UTC](https://forum.ansible.com/t/aws-retries-upon-throttling-errors/21095 "2016-04-07T16:00:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joel\_Thompson](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Joel\_Thompson](https://forum.ansible.com/u/Joel_Thompson)\
**Post date:** [April 7, 2016, 4:00pm UTC](https://forum.ansible.com/t/aws-retries-upon-throttling-errors/21095/1 "2016-04-07T16:00:54Z")

</div>

Hi everybody,

I’ve seen a number of Ansible module PRs lately which add retries upon throttling errors, and some have been done in different ways. For example, I just submitted [https://github.com/ansible/ansible-modules-core/pull/3379](https://github.com/ansible/ansible-modules-core/pull/3379) which uses a decorator method to enable easy retries. Another approach is in [https://github.com/ansible/ansible-modules-core/pull/2968](https://github.com/ansible/ansible-modules-core/pull/2968) in which you pass in the function and arguments to a separate function which handles the retries for you.

With the first method (i.e., a decorator), I think it’s syntactically prettier when you want to retry your own methods, but it’s a little uglier to retry just raw AWS calls (since you can’t use the @ decorator syntax on boto methods). With the second method, it’s a little uglier, but consistent across everything. I’m fairly ambivalent between the two.

Regardless of which method people think is better, I think that it would be good to just have a standardized way of doing this, probably implemented as a method in module\_utils.ec2, that people could call. Brian Coca said he was working on an experimental branch, but it looks to have since been deleted.

What do you all think of putting something like this in module\_utils.ec2?

–Joel

---

<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:** [April 7, 2016, 4:32pm UTC](https://forum.ansible.com/t/aws-retries-upon-throttling-errors/21095/2 "2016-04-07T16:32:14Z")

</div>

Thank you for bringing this up and I personally prefer to use a decorator. I was getting ready to write one for the module PR’s that I have in place as I have hit the issue the other day as well. +1 for decorator
