AWS Monitoring and Audit Flashcards

1
Q

What does CloudWatch do?

A

CloudWatch provides metrics for almost every service in AWS

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

What is a metric?

A
  • Metric is a variable to monitor (i.e. CPU Utilization, Memory etc.)
  • Metrics have timestamps
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What do metrics belong to?

A

namespaces

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

What is a dimension? (CloudWatch)

A

Dimension is an attribute of a metric (instance id, environment. etc.)

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

What is the default interval for CloudWatch metrics for EC2 instances?

A
  • every 5 minutes.
  • Can enable detailed monitoring (extra $) for data every 1 minute
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Can custom metrics be defined on CloudWatch?

A

Yes

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

What is the default metric resolution in CloudWatch (services other then EC2)?

A
  • 1 minute
  • Can do high resolution u to 1 second (more $)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

If you want to capture metric data more frequently then the default setting, what can you do?

A

Enable High Resolution (up to 1 second) - higher cost

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

What is the API call to set Metric Data?

A

PutMetricData

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

What do you do if you see throttle errors in CloudWatch?

A

This can happen if your sending too much data into CoudWatch to quickly. Use exponential backoff to resolve.

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

What needs to be in place in order to send CloudWatch logs?

A

Make sure IAM permissions are correct

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

Explain CloudWatch Logs for EC2. What service is necessary for this process?

A
  • By default, no logs from your EC2 machine will go to CloudWatch.
  • You need to run a CloudWatch Agent on EC2 to push the log files you want.
  • Make sure IAM permissions are correct.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If you wanted to acheive additional system-level metrics that provided more granular detail, what service would you use?

A

CloudWatch Unified Agent

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

What are the three main monitoring services in AWS?

A
  • Cloudwatch
  • Xray
  • CloudTrail
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the four main components of CloudWatch?

A
  • Metrics: Collect and track key metrics
  • Logs: Collect, monitor, analyze and store log files
  • Events: Send notifications when certain events happen in your AWS
  • Alarms: React in real-time to metrics / events
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is AWS EventBridge?

A
  • EventBridge is the next evolution of CloudWatch Events.
  • It builds upon and extends CloudWatch Events.
  • It uses the same service API and endpoint, and the same underlying service infrastructure.
  • EventBridge allows extension to add event buses for your custom applications and your third-party SaaS apps.
  • Event Bridge has the Schema Registry capability
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is AWS Xray?

A
  • AWS X-Ray helps developers analyze and debug production, distributed applications, such as those built using a microservices architecture
  • A visual monitoring service
  • Allows tracing (follows a request)
18
Q

What is Tracing (Xray)?

A
  • An end to endway of following a request.
  • Can trace every request or just a percentage
19
Q

How is Xray enabled?

A
  • Your code must import the AWS X-Ray SDK
  • Install the X-Ray daemon or enable X-Ray AWS integration
  • Each application must have the IAM rights to write data to Xray.
20
Q

Your Xray application works locally, but it fails on your EC2 machine. Why?

A

Most likely answer:

  • On your machine, you’re running the Xray daemon, but the daemon is not running on your EC2 and therefore Xray does not see your calls.
  • Another possible reason is the EC2 instance does not have the proper IAM permissions.
21
Q

What are Segments in Xray?

A

Segments provide the resources name, details about the request, and details about the work done.

22
Q

How should Xray be integrated in with AWS Lambda?

A
  • Ensure that your lambda function has an IAM execution role with proper policy (AWSX-RayWriteOnlyAccess)
  • Ensure that X-Ray is imported in the code
  • Xray integration is enabled on AWS lambda
23
Q

Does AWS X-Ray send trace data directly to AWS X-Ray?

A

No. The X-Ray SDK sends the trace data to a daemon, which collects segments for multiple requests and uploads them in batches to AWS X-Ray.

24
Q

How can AWS X-Ray be integrated in with AWS BeanStalk?

A

Enable the daemon within the .ebextensions/xray-daemon.config file

25
Q

How do you run Xray with ECS?

A
  • Set containerPort to 2000
  • Set protocal for portMapping to ‘udp’
  • Set an environment variable for the xray daemon address
    • value maps to port 2000 (above). This is how the application knows where the xray daemon is.
  • link to xray daemon container to app container
26
Q

What are subsegments in Xray?

A

Subsegments provide more granular timing information and details about downsteam calls that your app made to fulfill the original request.

27
Q

What is a service graph (xray)?

A

A flow chart visualization of average response for micro-services and to visually pinpoint failure(s).

28
Q

What is AWS CloudTrail?

A
  • a service that enables governance, compliance, operational auditing, and risk auditing of your AWS account.
  • Continuously monitor, and retain account activity related to actions across your AWS infrastructure. CloudTrail provides event history of your AWS account activity, including actions taken through the AWS Management Console, AWS SDKs, command line tools, and other AWS services.
29
Q

If a resource gets deleted in AWS, which service should you use first to help pinpoint what happened?

A

CloudTrail

30
Q

What are the 3 possible alarm states for CloudWatch Alarms?

A
  • OK
  • INSUFFICENT_DATA
  • ALARM
31
Q

CloudTrail vs. CloudWatch vs. Xray

A

CloudTrail

  • Audit API calls made by users / services / AWS console
  • Useful to detect unauthorized calls or root cause of changes

CloudWatch

  • CloudWatch Metrics over time for monitoring
  • CloudWatch Logs for storing application log
  • CloudWatch Alarms to send notifications in case of unexpected metrics

X-Ray

  • Automated Trace Analysis & Central Service Map Visualization
  • Latency, Errors and Fault analysis
  • Request tracking across distributed systems
32
Q

We’d like to have CloudWatch Metrics for EC2 at a 1 minute rate. What should we do?

A

Enable Detailed Monitoring

33
Q

What period of time can be set to trigger an alarm for a high resolution meteric?

A

10 sec or 30 sec only

34
Q

What is the architecture of CloudWatch Logs?

A
  • Logs have log groups which have an arbitrary name, usually representing an application and
  • Log groups have log streams that are instances with the application / log files / containers
35
Q

Do CloudWatch logs have an expiration?

A

Only if one is applied. Expirations are defind by expiration policies (never expire, 30 days etc)

36
Q

How are CloudWatch Logs secured?

A

Logs can be encrypted at the group level using KMS at rest.

37
Q

You would like to index your XRay traces in order to search and filter through them efficiently. What should you use?

A

Use annotations

38
Q

What are the 5 Xray Write APIs?

A
  • PutTraceSegments
  • PutTelemetryRecords
  • GetSamplingRules
  • GetSamplingTargets
  • GetSamplingStatistciSummaries
39
Q

Xray Write API: PutTraceSegments

A

Uploads segment documents to AWS Xray

40
Q

Xray Write API: PutTelemetryRecords

A
  • Used by AWS X=Ray daemon to upload telemetry.
  • Uploads information on how many segments were recieved, rejected, and the number of backend connection errors.
  • Helps with metrics
41
Q

Xray Write API: GetSamplingRules

A
  • Retrieves all sampling rules
  • Even though this is a “GET “ request it is included in the Xray Write API because sampling rules are changed in the console, all xray daemons are automatically updated (written to) to know when to send data into xray

also applies to GetSamplingTargets and GetSamplingStatisticSummaries