Task 1.3: Troubleshoot security monitoring, logging, and alerting solutions
Finding out why a log or an alert never arrived: the permissions, settings and agents behind Lambda, API Gateway and CloudFront logging, health checks and the CloudWatch agent, and fixing the misconfiguration.
Study it
Missing logs and silent alarms: permissions, agents and service logging settings
Lesson coming
Sample questions
Try each one before opening the answer. Every option is explained, with the AWS documentation page that proves it.
Question 1 · choose 1
An engineer added /var/log/secure to the CloudWatch agent configuration file on a fleet of EC2 instances so that failed SSH logins can be alarmed. The instance role has the CloudWatchAgentServerPolicy managed policy. The agent is running and still sends /var/log/messages, but no log stream for /var/log/secure appears. What should the engineer do?
ARun the agent control script with fetch-config to load the updated file
BAdd the logs:PutRetentionPolicy permission to the instance role
CRaise the instance metadata hop limit to 2 on the instances
DReboot the instances so that the agent service starts again with the file
Show the answer and why
ARun the agent control script with fetch-config to load the updated file
Correct
After the configuration file changes, the agent must be started with fetch-config to pick up the new configuration.
BAdd the logs:PutRetentionPolicy permission to the instance role
Incorrect
This permission is needed only if the agent sets retention on its log groups. The managed policy already lets the agent send logs.
CRaise the instance metadata hop limit to 2 on the instances
Incorrect
The hop limit matters when the agent runs in a container and cannot reach instance metadata, which is not the case here.
DReboot the instances so that the agent service starts again with the file
Incorrect
A restart runs the configuration the agent fetched last. The changed file is applied only through fetch-config.
Other logs still arriving rules out permissions and connectivity. What is left is the agent running an old configuration.
A team deploys the same REST API with the same template to us-east-1 and eu-west-1 and turns on execution logging for each stage. Execution logs appear in CloudWatch Logs for us-east-1 but never for eu-west-1. The template does not manage API Gateway account settings. What is the most likely fix?
ATurn on access logging for the eu-west-1 stage with a destination log group
BAdd a resource policy to the API that allows the CloudWatch Logs service principal
CAdd CloudWatch Logs permissions to the execution role of the Lambda function behind the API
DSet the CloudWatch Logs role ARN in the API Gateway account settings for eu-west-1
Show the answer and why
ATurn on access logging for the eu-west-1 stage with a destination log group
Incorrect
Access logging and execution logging are configured independently. Adding access logs does not make execution logs appear.
BAdd a resource policy to the API that allows the CloudWatch Logs service principal
Incorrect
An API resource policy controls who can invoke the API. It does not give API Gateway permission to write logs.
CAdd CloudWatch Logs permissions to the execution role of the Lambda function behind the API
Incorrect
That role controls the function's own logging, not the logs that API Gateway writes about requests.
DSet the CloudWatch Logs role ARN in the API Gateway account settings for eu-west-1
Correct
API Gateway writes logs by assuming the role in the account's cloudWatchRoleArn setting, which must be set separately in each Region.
When logging works in one Region but not another with the same template, look for a per-Region account setting that the template does not manage.
A team creates VPC flow logs that publish to CloudWatch Logs using a new IAM role. The flow log shows an access error and no log streams appear. The role has the CloudWatch Logs permissions from the documentation. What is the most likely problem?
AThe role does not trust vpc-flow-logs.amazonaws.com
BFlow logs can be published only to S3, not CloudWatch Logs
CFlow logs to CloudWatch Logs require a KMS key
DThe subnets must have an internet gateway
Show the answer and why
AThe role does not trust vpc-flow-logs.amazonaws.com
Correct
The flow logs service must be able to assume the role, so its trust policy must name that service principal.
BFlow logs can be published only to S3, not CloudWatch Logs
Incorrect
Flow logs can publish to a CloudWatch Logs log group, with a log stream for each network interface.
CFlow logs to CloudWatch Logs require a KMS key
Incorrect
Encryption with a KMS key is optional for log groups.
DThe subnets must have an internet gateway
Incorrect
Flow log delivery does not depend on the VPC's internet access.
Service roles need two halves: a trust policy for the service and a permissions policy for the actions.
GuardDuty produces no DNS-based findings for a group of EC2 instances, although other instances get them. The affected instances use a self-managed DNS server on EC2 that forwards to a public resolver. What explains this?
AGuardDuty needs DNS logs from the default AWS DNS resolvers
BVPC Flow Logs must be turned on for those subnets first
CThe instances lack the GuardDuty security agent
DGuardDuty only analyzes DNS for instances in public subnets
Show the answer and why
AGuardDuty needs DNS logs from the default AWS DNS resolvers
Correct
GuardDuty processes Route 53 Resolver DNS logs only when instances use the AWS DNS resolvers; other resolvers are not visible to it.
BVPC Flow Logs must be turned on for those subnets first
Incorrect
GuardDuty reads flow log data through its own stream without flow logs turned on; DNS findings depend on the DNS data source.
CThe instances lack the GuardDuty security agent
Incorrect
DNS findings do not need an agent on the instance.
DGuardDuty only analyzes DNS for instances in public subnets
Incorrect
Subnet type is not the reason; the resolver in use is.
Custom resolvers are a common blind spot; Route 53 Resolver forwarding rules keep GuardDuty's view while reaching on-premises DNS.
After Security Hub CSPM was turned on in a new account, most controls show no results. What is the most likely cause?
AThe account has no CloudTrail trail at all
BGuardDuty has not been turned on in the account
CThe account needs AWS Business Support
DAWS Config is not recording in the account
Show the answer and why
AThe account has no CloudTrail trail at all
Incorrect
Most controls are evaluated with AWS Config rules, not with trails.
BGuardDuty has not been turned on in the account
Incorrect
Controls do not depend on GuardDuty.
CThe account needs AWS Business Support
Incorrect
Control checks do not depend on a support plan.
DAWS Config is not recording in the account
Correct
Security Hub CSPM uses AWS Config rules for most controls, which need a configuration recorder.
When Security Hub CSPM runs without AWS Security Hub, turn on AWS Config recording for the resource types the controls need, before or together with Security Hub CSPM. With both services enabled, Security Hub CSPM creates a service-linked configuration recorder for you.
A team created a metric filter and alarm for failed console sign-ins on a CloudTrail log group. To test it, they look at last week's failures, but the metric shows no data. What explains this?
AThe alarm must be created in the us-east-1 Region
BMetric filters only work on encrypted log groups
CThe trail must be a single-Region trail instead
DFilters ignore events from before they were created
Show the answer and why
AThe alarm must be created in the us-east-1 Region
Incorrect
Alarms work in the Region of the metric; this is about the filter.
BMetric filters only work on encrypted log groups
Incorrect
Encryption has nothing to do with metric filters.
CThe trail must be a single-Region trail instead
Incorrect
The trail type does not affect metric filters on its log group.
DFilters ignore events from before they were created
Correct
Filters publish data points only for events that arrive after the filter is created.
To test a new filter, generate a test event or use the filter pattern test feature on sample data.