Gaining Operational Excellence with AWS
Five pillars of the well architected framework
- Security
- Reliability
- Performance Efficiency
- Cost optimization
- Operational Excellence (covered within this set of notes)
Configuring Cloudwatch for advanced workloads.
Leverage cloudwatch for AWS services Learn how to utilize cloudwatch with custom apps Dive into Cloudwatch for monitoring and alerting.
What is Cloudwatch?
- Monitors AWS resources in real time
- Collect and track metrics that are important to us - to gain operational excellence
- Create alarms
- Visualize resource utilization
- Measure application performance
- Maintain Operational Health
Key Cloudwatch Concepts.
Namespaces: Container for a cloudwatch metric. AWS uses these to differentiate different metrics
Metrics: Represent a time ordered set of data points that get pushed to cloudwatch for us to visualize
Dimensions: Name value pair that is part of a metric
Statistics: Aggregated data from our metrics that we collect over a period of time. (Minimum, average of a metric we measure)
Percentiles: Indicates the standing of a value in a data set
Alarms: Created to initiate an action on our behalf - to watch metrics over a time period specified.
Cloudwatch Metrics:
- Explore namespaces and metrics. Metrics are a key component that make up cloudwatch. Cloudwatch used to be a metric monitoring service, not it is a critical service that offers a lot more. Resources - are shown on the left hand side within the cloudwatch service.
Alarms Metrics Logs Events
Metrics screen will show the metrics - these are data for the metrics reported to Cloudwatch. This is not only AWS resources. If you have hybrid architectures you can push those logs to cloudwatch.
Two types of monitoring offered:
- FREE - built in metrics for resources
- Detailed monitoring - for specific resources - to publish application metrics
- Metrics are regional.
Namespaces - When you create custom metrics and namespaces - aws prefix is reserved
You can narrow down the metric via the console.
Metric data is kept for 15 months Metric data popualtes the Graphed Metrics tab - you can change the ‘Statistic’ column here also. Can change the period as well within here to get more granularity.
Cloudwatch Dashboards: NOT TESTED IN THE TEST Enabling deatiled monitoring - incurs extra cost
Cloudwatch Alarms: Alarms are within the Cloudwatch console page
- First step is to select a metric, select this from the list, select the statistic and the period. You are then presented with a graph along side your metric, statistic and period. Next thing to do is to set up the conditions - Static (static value) or Anomaly detection (band as a threshold) then select the metric conditions. You can then set up the datapoints to alarm - this is to set the sensitivity - 1 out of 1 is very sensitive - but you can lower this to 2 out of 4. You can treat missing as alarm - or good, its up to your use case.
- You can then configure actions - sending notifications, auto scaling or doing an ‘Ec2 action’ << for ec2s.
- You can set your endpoints up within this as well.
- The EC2 action is very powerful
Cloudwatch Events: Allow for near real-time streams of events that show changes in your AWS resources.
- Allows you to peform actions after they occur.
Two types of trigger:
- Scheduled trigger - cloudwatch even will self trigger
- Event based (cloudtrail event)
Scheduled Expression Based Events: Go to cloudwatch Click ‘Events’ Create Rule ‘Select Schedule’ Fixed rate - or cron expression Select the target
Event based Cloudwatch Rules: Concept is : Captures an API call within our infrastructure - pretty much everything is there.
-
Specify the event - such as Instance state change. Can specify the state change (such as pending or stopped) so you get an event firing - which you can deal with :D
Cloudwatch Custom logging for enterprises:
- Used for on prem set ups.
- These would use a cloudwatch agent - so that we can push data to cloudwatch to capture it in cloudwatch.
- Set up a user called ‘Cloudwatch-Agent’ attache the permissions of ‘CloudwatchAgentServerPolicy’ this allows a user with these credentials to publish to cloudwatch - using an access key, saved down to configure this.
- Download amazon-cloudwatch-agent.rpm’, install using RPM installer.
- Next step - install and configure the AWS CLI
- Once agent and aws cli installed - create a config file - this will be used by cloudwatch agent as to where and what it should push. You can edit this using a wizard provided by AWS.
- Allows you to set up pretty much everything that you would like to set up on the console.
- Edit the config file and configure a provider ( only required on EC2 not an on prem provider)
- Custom namespace will be created and viewable via the Console.