GetCallerIdentity throws StsException if sts:GetCallerIdentity is not added to the policy #5820
              
                Unanswered
              
          
                  
                    
                      sampathpremarathna
                    
                  
                
                  asked this question in
                Migration from v1 to v2
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In the documentation it states that no permissions are required and we can still call GetCallerIdentity on sts. Yes we could do that with SDK 1 but after migrating to SDK 2, it throws below error.
software.amazon.awssdk.services.sts.model.StsException: User: arn:aws:sts::ACCOUNT:assumed-role/ROLE/12130372ba9a4084a38177acldsj38udfa is not authorized to perform: sts:GetCallerIdentity on resource: Resource because no identity-based policy allows the sts:GetCallerIdentity action.But once below policy added it started to work
This is how I get account ID with SDK 2:
And this is how it was with SDK 1:
STS:2.25.70 is being used
Could you please explain this ?
Beta Was this translation helpful? Give feedback.
All reactions