Add support for temp. IAM credentials for S3 access

These credentials are generated and rotated by Amazon for EC2
instances that have an instance role attributed. They are fetched
through the EC2 metadata API.

Note: this code is not fully tested yet and feedback about coding style is also welcome!