title: AWS: How to get and use credentials for an IAM Role in NodeJS/ExpressJS
body: <p>For my <strong>ExpressJS/NodeJS</strong> app server, which uses its <strong>own</strong> AWS account, I need to access resources in a <strong>different</strong> AWS account. I have set up an <strong>IAM Role</strong> that should allow my server to access this other AWS account.</p>
  
  <p>But the AWS documentation on how to get the <strong>credentials</strong> using this IAM Role are a little thin. </p>
  
  <p>It seems like I might want to use <strong>AWS.STS's assumeRole()</strong> to get back the credentials. Is that the best way to get credentials for this Role?</p>
  
  <p>And if I use assumeRole(), then once I receive the credentials in its callback, how do make use of them so that subsequent calls to DynamoDB and S3, for example, will operate on this <strong>different</strong> AWS account? Would I set the credentials into <strong>AWS.config.credentials</strong>, for example?</p>
  
  <p>Suggestions and code examples would be most welcome!</p>
  
  <p>Thanks.
  -Allan</p>