title: IAM SDK AmazonIdentityManagement; Status Code: 404; Error Code: NoSuchEntity;
body: <pre class="lang-java prettyprint-override"><code>AmazonIdentityManagementClient identityManagementClient = new AmazonIdentityManagementClient();
  
  System.out.println("This is the role");
  GetRoleResult roleResult = identityManagementClient.getRole(new GetRoleRequest().withRoleName("myRole"));
  System.out.println(roleResult.getRole().toString());
  
  System.out.println("This is the Policy");       
  GetRolePolicyResult rolePolicyResult  = identityManagementClient.getRolePolicy(new GetRolePolicyRequest()
          .withRoleName("myRole").withPolicyName("AmazonS3FullAccess"));
  
  System.out.println(rolePolicyResult.getPolicyDocument());
  System.out.println(rolePolicyResult.getPolicyName());
  </code></pre>
  
  <p>I have attached IAM role to my instance - myRole. I have attached it <code>AmazonS3FullAccess</code> policy to myRole. The above code I am using to fetch the policies associated with myRole using SDK but I am facing NoSuchEntity Exception when I try to fetch Policy. I am able to get Role name and my output is myRole but I am facing error when I try to fetch Policy details.</p>
  
  <p>I don't know why.<br>
  What I am doing wrong here?</p>