The AWS Tools for Windows PowerShell lets developers and administrators manage their AWS services from the Windows PowerShell scripting environment. Now you can manage your AWS resources with the same Windows PowerShell tools you use to manage your Windows environment.

AWS Tools for Windows »

The AWS Tools for Windows 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 Windows 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 Windows 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



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 »