cloudyr / aws.s3

Amazon Simple Storage Service (S3) API Client
https://cloud.r-project.org/package=aws.s3
381 stars 148 forks source link

How can I use AWS IAM instance role with this package? #138

Closed v-kumar closed 7 years ago

v-kumar commented 7 years ago

We don't use security credentials and instead use IAM instance roles for authorizing the instances to access S3 resources in EC2. How can I use this package, but using iam_role?

leeper commented 7 years ago

This functionality is not quite conveniently implemented yet. You'll either need to pass instance metadata to every call (see, for example, aws.ec2metadata) or, better, you can grab the development version of aws.signature which will look there automatically if security credentials aren't provided (but you'll have to pass explicit NULL values to the aws.s3 functions as the newest version of aws.signature relies on slightly different default argument values.

leeper commented 7 years ago

This has been configured as of https://github.com/cloudyr/aws.s3/commit/9627d8fe415ab9b293a02256a7e1e7645bd40052. You'll just need to have the aws.ec2metadata package installed to be able to use those credentials, but you shouldn't have to change any other code.