Monitoring & Auditing Flashcards

1
Q

What is Cloudwatch?

A

A monitoring service.

Provides metrics for EVERY service in AWS

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

What is a cloudwatch metric?

A

A variable to monitor: CPUUtilization, BucketSize, etc.

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

What is a metric attribute?

A

The metric attributes are called “Dimension”.

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

What are cloudwatch logs?

A

You set up a log group, then in it a log stream, which will capture the logs.

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

How are logs created in cloudwatch?

A

Different services have the capability of creating log groups in cloudwatch.

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

What are metric filters?

A

Metric filters are a way to filter key lines in a log group stream, with the objective of creating a new metric.

You create a filter by choosing a sample log stream, and using key words to find a pattern in the events of the log stream.

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

What is a log stream?

A

A single captured log chain, that belongs to a log group. In a log stream there are multiple events that describe what happened in an aws service.

A log stream is an instance of a log capture.

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

How do you create a metric?

A

You create a metric by creating a filter with a pattern, and a value.

For example if the pattern happens x amount of times, x being the value, you would get an alarm triggered in case you tie this new metric to a cloudwatch alarm.

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

How are cloudwatch log groups and S3 related?

A

You can send the log into s3 bucket.

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

What is log insights?

A

A cloudwatch QUERY capability that lets you query log groups for streams, by using a query language. This is great to find specific data in a big log group with lots of different logs. For example ip addresses, errors, etc, etc. Everything that could be logged basically.

You can export these logs, or add them to a dashboard.

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

Where could cloudwatch logs be sent to?

A

S3 for storage,
Kinesis data streams and firehose
aws lambda as triggers
opensearch

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

What is cloudwatch log subscriptions?

A

This is to export logs in real time to other services, for analysis and processing.

Examples are lambda functions, and kinesis.

Use in combination with a subscription filter to specify which events to send from the log streams.

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

What is a subscription filter?

A

When using cloudwatch log subscriptions (for kinesis, lambda) you can set a subscription filter to only send the log events you want instead of the whole log.

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

How can you aggregate cloudwatch log data from multiple aws accounts into one destination?

A

You can create a subscription filter from each aws account into a single kinesis data stream in one of the accounts (with cloudwatch cross account subscription), and then put it in firehose for example, to store it into s3.

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

What is cross account subscription?

A

You can send cloudwatch logs to another account with kinesis data streams.

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

What is live tail?

A

Its a feature where you choose a log group, and optionally a log stream and a filter, and as events happen you see them live.

It’s like a log capture tool.

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

Do EC2 instances send logs to cloudwatch?

A

Not by default, but you can install a unified log agent to send logs to cloudwatch, if you set up iam roles in the ec2 instance correctly.

EC2 instances DO send basic METRICS to cloudwatch by default

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

What is cloudwatch unified agent?

A

the cloudwatch log agent that you can install in ec2 instances or any onpremises server to collect data to send to cloudwatch.

It collects both metrics and logs.

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

What are cloudwatch alarms?

A

For triggering notifications on a single metric.

Alarm states are: OK, INSUFFICIENT_DATA, ALARM.

You can set a period for triggering the alarm.

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

What are composite alarms?

A

Alarms in cloudwatch that are set on multiple metrics.

They work by monitoring the state of multiple other configured alarms.

It can be configured as an OR, or AND.

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

Do EC2 instances send metric data to cloudwatch?

A

YES. They send basic metrics.

They dont send logs without an agent, but they do send basic metrics. With unified agent installed you get logs and more advanced metrics though,

21
Q

How can alarms interact with EC2?

A

If you set up an alarm on an EC2 metric, you can apply an EC2 action to stop, reboot, or terminate the alarmed instance.

22
Q

What actions can you configure in cloudwatch after an alarm is triggered?

A

EC2 actions to terminate, reboot, or stop an instance.
An auto scaling action
Notification
Systems manager action

23
Q

How can you test an alarm in Cloudwatch?

A

With AWS CLI you can manually set an alarm to alarmed state, to test the actions configured for the alarm.

24
Q

What is EventBridge?

A

A service where you can schedule CRON jobs in AWS.

For example to trigger a lambda function every hour. Or trigger SQS, or SNS.

