title: What's the use case for RoleSessionName when assuming a role in AWS and how it affects the performance
body: <p>I have a scenario in which I want to have access to resources within one account from another one in AWS (cross-account access) in code. And I want to implement this access using NodeJs, implemented as lambda function and also as a long-running code on EC2.</p>
  <p>Reading how to do this online, I know I need temporary credentials generated by <code>aws.STS</code>, like this:</p>
  <pre class="lang-js prettyprint-override"><code>const AWS = require('aws-sdk');
  
  const sts = new AWS.STS();
  const stsResults = await sts.assumeRole({
      RoleArn: 'arn:aws:iam::111111111111:role/role_name',
      RoleSessionName: 'STRING_VALUE',
  }).promise();
  
  const dynamodb = new AWS.DynamoDB({
      region: 'us-east-1', 
      accessKeyId: stsResults.Credentials.AccessKeyId, 
      secretAccessKey:stsResults.Credentials.SecretAccessKey, 
      sessionToken: stsResults.Credentials.SessionToken
  });
  </code></pre>
  <p>My question is about the <code>RoleSessionName</code> attribute which is a required one. I'm having a hard time understanding what it does and how I should use it. This is what <a href="https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/STS.html#assumeRole-property" rel="noreferrer">the AWS documentation</a> has to say about it:</p>
  <blockquote>
  <p>RoleSessionName — (String) An identifier for the assumed role session.</p>
  <p>Use the role session name to uniquely identify a session when the same
  role is assumed by different principals or for different reasons. In
  cross-account scenarios, the role session name is visible to, and can
  be logged by the account that owns the role. The role session name is
  also used in the ARN of the assumed role principal. This means that
  subsequent cross-account API requests that use the temporary security
  credentials will expose the role session name to the external account
  in their AWS CloudTrail logs.</p>
  <p>The regex used to validate this parameter is a string of characters
  consisting of upper- and lower-case alphanumeric characters with no
  spaces. You can also include underscores or any of the following
  characters: =,.@-</p>
  </blockquote>
  <p>Personally, I'm not concerned about security since both accounts are owned by the same company and the only reason to have multiple accounts is to logically separate resources. What I would like to know is the impact of this attribute on the performance of the <code>assumeRole</code> function call. Should I use the same <code>RoleSessionName</code> for all my lambda functions? Should I create a random ID each time I create a new session?</p>