0
0
AWScloud~5 mins

Operational excellence pillar in AWS - Commands & Configuration

Choose your learning style9 modes available
Introduction
Operational excellence helps you run your cloud systems smoothly and improve them over time. It focuses on making sure your services work well, problems are fixed quickly, and changes are done safely.
When you want to monitor your cloud applications to catch issues early.
When you need to automate tasks to reduce manual work and errors.
When you want to learn from failures and improve your system continuously.
When you want to safely deploy updates without causing downtime.
When you want to document and follow best practices for your cloud operations.
Commands
This command creates a CloudWatch alarm that watches the CPU usage of an EC2 instance. It alerts you if CPU usage goes above 80% for two consecutive periods of 5 minutes, helping you catch performance issues early.
Terminal
aws cloudwatch put-metric-alarm --alarm-name HighCPUUtilization --metric-name CPUUtilization --namespace AWS/EC2 --statistic Average --period 300 --threshold 80 --comparison-operator GreaterThanThreshold --dimensions Name=InstanceId,Value=i-0123456789abcdef0 --evaluation-periods 2 --alarm-actions arn:aws:sns:us-east-1:123456789012:MySNSTopic --unit Percent
Expected OutputExpected
No output (command runs silently)
--alarm-name - Names the alarm for easy identification.
--threshold - Sets the CPU usage level that triggers the alarm.
--alarm-actions - Specifies what happens when the alarm triggers, like sending a notification.
This command checks the status and details of the alarm you created to make sure it is set up correctly and active.
Terminal
aws cloudwatch describe-alarms --alarm-names HighCPUUtilization
Expected OutputExpected
{ "MetricAlarms": [ { "AlarmName": "HighCPUUtilization", "AlarmArn": "arn:aws:cloudwatch:us-east-1:123456789012:alarm:HighCPUUtilization", "AlarmDescription": "", "ActionsEnabled": true, "OKActions": [], "AlarmActions": [ "arn:aws:sns:us-east-1:123456789012:MySNSTopic" ], "InsufficientDataActions": [], "StateValue": "INSUFFICIENT_DATA", "StateReason": "Initial alarm creation", "MetricName": "CPUUtilization", "Namespace": "AWS/EC2", "Statistic": "Average", "Dimensions": [ { "Name": "InstanceId", "Value": "i-0123456789abcdef0" } ], "Period": 300, "EvaluationPeriods": 2, "Threshold": 80.0, "ComparisonOperator": "GreaterThanThreshold", "TreatMissingData": "missing" } ] }
--alarm-names - Specifies which alarm to describe.
This command sends a test notification message to the SNS topic used by the alarm. It helps verify that notifications will be received when the alarm triggers.
Terminal
aws sns publish --topic-arn arn:aws:sns:us-east-1:123456789012:MySNSTopic --message "CPU usage is high on instance i-0123456789abcdef0"
Expected OutputExpected
{ "MessageId": "12345678-1234-1234-1234-123456789012" }
--topic-arn - Specifies the SNS topic to send the message to.
--message - The content of the notification message.
Key Concept

If you remember nothing else from this pattern, remember: monitoring, automation, and learning from events keep your cloud systems healthy and improving.

Common Mistakes
Setting alarm thresholds too high or too low without understanding normal usage.
This causes false alarms or missed issues, leading to either alert fatigue or unnoticed problems.
Analyze typical system metrics first and set thresholds that reflect real performance limits.
Not testing notification channels after creating alarms.
You might miss critical alerts if notifications are not properly configured.
Send test messages to confirm notifications reach the right people or systems.
Ignoring alarm states and not reviewing alarm details regularly.
Alarms may become outdated or disabled, reducing their effectiveness.
Regularly check alarm statuses and update configurations as your system changes.
Summary
Create CloudWatch alarms to monitor important system metrics like CPU usage.
Check alarm status to ensure monitoring is active and accurate.
Test notification channels to confirm alerts will be received promptly.