AWS Tools for PowerShell Core on Linux and OS X

My last post focused on how to use PowerShell Core on Ubuntu 14.04, 16.04, and OS X 10.11.6 to connect to and manage your Azure subscription. Today’s post will focus on how to use PowerShell Core to connect to your AWS account.

Notably, the AWSPowerShell.NetCore module is built on top of the .NET Core version of the AWS SDK for .NET, which is currently in beta. More on the specific details can be read in Amazon’s blog post.

As of the time of this writing, you will use the following command to install the AWSPowerShell.NetCore package, however after GitHub Issue 202 is resolved, you will be able to install the module using the Install-Module cmdlet since the module is available on the PowerShell Gallery.

Again, for reference, the destination folders you can choose by default are:

– /Users/[username]/.local/share/powershell/Modules (OS X 10.11.6)
– /usr/local/microsoft/powershell/6.0.0-alpha.9/Modules (OS X 10.11.6)
– /home/[username]/.local/share/powershell/Modules (Ubuntu 14.04 and 16.04)
– /opt/microsoft/powershell/6.0.0-alpha.9/Modules (Ubuntu 14.04 and 16.04)
– /usr/local/share/powershell/Modules (Ubuntu and OS X)

If you wish to use a folder other than the ones listed below, you will need to update the $ENV:PSMODULEPATH.

After you run the above command to install the package, you will then use the Import-Module cmdlet to import the AWSPowerShell.NetCore module. The full command would be:

That’s it!

Reminder: All of my posts are provided "AS IS", imply no warranties, and confer no rights or special privileges. Use of included postings, code samples and other works are subject to the terms specified at Microsoft. For more information, click here.

Comments 3

  • I have difficulties installing AWS Tools for PowerShell Core Edition on OSX 10.11.6
    Powershell for OSX is installed and working

    When I try to run:

    Install-Package -Name AWSPowerShell.NetCore -Source https://www.powershellgallery.com/api/v2/ -ProviderName NuGet -ExcludeVersion -Destination /usr/local/share/powershell/Modules

    I get an error:

    Install-Package : Unable to find package providers (NuGet).
    At line:1 char:1
    + Install-Package -Name AWSPowerShell.NetCore -Source https://www.power
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (Microsoft.Power….InstallPack
    age:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageMan
    agement.Cmdlets.InstallPackage

    Any idea what could be wrong?

    • Hi Steven,

      Did you check out my previous post on installing the AzureRM module for PowerShell Core on OS X? As mentioned in that post, there is a current GitHub issue where the PowerShell package for OS X is missing the .NET Core pre-requisite components.

      “For Mac OS X 10.11.6 users specifically, as mentioned in issue 1874 and issue 1994 the PowerShell package for OS X is missing .NET Core pre-requisite components. This known [and reported] issue impacts some of the PowerShell cmdlets, including a lack of PowerShell Package Providers by default, and other commands such as Invoke-RestMethod as mentioned in issue 1919. With that in mind, the workaround at the time of this writing is to install .NET Core for Mac OS X. Until you do so, the Install-Package command will not work on OS X 10.11.6 El Capitan.”

      You can check this by typing the following: Get-PackageProvider -ListAvailable before installing .NET Core for OS X and then after. After a successful .NET Core install, you should see both NuGet and PowerShellGet present as available package providers.

      Thanks!

      • Jessica, you are awesome!

        I did not read the other article as it (quick glance) was about Azure and did not relate this to AWS and my issue.
        Your suggestion to install .Net Core for Mac OS X helped tremendously. In fact, I have AWS Powershell for .NET Core installed now!

        Many thanks for your effort and time to help me out, super appreciated!

        Best Regards,
        Steven Spierenburg

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.