0
0
AWScloud~10 mins

CloudWatch metrics in AWS - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - CloudWatch metrics
Start Monitoring
Collect Metrics Data
Send Data to CloudWatch
CloudWatch Stores Metrics
User Views Metrics & Sets Alarms
Alarms Trigger Actions if Thresholds Met
End
Metrics data is collected from resources, sent to CloudWatch, stored, and then users can view or set alarms that trigger actions.
Execution Sample
AWS
aws cloudwatch put-metric-data --namespace MyApp --metric-name PageViews --value 100
This command sends a metric named PageViews with value 100 to CloudWatch under the MyApp namespace.
Process Table
StepActionInput/ConditionCloudWatch StateOutput/Result
1Start MonitoringResource begins sending metricsNo metrics stored yetReady to receive data
2Collect Metrics DataPageViews = 100No metrics stored yetMetric data prepared
3Send Data to CloudWatchPutMetricData command with PageViews=100Receives metric dataMetric stored under MyApp/PageViews
4CloudWatch Stores MetricsMetric data receivedPageViews metric stored with value 100Data available for queries
5User Views MetricsUser queries PageViews metricMetric data storedDisplays value 100
6User Sets AlarmThreshold set at 90Metric data storedAlarm created for PageViews > 90
7Metric Value UpdatesNew value 85 sentPageViews metric updated to 85Alarm not triggered
8Metric Value UpdatesNew value 95 sentPageViews metric updated to 95Alarm triggered
9Alarm Triggers ActionAlarm state ALARMAlarm activeNotification or action executed
10EndMonitoring continuesMetrics and alarms activeSystem ready for next data
💡 Monitoring continues indefinitely; this trace shows one cycle of metric data flow and alarm triggering.
Status Tracker
VariableStartAfter Step 2After Step 4After Step 7After Step 8Final
PageViews Metric ValueNone100100859595
Alarm StateINSUFFICIENT_DATAINSUFFICIENT_DATAINSUFFICIENT_DATAOKALARMALARM
Key Moments - 3 Insights
Why does the alarm not trigger when the metric value is 85 even though the threshold is 90?
Because 85 is less than the threshold 90, so the alarm state remains OK as shown in step 7 of the execution_table.
What happens inside CloudWatch when metric data is sent?
CloudWatch stores the metric data under the specified namespace and metric name, making it available for queries and alarms, as seen in step 4.
Can metrics be viewed before setting alarms?
Yes, metrics are stored and can be viewed anytime after data is sent, before alarms are set, as shown in step 5.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the PageViews metric value after step 7?
A100
B95
C85
DNone
💡 Hint
Check the 'PageViews Metric Value' row in variable_tracker after step 7.
At which step does the alarm state change to ALARM?
AStep 8
BStep 6
CStep 7
DStep 9
💡 Hint
Look at the 'Alarm State' variable in variable_tracker and the execution_table rows for alarm triggering.
If the threshold was set to 80 instead of 90, at which step would the alarm trigger?
AStep 6
BStep 7
CStep 8
DStep 9
💡 Hint
Compare metric values at steps 7 and 8 with the new threshold and check alarm state changes.
Concept Snapshot
CloudWatch metrics collect data from resources.
Data is sent using PutMetricData commands.
Metrics are stored under namespaces and names.
Users can view metrics and set alarms.
Alarms trigger actions when thresholds are crossed.
Full Transcript
CloudWatch metrics work by collecting data from your resources and sending it to CloudWatch. This data is stored and can be viewed anytime. You can set alarms on these metrics to notify or act when certain thresholds are met. For example, sending a PageViews metric with value 100 stores it in CloudWatch. If you set an alarm at 90, it will trigger when the metric value goes above 90. This process repeats continuously as new data arrives.