boto/boto — pull request #2320 by prufrax (2014-06-09 16:28:03+00:00)
Title: Allow provider to be passed down in connect calls where it currently cannot be.

Ensure that provider can be passed down to base class when connecting to services, so we can override the default provider class.

The base AWSAuthConnection class will already optionally a provider - and will accept an object derived from Provider rather than just a provider type string like 'aws'.

So if the provider is passable down in all classes derived from AWSAuthConnection, it is possible to derive a class from Provider to do e.g. automatic renewal of creds obtained from boto.sts.assume_role() by overriding the mechanism used to renew creds retrieved from instance metadata, and then pass an instance of this in to be used with a connection to e.g. sdb or dynamodb:

foo = AssumedRoleProvider('arn:aws:iam::someaccount:role/somecrossaccountrole')
sdb_conn = boto.sdb.connect_to_region('us-east-1', provider=foo)

This allows code to be used with same-account (instance) roles or cross-account roles (that need to be assumed) with minimal change.