In this post you will learn how to install the AWS Tools for PowerShell Core. The AWS (Amazon Web Services) Tools for PowerShell Core are modules built upon functionalities exposed by the AWS SDK (Software Development Kit) for .NET. With this, you can automate and operate on AWS resources from a PowerShell command line.

The AWS Tools are also available for Windows PowerShell. However, here I focus on PowerShell Core 6.

Managing AWS with PowerShell

The AWS Tools for PowerShell Core support almost all AWS resources and services. Some of the tools include:

  • Compute and Networking: Amazon Elastic Compute Cloud (EC2), Elastic Load Balancing, Route 53, Virtual Private Cloud (VPC)
  • Database: Amazon Relational Database Service (RDS), Redshift, ElastiCache
  • Storage and Content Delivery: Amazon Simple Storage Service (S3), CloudFront
  • Deployment and Management: AWS Elastic Beanstalk, CloudFormation, CloudWatch, Identity and Access Management (IAM)
  • App Services: Amazon Simple Queue Service (SQS), Simple Notification Service (SNS), Simple Email Service (SES)

For instance, you can restart all EC2 instances in AWS and check their system status with these PowerShell commands:

Get-EC2Instance | Restart-EC2Instance -Verbose
Get-EC2InstanceStatus | ForEach-Object SystemStatus

Advantages of PowerShell AWS tools

AWS also provides a variety of command-line interfaces (AWS CLI), toolkits, and SDKs for all major programming and scripting languages. In my view, PowerShell offers a few advantages over the other options Amazon provides:

  1. All PowerShell cmdlets follow a verb-noun syntax, which make it easy to construct commands.
  2. To discover cmdlets in PowerShell, you can use Get-Command with wildcards to list the available cmdlets in AWS Tools for PowerShell Core:
    Get-Command *LMFunction -Module AWSPowerShell.NetCore
  3. PowerShell usually delivers output as objects, which makes it easier to filter and manipulate data than with the text-based output as in the AWS CLI.
  4. PowerShell Core supports tab completion, pipelines, and remote command execution using PowerShell remoting.
  5. The AWS Tools for PowerShell Core work on Windows, Linux, and macOS.
  6. The AWS Tools for PowerShell Core give access to .NET Core classes, which can be very useful in a variety of scenarios.

Install AWS Tools for PowerShell Core

The first step is the AWS access key ID and secret access key. I assume here you already have an AWS account. I recommend you create an IAM user for accessing AWS via PowerShell. With the help of the IAM user's AWS access key and secret access key, you can authenticate your PowerShell session to AWS. The procedure below describes how you can create both keys.

  1. Launch the IAM console in AWS.
  2. From the navigation menu at the left of the screen, click Users.
  3. In the pop-up window, click on Add User.
    Create a new user in the AWS IAM console

    Create a new user in the AWS IAM console

  4. Now in the new window, provide a User name, select the Access type as Programmatic Access, and then click Next.
    Choosing the Access type for the new user

    Choosing the Access type for the new user

  5. To set the permissions, choose Attach existing policies directly. In the Policy type filter Administrator, you can choose any permission level. For example, I'll click the checkbox next to AdministratorAccess and then click the Next

    Set user permissions

    Set user permissions

  6. Finally, in the next step after reviewing your user and permission levels, click the Create user button.
  7. On the next page, you'll find your keys. Note only one is visible. Thus, you have to download and save them at the secure location.
    Access key and secret key

    Access key and secret key

Install the AWSPowerShell.NetCore package

Next, you have to install the AWSPowerShell.NetCore package. The AWS Tools for PowerShell Core are only accessible via the PowerShell Gallery, and no MSI installer is available. You can install the module by using following commands from a PowerShell console running as an administrator:

Install-Module -Scope CurrentUser -Name AWSPowerShell.NetCore -Force
Installing and importing AWS Tools for PowerShell

Installing and importing AWS Tools for PowerShell

Initialize AWS Tools

All AWS PowerShell Tools cmdlets expect a set of AWS credentials to sign the web service request cryptographically. You can specifically provide credentials whenever you run a command or can provide the credentials at a session level.

To initialize credentials and the region in the current PowerShell Core session, you have to provide the access key ID and the secret key obtained earlier in this article. Then select the region, which should be the nearest to your location to avoid latency issues.

The following commands will import the module and initialize the defaults in your session:

Import-Module AWSPowerShell.NetCore

$param = @{
    Region = 'ap-south-1'

Initialize-AWSDefaults @param
Initializing the console with default credentials

Initializing the console with default credentials

If you are unsure which regions to choose, you can run the Get-AWSRegion cmdlet to obtain a list of regions.

You can add the above lines to your PowerShell profile. This way, your credentials will be available in every new PowerShell session.

notepad.exe $profile

If you don't want to store your credentials in clear text (recommended), you can create a profile and save the profile in a credential store. Amazon's documentation offers detailed instructions on how to work with profiles and credentials stores.

Updates and versioning

Whenever a new version of AWS Tools for PowerShell core is available, you can update it from the PowerShell console using this command:

Update-Module AWSPowershell.NetCore

And this command reads the version number of the AWS Tools and lists service version information:

Get-AWSPowerShellVersion –ListServiceVersionInfo

Cmdlet discovery

To manage an AWS resource or service with AWS Tools for PowerShell Core, you first need to identify the corresponding cmdlets. You can use the Get-CmdletName cmdlet for this purpose with the -Service and -ApiOpertion parameters to filter out services and their respective cmdlet names:

Get-AWSCmdletName -Service compute -ApiOperation StartInstances
Get-AWSCmdletName -Service cloudwatch -ApiOperation list -MatchWithRegex
Discovering cmdlets in AWS Tools

Discovering cmdlets in AWS Tools

If you want a more detailed description of the cmdlets, you can also use following code sample:

Subscribe to 4sysops newsletter!

Get-Command set*ec2* -Module AWSPowershell.netcore |
ForEach-Object {
    [PSCustomObject] @{
        'Name' = $
        'Description' = (get-help $
} | Format-Table -Wrap
List cmdlets with descriptions

List cmdlets with descriptions


This article only scratched the surface of the AWS Tools for PowerShell Core. I prefer to manage AWS with PowerShell instead of the other available toolkits and SDKs because I have access to .NET libraries and can work with features such as pipelines and PowerShell remoting. What is your favorite interface for AWS?


Leave a reply

Please enclose code in pre tags

Your email address will not be published.


© 4sysops 2006 - 2023


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account