Cloudwatch, CloudTrail, X-Ray

  • namespace is a container for CloudWatch metrics. Metrics in different namespaces are isolated from each other, so that metrics from different applications are not mistakenly aggregated into the same statistics.
  • There is no default namespace. You must specify a namespace for each data point you publish to CloudWatch. You can specify a namespace name when you create a metric. 
  • Metrics are the fundamental concept in CloudWatch. A metric represents a time-ordered set of data points that are published to CloudWatch. 
  • Metrics exist only in the Region in which they are created. Metrics cannot be deleted, but they automatically expire after 15 months if no new data is published to them. 
  • dimension is a name/value pair that is part of the identity of a metric. You can assign up to 10 dimensions to a metric.
  • CloudWatch treats each unique combination of dimensions as a separate metric, even if the metrics have the same metric name. 
  • Each metric is one of the following:
    • Standard resolution, with data having a one-minute granularity
    • High resolution, with data at a granularity of one second
  • Statistics are metric data aggregations over specified periods of time.
  • period is the length of time associated with a specific Amazon CloudWatch statistic. 
  • CloudWatch does not automatically aggregate data across Regions.
  • You can use an alarm to automatically initiate actions on your behalf. An alarm watches a single metric over a specified time period, and performs one or more specified actions, based on the value of the metric relative to a threshold over time. The action is a notification sent to an Amazon SNS topic or an Auto Scaling policy. You can also add alarms to dashboards.
  • Cloudwatch -Amazon CloudWatch is basically a metrics repository.
    1. You can create alarms that watch metrics and send notifications or automatically make changes to the resources you are monitoring when a threshold is breached. For example, you can monitor the CPU usage and disk reads and writes of your Amazon EC2 instances and then use that data to determine whether you should launch additional instances to handle increased load. You can also use this data to stop under-used instances to save money.
    2. namespace is a container for CloudWatch metrics. 
    3.  A metric represents a time-ordered set of data points that are published to CloudWatch. Metrics exist only in the Region in which they are created. Metrics cannot be deleted.
    4. dimension is a name/value pair that is part of the identity of a metric. You can assign up to 10 dimensions to a metric.
    5. Metrics produced by AWS services are standard resolution by default. When you publish a high-resolution metric, CloudWatch stores it with a resolution of 1 second.
    6. Metrics are grouped first by namespace, and then by the various dimension combinations within each namespace. 
    7. CloudWatch Embedded Metric Format enables you to ingest complex application data in the form of logs and easily generate actionable metrics from them.
    8. You can use a CloudWatch metric math function to display the service quotas for those resources on your graphs. You can also configure alarms that alert you when your usage approaches a service quota. m1/SERVICE_QUOTA(m1)*100
    9. You can also use CloudWatch metric math to aggregate and transform metrics from multiple accounts and Regions.
    10. CloudWatch includes a new unified agent that can collect both logs and metrics from EC2 instances and on-premises servers. Once setup the logs automatically flow from the instance to the log stream you create while installing the agent.
    11. Metrics are stored separately in Regions. Cross-Region functionality is now built in automatically. You do not need to take any extra steps to be able to display metrics from different Regions in a single account on the same graph or the same dashboard. 
    12. Cross-Region functionality is not supported for alarms, so you can't create an alarm in one Region that watches a metric in a different Region.
    13. With the put-metric-data command in Amazon CloudWatch, you may publish your own metrics. It may take up to two minutes before you can use the get-metric-statistics command to receive statistics on the new metric. It can take up to fifteen minutes before the new metric appears in the list of metrics retrieved using the list-metrics command.
    14. To send metric data for your instance to CloudWatch in 1-minute periods, you can enable detailed monitoring on the instance.
    15. With cross-account cross-region dashboards, you get centralized visibility of CloudWatch metrics, logs, and alarms across a group of related accounts without the overhead of having to centralize data. 
    16. To use this, enable the cross-account cross-region view. Before you can create a cross-account cross-Region dashboard, you must enable at least one sharing account and at least one monitoring account. You must enable sharing in each account that will make data available to the monitoring account.
    17. metric alarm watches a single CloudWatch metric or the result of a math expression based on CloudWatch metrics.
    18. composite alarm includes a rule expression that takes into account the alarm states of other alarms that you have created. The composite alarm goes into ALARM state only if all conditions of the rule are met. 
    19. Canaries are configurable scripts that run on a schedule, to monitor your endpoints and APIs.  You can also create a canary using AWS CloudFormation - AWS::Synthetics::Canary.
    20. You can use metric streams to continually stream CloudWatch metrics to a destination (S3, KDF or 3rd party) of your choice, with near-real-time delivery and low latency. 
    21. CloudWatch ServiceLens enhances the observability of your services and applications by enabling you to integrate traces, metrics, logs, alarms, and other resource health information into one place. ServiceLens integrates CloudWatch with AWS X-Ray to provide an end-to-end view of your application to help you more efficiently pinpoint performance bottlenecks and identify impacted users.
    22. When you enable anomaly detection for a metric, CloudWatch applies statistical and machine learning algorithms. These algorithms continuously analyze metrics of systems and applications, determine normal baselines, and surface anomalies with minimal user intervention.
    23. CloudWatch Lambda Insights is a monitoring and troubleshooting solution for serverless applications running on AWS Lambda. The solution collects, aggregates, and summarizes system-level metrics including CPU time, memory, disk, and network. 
    24. CloudWatch sends events to Amazon EventBridge whenever a CloudWatch alarm changes alarm state. You can use EventBridge and these events to write rules that take actions, such as notifying you, when an alarm changes state. 
    25. You can collect metrics from servers by installing the CloudWatch agent on the server. You can install the agent on both Amazon EC2 instances and on-premises servers, and on computers running either Linux, Windows Server, or macOS. 
    26. Using Amazon CloudWatch alarm actions, you can create alarms that automatically stop, terminate, reboot, or recover your EC2 instances. To set up a CloudWatch alarm action that can reboot, stop, or terminate an instance, you must use a service-linked IAM role, AWSServiceRoleForCloudWatchEvents. The AWSServiceRoleForCloudWatchEvents IAM role enables AWS to perform alarm actions on your behalf.
  • Cloudtrail 
    1. Cloudtrail by default logs all management events. 
    2. Data and Insight events are not logged by default. Data events pertains to specific data operations on the resources. Insight events are generated to track insights on management events. 
    3. To create an organization trail, ensure that the “Enable for all accounts in my organization” option is checked when you create a new CloudTrail trail.
    4. Org trail created at organization level will create a unique bucket for each member account in the management account. Users with CloudTrail permissions in member accounts will be able to see this trail when they log into the AWS CloudTrail console from their AWS accounts. However, users in member accounts will not have sufficient permissions to delete the organization trail, turn logging on or off, change what types of events are logged. A service-linked role - AWSServiceRoleForCloudTrail - to perform logging tasks is required.
    5. A trail can be applied to all Regions or a single Region. As a best practice, create a trail that applies to all Regions. 
    6. CloudTrail delivers log files for account activity from all AWS Regions to the single Amazon S3 bucket that you specify(are encrypted by Amazon server-side encryption with Amazon S3-managed encryption keys (SSE-S3)), and, optionally, to a CloudWatch Logs log group. If you enabled it, log file integrity validation is enabled for the trail in all AWS Regions. 
    7. To change a trail so that it logs global service events, use the --include-global-service-events option.
    8. To enable log file validation for a trail, use the --enable-log-file-validation option. 
    9. To protect your logs, you can encrypt the S3 bucket and add MFA Delete to protect your trail logs from accidental deletions. 
  • X-ray 
    1. AWS X-Ray receives data from services as segments. X-Ray then groups segments that have a common request into traces. X-Ray processes the traces to generate a service graph that provides a visual representation of your application.
    2. The AWS X-Ray console enables you to view service maps and traces for requests that your applications serve.The console's service map is a visual representation of the JSON service graph that X-Ray generates from the trace data generated by your applications.The map consists of service nodes for each application in your account that serves requests, upstream client nodes that represent the origins of the requests, and downstream service nodes that represent web services and resources used by an application while processing a request.
    3. The AWS X-Ray daemon is a software application that listens for traffic on UDP port 2000, gathers raw segment data, and relays it to the AWS X-Ray API. To run the X-Ray daemon locally, on-premises, or on other AWS services, download it.
    4. X-ray SDK can be used to trace HTTP outgoing calls, incoming calls and SQL queries.
    5. The X-Ray SDK for Java is a set of libraries for Java web applications that provide classes and methods for generating and sending trace data to the X-Ray daemon. Trace data includes information about incoming HTTP requests served by the application, and calls that the application makes to downstream services.
    6. X-ray can be used to trace API gateway requests and analyze HTTP requests and errors. The x-ray is associated with a API gateway stage. 

Comments

Popular posts from this blog

AWS Organizations, IAM

Key Concepts

Linear Algebra Concepts