I have three AWS accounts and I login from powershell to run script from every account. But as I frequently changes the AWS key ID, it is not taking other 2 accounts credentials and giving me only resource form one account. I have deleted the .AWS folder from my user account but still it is taking one default credentials. I run the get-stscalleridentity (in powershell) and over there i found that credentials which has been default.
Asked
Active
Viewed 45 times
0
-
`I login from powershell to run script from every account` please provide the powershell code as well – Amit Baranes Feb 12 '20 at 09:30
-
that is where it gets goofs up. It just picks up the one account access key and secret access key id (older one). even if i have updated the secret access and access key id from "Aws Configure " commands but still picks up the older one. I don't how to delete that.. – Rohit Singh Feb 12 '20 at 19:14
-
you should be able to achieve by using profiles with different accesskey/secret for diff accounts ; Get-EC2Instance -ProfileName xyz. More information https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials_profiles.html – Ketanbhut May 20 '20 at 20:30