Please enable JavaScript.
Coggle requires JavaScript to display documents.
Monitoring - Coggle Diagram
Monitoring
CloudWatch
Metrics for every service in AWS
- Namespaces
- Dimension (attribute e.g. instance id) up to 10
- timestamps
- detailed monitoring to get data every minute
- Free tier allows us to have 10 detailed monitoring metrics
- EC2 memory usage is not pushed (must be done as custom metric)
Custom Metrics
- Use API call PutMetricData
- Metric resolution for how often you want to push metric (standard 60 seconds or high 1/5/10/30 seconds)
Metrics from 2 weeks ago can be pushed and two hours in the future)
Logs
Log group, log stream, define log expiration
Metric filters and insights. Metric filters can be used for custom metrics
Subscription filter for real time processing of logs
Metric filters only generate data from when they are created
CloudWatch Agent
To push logs on EC2 to CloudWatch, EC2 must have IAM role correct permissions
Unified agent collects additional system level metrics
- Central configuration using SSM Parameter Store
Alarms
Targets
- Stop, Terminate, Reboot, Recover EC2 instance
- Trigger Auto scaling actions
- Send notification to SNS
Test alarms with set-alarm-state and pass alarm-state
Events (now EventBridge)
Resource policies, allow/deny events from another AWS account or AWS region
EventBridge
Default event bus - generated by AWS services (CW events)
Partner event bus - receive events from SaaS service or applications (Zendesk)
Custom Event buses - for your own applications
Event buses can be accessed by other AWS accounts - cross account event buses
Rules - how to process the events
-
X-Ray
- Visual analysis of applications
- Troubleshoot performance
Understand dependencies in a microservice architecture
Uses tracing, every request or sample
-
How to enable?
Code must import the AWS X-ray SDK (Java, Python, Go, Node.js, .NET
Install the X-ray daemon or enable X-Ray AWS integration
AWS services already run the X-Ray daemon for you
Each application must have the IAM rights to write data to X-Ray
.ebextension for Elastic Beanstalk
Instrumentation
Segments
Subsegments
Trace - segments collected together
Sampling
Annotations - Key Value pairs used to index traces and use with filters
Metadata - Key Value pairs not indexed, not used for searching
daemon / agent has a config to send traces cross account. The agent will assume the role. This allows to have a central account for all your application tracing.
X-ray APIs (used by the X-ray daemon)
- PutTraceSegments
- PutTelemetryRecords
- GetSamplingRules
IAM policy on x-ray daemon must allow
- GetServiceGraph
- BatchGetTraces
- GetTraceSummaries
- GetTraceGraph
ECS + X-Ray
- ECS Cluster - X-Ray Container as a Daemon, one per instance
- Side Car - one per container
*Fargate also used Side Car
Map container port and protocol udp, set AWS_XRAY_DAEMON_ADDRESS with port
Cloudtrail
From CloudTrail into CloudWatch Logs or S3
A trail can be applied to All Regions (default) or a single Region
-
Management Events
Data Events are not logged by default.. e.g. S3 object level
CloudTrail Insights Events
- Detect unusual activity on write events
Stored for 90 days, then use S3 and use Athena