You can also react to cloudwatch events to trigger actions

25
Q

What is CloudTrail?

A

For governance, compliance and audit in aws.

History of all events and api calls in your account.

26
Q

Where can you send cloudtrail logs to?

A

S3 bucket or cloudwatch.

In cloudtrail events are stored for 90 days.

27
Q

What is cloudtrail insights?

A

A cloudtrail feature to detect inusual activity in your account.

It first creates a baseline of your normal activity by looking at the events. Then analyzes events continuously to detect unusual patterns.

28
Q

Where are API Calls logged?

A

Cloudtrail. Then for these API call events you will need to use it with eventbridge for alerts and SNS to create notifications for these alerts.

29
Q

What is AWS Config?

A

A service that helps to audit and get compliance status of your aws resources, based on rules you set up.

For example:
Are all ebs volumes gp3?
Are all instances t2.micro?
Do buckets have public access?
Are there security groups that have unrestricted ssh access inbound?

With SNS you can receive alerts to these non compliant rules.

This service is per region.

30
Q

What actions can AWS Config take to fix noncompliant resources?

A

AWS Config can’t just change an ebs volume to be of a compliant type, for example.

But, AWS Config can make some remediation of non compliant resouces, by triggering SSM automation documents, that can perform actions in aws. If you need something more advanced, these SSM docs can trigger lambda functions that can perform more advanced actions to remediate the non compliant resource.

Example: Access keys expired on a user. An SSM doc can fix that by deactivating these expired access keys.

SSM documents are activated automatically then a resource becomes non compliant.

31
Q

How do you configure actions for non compliant resources in aws?

A

With aws config you audit these resources, and if they become non compliant, you can trigger an event in eventbridge, and then trigger an action with SNS, Lambda, SQS, etc.

32
Q

What integration does AWS Config have for notifications?

A

SNS: You can directly notify of all non compliance to SNS topic.

33
Q

What is the difference between cloudwatch, cloudtrail and config?

A

Cloudwatch is for performance monitoring: Metrics cpu network etc, dashboards, events and alerting, log aggregation and analysis of logs.
Cloudtrail is for record API calls made in your aws account by every user or service.
Config is for recording configuration changes, and evaluate against compliance rules.

34
Q

What is the purpose of CloudWatch vs EventBridge?

A

Cloudwatch is for monitoring and observability of aws resource performance. Set up alarms, or visualize metrics and logs

Eventbridge is for routing events between aws applications, and automating workflows. It excels at handling a variety of events and connecting different AWS services and external SaaS applications.

35
Q

How can CloudWatch and EventBridge work together?

A

They complement each other. For instance, CloudWatch can generate metrics that trigger events, which can then be routed and processed by EventBridge for further actions.

36
Q

How can eventbridge see cloudwatch alarms?

A

You set up an alarm that monitors a metric in cloudwatch.

Then in event bridge, you create a rule to create an event when this alarm is triggered.

37
Q

You have an RDS DB instance that’s configured to push its database logs to CloudWatch. You want to create a CloudWatch alarm if there’s an Error found in the logs. How would you do that?

A

Create a CloudWatch Logs Metric Filter that filters the logs for the keyword Error, then create a CloudWatch Alarm based on that Metric Filter

38
Q

You have an application hosted on a fleet of EC2 instances managed by an Auto Scaling Group that you configured its minimum capacity to 2. Also, you have created a CloudWatch Alarm that is configured to scale in your ASG when CPU Utilization is below 60%. Currently, your application runs on 2 EC2 instances and has low traffic and the CloudWatch Alarm is in the ALARM state. What will happen?

A

The CloudWatch alarm will remain in ALARM state but never decrease the number of EC2 instances in the ASG.

The number of EC2 instances in an ASG can not go below the minimum capacity, even if the CloudWatch alarm would in theory trigger an EC2 instance termination.

39
Q

You have made a configuration change and would like to evaluate the impact of it on the performance of your application. Which AWS service should you use?

1) Cloudwatch
2) CloudTrail

A

Cloudwatch.

CloudTrail is for monitoring Configuration changes (API Calls) made by users or roles in your aws account.

40
Q

