Search code examples
powershellamazon-web-servicesaws-lambdapowershell-cmdlet

ObjectNotFound Error while using cmdlet to access AWS IAM


I am trying to generate AWS API gateway access key through powershell. However, everytime I try to use any cmdlet it throws an error:

For example:

 Get-AWSCredential -ListProfileDetail

will result in an error like this:

Get-AWSCredential : The term 'Get-AWSCredential' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Get-AWSCredential -ListProfileDetail + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Get-AWSCredential:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

When I display the list of commands through Get-Command the AWS cmdlets do not pop up. Any idea what could be the problem?


Solution

  • Long story short, run this: Install-Package -Name AWSPowerShell

    You may need to run PS as an Administrator for the Install-Package command to work. Additionally, you may be prompted to install 'nuget', answer yes. If you receive the security warning about PSGallery, answer yes.

    Here is Amazon's docs on PS cmdlets: http://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up.html