O'Reilly logo

AWS Tools for PowerShell 6 by Ramesh Waghmare

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating an alarm for an EC2 instance

As discussed, AWS provides in-built metrics for EC2 instances. Before creating an alarm, first let's find out the metrics that are provided by AWS for a specific EC2 Instance. For demonstration, I have an EC2 instance running in my account, which is running Amazon Linux. To find out all the default metrics related to the EC2 instance, you can use the cmdlet Get-CWMetricList. It will list all the default metrics provided for the specific EC2 instance.

PS C:\> $p1 = New-Object Amazon.CloudWatch.Model.DimensionFilterPS C:\> $p1.Name = "InstanceId"PS C:\> $p1.Value = "i-09ca5e201782643e7"PS C:\> Get-CWMetricList -Namespace "AWS/EC2" -Dimension $p1

You have to use a filter, as shown preceding, to get the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required