AWS - Assume IAM using PowerShell on an instance AWS - Assume IAM using PowerShell on an instance powershell powershell

AWS - Assume IAM using PowerShell on an instance


However I can't shake the feeling that I've missed something from the AWS PowerShell module that is already taking care of this for me.

:) - you will be delighted to hear that this simply works out of the box indeed, i.e. the AWS Tools for Windows PowerShell is build upon the AWS SDK for .NET, which is handling this automatically, see also Credentials Search Order:

When you run a command, PowerShell Tools searches for credentials in the following order and uses the first available set.

[...]

6) If you are using running the command on an Amazon EC2 instance that is configured for an IAM role, use EC2 instance credentials stored in an instance profile.

For more information about using IAM roles for Amazon EC2 Instances, go to the AWS Developer Guide for .NET.