title: Given the user's identity id, how to get the user's details from cognito user pool?
body: <ul>
  <li><p>The user uploads an image to his/her subfolder on S3. The only way this can be enforced with policy is by using identity id:</p>
  
  <pre><code>arn:aws:s3:::thebucket/${cognito-identity.amazonaws.com:sub}/avatar.jpg
  </code></pre></li>
  <li><p>A lambda that transforms that image, is triggered, and saves the transformations to a different S3. </p></li>
  <li><p>But now, with the identity id on disposal, that lambda needs to update the user's db record with the references to the avatar transformations. This is where the issue is evident, I only have the identity id, and from it, I need to get to the cognito user's details so i can look for the user in my users table which has user:sub as identifier.</p></li>
  </ul>
  
  <p>How do I correlate those two? Is there an api in cognito that would give me the <code>sub</code> based on the identity id?</p>
  
  <p>Is there maybe a more reasonable way?</p>