Someone has terminated an EC2 instance in your AWS account last week, which was hosting a critical database that contains sensitive data. Which AWS service helps you find who did that and when?

A

CloudTrail

41
Q

You have CloudTrail enabled for your AWS Account in all AWS Regions. What should you use to detect unusual activity in your AWS Account?

A

CloudTrail Insights

42
Q

One of your teammates terminated an EC2 instance 4 months ago which has critical data. You don’t know who made this so you are going to review all API calls within this period using CloudTrail. You already have CloudTrail set up and configured to send logs to the S3 bucket. What should you do to find out who made this?

A

Analyze the logs in s3 (Using athena for example), since logs from 4 moths ago are not longer stored in cloudtrail.

You can use the CloudTrail Console to view the last 90 days of recorded API activity. For events older than 90 days, use Athena to analyze CloudTrail logs stored in S3.

43
Q

You are running a website on a fleet of EC2 instances with OS that has a known vulnerability on port 84. You want to continuously monitor your EC2 instances if they have port 84 exposed. How should you do this?

A

With AWS Config Rules

44
Q

You would like to evaluate the compliance of your resource’s configurations over time. Which AWS service will you choose?

A

AWS Config

45
Q

Someone changed the configuration of a resource and made it non-compliant. Which AWS service is responsible for logging who made modifications to resources?

A

CloudTrail

46
Q

You have enabled AWS Config to monitor Security Groups if there’s unrestricted SSH access to any of your EC2 instances. Which AWS Config feature can you use to automatically re-configure your Security Groups to their correct state?

A

AWS Config Remediations.

Integrated with SSM documents to make fixes to non compliant resources. And thos SSM can call lambda functions for more complex fixes.

47
Q

You are running a critical website on a set of EC2 instances with a tightened Security Group that has restricted SSH access. You have enabled AWS Config in your AWS Region and you want to be notified via email when someone modified your EC2 instances’ Security Group. Which AWS Config feature helps you do this?

A

AWS Config Notifications

With usage of SNS.

48
Q

…………………………. is a CloudWatch feature that allows you to send CloudWatch metrics in near real-time to S3 bucket (through Kinesis Data Firehose) and 3rd party destinations (e.g., Splunk, Datadog, …).

A

Cloudwatch metric streams

49
Q

A DevOps engineer is working for a company and managing its infrastructure and resources on AWS. There was a sudden spike in traffic for the main application for the company which was not normal in this period of the year. The application is hosted on a couple of EC2 instances in private subnets and is fronted by an Application Load Balancer in a public subnet. To detect if this is normal traffic or an attack, the DevOps engineer enabled the VPC Flow Logs for the subnets and stored those logs in CloudWatch Log Group. The DevOps wants to analyze those logs and find out the top IP addresses making requests against the website to check if there is an attack. Which of the following can help the DevOps engineer to analyze those logs?

A

Cloudwatch Contributor Insights

CloudWatch Contributor Insights is a feature of Amazon CloudWatch that helps you analyze and understand the top contributors to specific metrics and operational data within your AWS environment. It provides real-time insights into the behavior of your applications and infrastructure by identifying patterns and trends from log data.

50
Q

A company is developing a Serverless application on AWS using Lambda, DynamoDB, and Cognito. A junior developer joined a few weeks ago and accidentally deleted one of the DynamoDB tables in the dev AWS account which contained important data. The CTO asks you to prevent this from happening again and there must be a notification system to monitor if there is an attempt to make such deletion actions for the DynamoDB tables. What would you do?

A

Assign developers to a certain IAM group which prevents deletion of DynamoDB tables.

Configure EventBridge to capture any DeleteTable API calls through CloudTrail and send a notification using SNS

51
Q

A company has a running Serverless application on AWS which uses EventBridge as an inter-communication channel between different services within the application. There is a requirement to use the events in the prod environment in the dev environment to make some tests. The tests will be done every 6 months, so the events need to be stored and used later on. What is the most efficient and cost-effective way to store EventBridge events and use them later?

A

Use EventBridge Archive and Replay feature.

The EventBridge Archive and Replay feature allows you to automatically archive events and replay them at a later time. This feature helps in debugging, testing, and recovering from errors by providing a way to retain and reuse event data.