Add a configurable number of retries to the EC2 credential provider

In our production environment which uses IAM instance roles exclusively we have configured the EC2 provider as the only valid provider of credentials. However we experience sometimes intermittent timeouts on the metadata-service. In order to avoid the dreaded credential error, we are now able to retry the request for a number of times.

Should fix #587 as well.