title: How to pass Session Token of temporary user that is retrieved with FederatedTokenResult to AWS - Java SDK?
body: <p>I can get a <a href="http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/securitytoken/model/Credentials.html" rel="nofollow noreferrer">Credential</a> from <a href="http://docs.aws.amazon.com/AWSAndroidSDK/latest/javadoc/com/amazonaws/services/securitytoken/model/GetFederationTokenResult.html" rel="nofollow noreferrer">FederatedTokenResult</a> by querying AWS. Now, I want that credential to be used by another service to create an application stack using CloudFormation API - I can create that with using my root account which I don't want. But as I read from <a href="http://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html" rel="nofollow noreferrer">GetFederationToken</a> and <a href="http://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html" rel="nofollow noreferrer">Credential Page</a>, I must must pass to the service API to use the temporary credentials.</p>
  
  <p>Is it possible to do things with temporary users (given permissions) to launch a stack, creating a new Key-Pair? Any links, code snippets are highly appreciated.</p>
  
  <p>Seems <a href="https://stackoverflow.com/questions/12109167/how-to-use-iam-role-to-access-resources-using-temporary-credentials">ruby sdk</a> provides for session tokens. How do I get it done in Java ?</p>
  
  <p>At the moment I create the stack that is similar to CloudFormation given as sample with AWS SDK which does not use temporary credentials.</p>