CloudWatch Flashcards

1
Q

How would you view EC2 memory usage as a metric?

A

Push the metric from inside the instance as a custom metric (not pushed by default).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you create a custom metric, and what resolutions can you have?

A

Use the API call PutMetricData with StorageResolution param
- Standard resolution: 1 minute
- High resolution: 1/5/10/30 second(s), higher cost

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Can you insert your metric data points at any time?

A

No, but you can insert metric data points up to two weeks in the past, and two hours in the future (make sure to configure your EC2 instance time correctly).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What do you need to do to allow your EC2 machine to push logs to CloudWatch?

A

Run CloudWatch Logs/Unified Agent on that EC2 instance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the difference between CloudWatch Logs Agent and CloudWatch Unified Agent?

A

Logs:
- Can only send to CloudWatch Logs
Unified:
- Collect addition system-level metrics such as RAM, processes, etc.
- Send logs to CloudWatch logs
- Centralized configuration using SSM Parameter Store

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can you easily test a CloudWatch alarm?

A

Use the CLI to set the alarm state to ALARM.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Give a high level description of CloudWatch Synthetics Canary.

A

Allows you to use a configurable script that monitors your APIs, URLs, Websites etc.
- Checks availability and latency of endpoints, and can store load time data and screenshots of the UI

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do EventBridge and the Schema Registry work together?

A

EventBridge can analyze the events in your bus and infer the schema
- Allows you to generate code for your application that will know in advance how data is structured in the event bus.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the difference between EventBridge and CloudWatch Events?

A

Same underlying service infrastructure (API and endpoint), but EventBridge allows:
- Extension to add event buses for custom applications and third-party SaaS apps
- Schema Registry

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Describe a use case for a multi region resource policy on an event bus?

A

Aggregate all events from your AWS organization into a single AWS account or region (e.g., into a ‘central event bus’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you enable AWS X-Ray on an instance?

A

Install the xray daemon - works as a low level UDP packet interceptor
- Each application must also have th eIAM rights to write data to xray.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you enable AWS X-Ray on Lambda?

A
  • Ensure it has an IAM execution role with proper policy (AWSX-RAYWriteOnlyAccess)
  • Ensure xray is imported in the code
  • Enable Lambda xray Active Tracing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the difference between annotations and metadata in XRay?

A

Annotations - Key Value pairs used to index traces and use with filters
Metadata - Key Value pairs, not indexed, not used for searching

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What rules can you specify for XRay sampling?

A

The reservoir and rate:
Reservoir - by default, one request per second is recorded each second as long as the service is serving requests
Rate - by default, 5 percent is the rate at which additional requests beyond the reservoir size are sampled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Why are the GetSamplingRules and other sampling requests found within the Write API?

A

The X-Ray daemon will poll for these rules and write them to the instance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What Write action permissions does a resource need to use XRay?

A
  • PutTraceSegments (to upload the segments)
  • PutTelemetryRecords (to upload telemetry)
  • GetSamplingRules/Targets/StatisticSummaries (to update the local sampling rules on the instance)
17
Q

What does the BatchGetTraces request do?

A

Retrieves a list of traces specified by ID. Each trace is a collection of segment documents that originates from a single request.

18
Q

What does the GetTraceSummaries do?

A

Retrieves IDs and annotations for traces available for a specified time frame using an optional filter. To get the full traces, use BatchGetTraces.

19
Q

What does the GetTraceGraph do?

A

Retrieves a service graph for one or more specific trace IDs

20
Q

How do you enable XRay daemon in Beanstalk?

A

Setting the XRayEnabled property to true in the .ebextenstions/xray-daemon.config file (must also make sure the instance profile has the correct IAM permissions, and that your code is instrumented with the XRay SDK)

21
Q

What are the common patterns for setting up XRay in ECS and Fargate?

A
  • XRay Container as a Daemon: One XRay container per EC2 instance
  • XRay Container as a ‘Side Car’: One XRay container per Application container
    Fargate only allows the side car pattern.
22
Q

How would you set up the task definition for XRay in an EC2 instance?

A
  • Set up a port mapping for a containerPort with protocol UDP
  • Add an environment variable called AWS_XRAY_DAEMON_ADDRESS with the value “xray-daemon:{port_number}”
  • Add a link for xray-daemon
23
Q

What does CloudTrail provide?

A

A history of events / API calls made within your AWS account by the console, SDK, CLI or AWS services

24
Q

What are Management events?

A

Operations that are performed on resources in your AWS account

25
Q

What are Data Events?

A

High volume operations such as S3 object-level activity (e.g., Get, Delete, PutObject) or Lambda function execution activity (Invoke)

26
Q

What are CloudTrail Insights?

A

Events that indicate unusual activity in your account
- inaccurate resource provisioning
- hitting service limits
- bursts of AWS IAM actions
- gaps in periodic maintenance activity

27
Q

How does CloudTrail Insights work?

A

Analyzes normal management events to create a baseline
- From there, continously analyses write events to detect unusual patterns

28
Q

How long are events stored in CloudTrail, and how can you increase this?

A

Stored for 90 days, but can log them to S3 and use Athena to analyse these.

29
Q

Describe the difference between CloudTrail, CloudWatch and XRay.

A

CloudTrail - Audit API calls to detect unauthorized calls or root cuase of changes.
CloudWatch - Metrics over time for monitoring, logs for application log, alarms for notifications on unexpected metrics.
XRay - Automated Trace Analysis, Latency/Errors/Fault analysis, request tracking across distributed systems.