mhart / aws4

Signs and prepares Node.js requests using AWS Signature Version 4
MIT License
699 stars 175 forks source link

Getting temporary credentials via IAM role associated with instance profile #131

Open mokshjawa opened 3 years ago

mokshjawa commented 3 years ago

If I have an EC2 instance running with an IAM role attached to the instance profile that gives the instance permission to hit a certain API, I would want the temporary credentials generated by the instance be used to sign my API request. How can I do that with the sign() method? If I don't provide credentials to the function, I see "it can get credentials from process.env.AWS_ACCESS_KEY_ID, etc." However, is there any way to get the temporary credentials from the instance?