This section shows an example of how to use the Tools for Windows PowerShell to publish custom metric data to CloudWatch.
This example assumes that you have set default credentials and a default region for your PowerShell session.
The following PowerShell code initializes an CloudWatch MetricDatum
object and posts it to the service. You can see the result of this operation by navigating to the CloudWatch console.
$dat = New-Object Amazon.CloudWatch.Model.MetricDatum
$dat.Timestamp = (Get-Date).ToUniversalTime()
$dat.MetricName = "New Posts"
$dat.Unit = "Count"
$dat.Value = ".50"
Write-CWMetricData -Namespace "Usage Metrics" -MetricData $dat
Note the following:
The date-time information that you use to initialize $dat.Timestamp
must be in Universal Time (UTC).
The value that you use to initialize $dat.Value
can be either a string value enclosed in quotes, or a numeric value (no quotes). The example shows a string value.
Amazon SQS, Amazon SNS and Tools for Windows PowerShell
Using ClientConfig
Did this page help you? - Yes
Thanks for letting us know we're doing a good job!
If you've got a moment, please tell us what we did right so we can do more of it.
Did this page help you? - No
Thanks for letting us know this page needs work. We're sorry we let you down.
If you've got a moment, please tell us how we can make the documentation better.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4