The AWS Tools for PowerShell let developers and administrators manage their AWS services and resources in the PowerShell scripting environment. Now you can manage your AWS resources with the same PowerShell tools you use to manage your Windows, Linux, and MacOS environments.

AWS Tools for Windows Installer

The download is a Microsoft Software Installer (MSI) package that installs the following components when you run it. Be sure to meet any prerequisites before you run the installer.

  • Microsoft .NET Framework Features
  • AWS SDK for .NET
  • AWS Tools for Windows PowerShell
  • AWS Command Line Interface

The download runs only on Windows operating systems. To install .NET Core and AWS Tools for PowerShell Core on non-Windows operating systems, follow instructions in Setting up the AWS Tools for PowerShell Core on Linux or macOS in the AWS Tools for PowerShell documentation.


The AWS Tools for PowerShell lets you perform many of the same actions available in the AWS SDK for .NET. You can use it from the command line for quick tasks, like controlling your Amazon EC2 instances.

 

PS C:\> Start-EC2Instance -InstanceIds i-10a64379

The PowerShell scripting language lets you compose scripts to automate your AWS service management. The following example loops through a log directory on an EC2 instance, finds files older than one week, and then archives any non-empty ones to Amazon S3 before deleting the old log file from disk

 

foreach ($i in Get-ChildItem C:\Logs)
{
if ($i.CreationTime -lt ($(Get-Date).AddDays(-7)))
{
if ($i.Length -gt 0)
{
Write-S3Object -BucketName mylogbucket -Key Logs/$i -File $i.FullName
}
Remove-Item $i.FullName
}
}

Lastly, with direct access to AWS services from PowerShell, your management scripts can now take advantage of everything the AWS cloud has to offer.

 

# Catch an error and page all operators subscribed to the Amazon SNS topic Publish-SNSMessage -TopicArn arn:aws:sns:us-east-1:365928882516:OperationsError -Subject "Database Backup Failure" -Message "(details...)"


# Publish a custom metric to your Amazon CloudWatch dashboard

$dat = New-Object Amazon.CloudWatch.Model.MetricDatum

$dat.Timestamp = (Get-Date).ToUniversalTime()

$dat.MetricName = "New Posts"

$dat.Unit = "Count"

$dat.Value = $newPostCount

Write-CWMetricData -Namespace "Usage Metrics" -MetricData $dat


After you install the AWS Tools for PowerShell, run the following command to get version information and a list of AWS services that are currently supported by the Tools for PowerShell:

Get-AWSPowerShellVersion -ListServiceVersionInfo

Find examples and more in the User Guide »

Connect with other developers in the PowerShell Community Forum »

Discover more about using Windows with AWS in the Windows & .NET Developer Center »

Learn the details of the latest PowerShell tools in the Release Notes »