KBI 311482 AWS Use PowerShell Rule To Monitor AWS
Version
Argent for AWS 5.1A-1610-A and later
Date
Thursday, 1 December 2016
Summary
The AWS Tools for Windows PowerShell lets developers and administrators manage their AWS services from the Windows PowerShell scripting environment
PowerShell Rule in Argent for AWS combined with this toolkit provides a complete programming environment, allowing ultimate flexibility to monitor AWS
Credentials of AWS object can be passed to the script through following keywords:
|
– | AWS key Id | ||
|
– | AWS secret key | ||
|
– | AWS region | ||
|
– | EC2 instance | ||
To install AWS Tools for Windows PowerShell, it is as simple as running command within PowerShell
For more detail, see http://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up.html
A sample script is shown as follows:
$rsp = get-ec2instance -accesskey $PSPlayer.GetNodeParam(“KEYID”) -secret $PSPlayer.GetNodeParam(“SECRET”) -region $PSPlayer.GetNodeParam(“REGION”) -instanceid $PSPlayer.GetNodeParam(“INTERNAL”)
$rsp.instances | ForEach-Object {
$message = [string]::Format(“Instance State ({0}): {1}”, $PSPlayer.TargetServer, $_.state.name)
$PSPlayer.WriteStatus($message)
}
For details of various cmdlets, see AWS Tools for Windows PowerShell User Guide
http://docs.aws.amazon.com/powershell/latest/userguide/
Technical Background
N/A
Resolution
N/A