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.


Instructions for the installation of AWS Tools for PowerShell on Windows, Linux or macOs are available in the User Guide.

The AWS Tools for Windows PowerShell module (AWSPowerShell) is also distributed as part of the AWS Tools for Windows MSI installer.


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 GitHub Repository »

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 »