title: How to use AmazonSTS with aws php sdk?
body: <p>I am trying to use the aws sdk for php to create temporary credentials for a user. From what I can gather it should just be a case of adding the sts policy through IAM for my sdk user:</p>
  
  <pre><code>{
    "Statement": [
      {
        "Sid": "Stmt1349820612345",
        "Action": "sts:*",
        "Effect": "Allow",
        "Resource": "*"
      }
    ]
  }
  </code></pre>
  
  <p>and then instantiating the sts class as shown in the example:</p>
  
  <pre><code>  // Instantiate the class
    $token = new AmazonSTS();
  
  // Generate a new IAM policy
    $policy = new CFPolicy($token, array(
      'Statement' =&gt; array(
        array(
          'Sid' =&gt; 'SID' . time(),
          'Action' =&gt; array(
            's3:ListBucket'
          ),
          'Effect' =&gt; 'Allow',
          'Resource' =&gt; 'arn:aws:s3:::my-bucket'
        )
      )
    ));
  
  // Fetch the session credentials
    $response = $token-&gt;get_federation_token('my-user', array(
      'Policy' =&gt; $policy-&gt;get_json(),
      'DurationSeconds' =&gt; 3600
    ));
  
    $credentials = $response-&gt;body-&gt;GetFederatedTokenResult-&gt;Credentials
      -&gt;to_array()-&gt;getArrayCopy();
    return $credentials;
  </code></pre>
  
  <p>It works fine when I use the regular temporary credentials token:</p>
  
  <pre><code>$token = new AmazonSTS();
  $response = $token-&gt;get_session_token();
  
  $credentials = $response-&gt;body-&gt;GetSessionTokenResult-&gt;Credentials-&gt;to_array()-&gt;getArrayCopy();
  </code></pre>
  
  <p>Does anyone have a working example of this or can see where I am going wrong?</p>