20. Monitoring (CloudWatch, X-Ray, CloudTrail) Flashcards
What does distributed tracing provided by X-Ray help with?
Distributed tracing helps pinpoint where failures occur and what causes POOR PERFORMANCE.
This is especially useful for applications built using a microservices architecture.
X-Ray receives data from services as _______ .
Segments
X-Ray groups segments that have a common request into _______ .
Traces
X-Ray processes traces to generate a _______ that provides a visual representation of your app.
Service Graph
Where would you look to identify bottlenecks or latency spikes in your application?
X-Ray Service Graph
True or False: By default, the X-Ray SDK records every request made.
False.
By default, the X-Ray SDK records the first request each second, and 5% of any additional requests (you can modify this).
In X-Ray, how do you narrow down specific paths or users?
Filter Expressions
What is an X-Ray annotation?
Annotations are aggregated at the trace level and can be added to any segment/subsegment.
Annotations are key/value pairs that are INDEXED for use with filter expressions.
What is an X-Ray metadata?
Metadata are aggregated at the trace level and can be added to any segment/subsegment.
Metadata are key-value pairs that are NOT indexed. The values can be of any type, including objects and lists.
When should you use X-Ray annotations?
Use annotations to record data that you want to use to group traces in the console, or when calling the GetTraceSummaries API.
When should you use X-Ray metadata?
Use metadata to record data you want to store in the trace but don’t need to use for searching traces.
What languages does X-Ray support?
- ASP.NET
- Go
- Java
- NodeJS
- PHP
- Python
- Ruby
What is the X-Ray tracing header?
X-Amzn-Trace-Id
It identifies a trace which is passed along to downstream services
How can you utilize Groups in X-Ray?
Groups allow you to save FilterExpressions so you can quickly filter traces
What is the X-Ray throttling error code?
429 Too Many Requests
What are the X-Ray Fault error codes?
Faults are 500/5xx errors
Errors are 400/4xx errors
How do you enable AWS X-Ray?
- Your code (Java, Python, Go, Node.js, .NET) must import the AWS X-Ray SDK
- Install the X-Ray daemon or enable X-Ray AWS Integration
What is X-Ray?
- Automated Trace Analysis & Central Service Map Visualization
- Latency, errors, and fault analysis
- Request tracking across distributed systems
- provides an end-to-end view of requests as they travel through your application, and shows a map of your application’s underlying components
What is CloudTrail?
- Audit API calls made by users, services, AWS console
- Useful to detect unauthorized calls or root cause of changes
- a service that enables governance, compliance, operational auditing, and risk auditing of your AWS account.
What is CloudWatch?
- CloudWatch Metrics over time for monitoring
- CloudWatch Logs for storing application logs
- CloudWatch Alarms to send notifications in case of unexpected metrics
- provides you with data and actionable insights to monitor your applications, respond to system-wide performance changes, optimize resource utilization, and get a unified view of operational health
What should you check if X-Ray is not working on EC2?
ensure EC2 IAM Role has proper permissions
2. ensure EC2 instance is running X-Ray Daemon
What should you check if X-Ray is not working on Lambda?
- ensure it has an IAM execution role with proper policy (AWSX-RayWriteOnlyAccess)
- ensure that X-Ray is imported in the code
What is the CloudWatch Logs API to associate a KMS key if the log group already exists?
associate-kms-key
What is the CloudWatch Logs API to associate a KMS key if the log group doesn’t exist?
create-log-group