DOP-C02 domain - 17% of the exam

Security and Compliance

Security and Compliance is 17% of the DOP-C02 exam. These are the objectives it covers, each with practice questions, with every answer explained.

The domain in numbers

49
Practice questions
6
Objectives
39
Medium
10
Hard

Where people go wrong

  • Treating account-level controls as organisation guardrails

    The wrong answers offer a permission boundary, an identity-based policy, or a per-bucket policy when the requirement is a guardrail that account administrators cannot remove. Each of those is set inside the account, so a local administrator can detach it, edit it, or create a principal outside it. A service control policy is attached to an organisational unit from the management account and caps every principal beneath it, including the root user, and accounts inherit it as they join.

    See it in a sample question
  • Offering Config remediation where the requirement says prevent

    A Config rule with remediation, or a conformance pack, appears as an option where the wording is deny, block, or never create. Those controls are detective: the resource exists, or the public setting has already changed, until the rule evaluates and repairs it, so a window of exposure remains. Preventive wording points to something that rejects the request itself, such as a service control policy across accounts or a CloudFormation hook inside the stack operation.

    See it in a sample question
  • Swapping GuardDuty, Inspector, Security Hub and Detective

    Four security services are exchanged for each other because they work on the same accounts and findings. GuardDuty detects threats from VPC flow logs, DNS query logs and CloudTrail events. Inspector finds software vulnerabilities in EC2 instances, ECR images and Lambda functions. Security Hub aggregates and normalises findings from other services rather than originating them. Detective builds a behaviour graph to investigate a finding that already exists.

    See it in a sample question
  • Acting in member accounts without a role in each one

    When a central tooling account must act in many member accounts, the wrong answers avoid a role in each one: resource-based grants on every resource, an Identity Center permission set built for human sign-in, or EventBridge forwarding that grants no permission to act. Resource grants and forwarding leave the calls attributed to the tooling account, outside the member account's audit trail. A member-account role that trusts the tooling account, requires an external ID and carries a scoped permissions policy gives temporary credentials and records every call in that account's CloudTrail.

    See it in a sample question
  • Swapping CloudFormation Guard and CloudFormation hooks

    Both enforce policy as code, and the wrong answers put one where the other belongs. Guard evaluates template files as a pipeline stage, so it fails the build before deployment but never sees a stack launched from the console. A hook runs inside the stack operation and blocks a non-compliant resource from any client, but only during stack operations, so it cannot assess resources that already exist. Continuous per-account compliance comes from a custom Config rule written in Guard policy code, deployed through a conformance pack.

    See it in a sample question

Objectives in this domain

What to study

The official documents this domain's practice questions cite most.

Sample questions from this domain

Free sampleSecurity and Compliancehard

A company manages around 300 accounts in AWS Organizations grouped into organisational units by environment. Security needs a hard guarantee that no principal in any production account, including account administrators with broad IAM policies, can disable AWS CloudTrail or delete its trails. A previous attempt that relied on attaching an IAM deny policy in each account was bypassed when a team detached the policy. The team wants the most durable control that cannot be removed by account-level administrators. Which approach should they implement?

  • AAttach a permission boundary to every IAM role in the production accounts that omits the CloudTrail stop and delete actions, so the boundary caps what those roles can do regardless of their attached policies.
  • BDistribute an AWS Config rule to the production accounts that detects when a trail is stopped or deleted and triggers a remediation that recreates it, treating detection and repair as the enforcement mechanism for the requirement.
  • CMove all production accounts under a dedicated organisational unit and apply an IAM identity-based deny policy through AWS IAM Identity Center permission sets so every assigned user inherits the CloudTrail restriction centrally.
  • DAttach a service control policy to the production organisational unit that denies cloudtrail:StopLogging and cloudtrail:DeleteTrail, so the guardrail applies to every principal in those accounts and cannot be overridden locally. Correct
Use a service control policy on an organisational unit to set a preventive permission ceiling that even account administrators cannot override. Service control policies define the maximum permissions available to principals in the member accounts they target and are administered only from the AWS Organizations management account; denying cloudtrail:StopLogging and cloudtrail:DeleteTrail at the organisational unit means no principal in those accounts, including an account administrator, can perform those actions, which is a preventive guarantee that local IAM policies, permission boundaries, or detective controls cannot match.

Why A is wrong: A permission boundary caps a principal's effective permissions, but it is set within the account and an account administrator can change or remove it, so it does not survive a local admin acting against the control the way an organisation guardrail does.

Why B is wrong: Config with remediation detects and repairs after the fact rather than preventing the action, so there is a window where logging is off, and an account admin can disable the rule, which falls short of a hard preventive guarantee.

Why C is wrong: Identity Center permission sets only constrain principals that sign in through Identity Center, so roles, account root, and locally created users are unaffected, which leaves the very administrators the requirement targets able to stop or delete the trails.

Why D is correct: A service control policy sets the maximum available permissions for every principal in the targeted accounts including account administrators, and it is managed only from the organisation management account, so denying the CloudTrail stop and delete actions there is a preventive guardrail that local admins cannot remove.

Free sampleSecurity and Compliancemedium

A DevOps team runs production workloads on Amazon EC2 instances and wants continuous, account-wide detection of malicious or unauthorised behaviour such as cryptocurrency mining, communication with known command-and-control domains, and anomalous API activity. They do not want to deploy or maintain any agents on the instances, and they want the service to analyse VPC flow logs, DNS query logs, and AWS CloudTrail events automatically. Which AWS service should they enable to meet this requirement with the least operational overhead?

  • AEnable Amazon Inspector so that it continuously scans the running EC2 instances for malicious network behaviour by correlating their VPC flow logs, DNS query logs, and AWS CloudTrail management events.
  • BEnable AWS Security Hub so that it continuously inspects VPC flow logs, DNS query logs, and AWS CloudTrail events directly to detect cryptocurrency mining and command-and-control communication on the EC2 instances.
  • CEnable Amazon Detective so that it continuously processes VPC flow logs, DNS query logs, and AWS CloudTrail events to generate the threat findings about mining and command-and-control activity on the instances.
  • DEnable Amazon GuardDuty, which continuously analyses VPC flow logs, DNS query logs, and AWS CloudTrail events as agentless data sources to detect threats such as mining and command-and-control traffic. Correct
Identify Amazon GuardDuty as the agentless managed service that analyses VPC flow logs, DNS logs, and CloudTrail events to detect threats. GuardDuty continuously consumes VPC flow logs, DNS query logs, and AWS CloudTrail events as managed data sources, then applies machine learning, anomaly detection, and integrated threat intelligence feeds to surface findings such as cryptomining and command-and-control communication, all without deploying or maintaining any agent on the EC2 instances.

Why A is wrong: Inspector is tempting because it scans EC2 workloads, but it assesses software vulnerabilities and unintended network exposure, not live threat behaviour from flow logs and DNS, so it does not meet the threat-detection requirement here.

Why B is wrong: Security Hub is tempting as a security service, but it aggregates and prioritises findings from other tools rather than analysing raw flow or DNS logs itself, so it cannot originate the threat detections required.

Why C is wrong: Detective is tempting because it consumes the same log sources, but it is an investigation tool that builds behaviour graphs from existing findings and does not itself raise the threat detections in scope.

Why D is correct: GuardDuty is a managed threat-detection service that ingests VPC flow logs, DNS query logs, and CloudTrail events without any agent, applying threat intelligence and anomaly models to flag exactly the malicious behaviour described.

Free sampleSecurity and Compliancehard

A central security tooling account runs an automated remediation service that must read configuration and apply fixes in roughly 200 member accounts across AWS Organizations. The team must avoid storing any long-lived credentials, must scope what the tooling can do in each member account, and wants to add new accounts to the programme without redeploying the tooling. They also need every action the tooling takes in a member account to appear in that account's own audit logs. Which design meets these requirements with the least ongoing credential management?

  • ACreate one IAM user with programmatic access keys in each member account, share the keys with the tooling account through AWS Secrets Manager, and have the tooling rotate and retrieve a key per account when it needs to act.
  • BDeploy a scoped IAM role in every member account that trusts the tooling account, and have the tooling call AWS STS AssumeRole to obtain short-lived credentials for each target account before it reads and remediates. Correct
  • CConfigure the tooling's execution role with a resource-based policy on each member account's resources granting cross-account access directly, so the tooling acts on remote resources without assuming any role in the member accounts.
  • DUse AWS IAM Identity Center to assign the tooling a permission set in every member account, then have the tooling sign in through Identity Center to obtain a session in each account before it remediates.
For unattended cross-account automation, assume a scoped IAM role per account with STS for short-lived credentials and per-account audit attribution. Deploying a permissions-scoped IAM role in each member account whose trust policy names the central tooling account lets the tooling call sts:AssumeRole to receive temporary, automatically expiring credentials before acting; no long-lived keys are stored, the role's policy limits what the tooling can do, and because the calls run as a role within the member account they appear in that account's CloudTrail. New accounts onboard by provisioning the same role, commonly via a CloudFormation StackSet, with no redeployment of the tooling itself.

Why A is wrong: Long-lived IAM user access keys are exactly what the requirement forbids, and managing, rotating, and securely distributing a key per account across 200 accounts is heavy credential management that role assumption is designed to remove.

Why B is correct: A cross-account role with a trust policy naming the tooling account lets the tooling call AssumeRole for temporary credentials scoped by the role's permissions, stores no long-lived secrets, and runs the API calls as a principal in the member account so they land in that account's own CloudTrail; new accounts join by deploying the same role, for example through a StackSet, with no change to the tooling.

Why C is wrong: Resource-based cross-account grants do not exist for most services a remediation tool touches, the calls would be attributed to the tooling account rather than the member account's own logs, and maintaining per-resource policies everywhere is far more work than one assumable role per account.

Why D is wrong: Identity Center is built for human workforce sign-in rather than an unattended service calling APIs, so wiring an automated remediation service through an interactive sign-in flow is the wrong tool and adds operational complexity compared with direct STS role assumption.

Free sampleSecurity and Compliancemedium

An organisation allows several teams to deploy "AWS CloudFormation" stacks directly into accounts. Security requires that the creation or update of any non-compliant resource, for example an Amazon RDS instance without storage encryption, is blocked inside the provisioning operation itself so the resource is never created, and the same control must apply to stacks deployed by AWS Cloud Development Kit and the console. Which approach BEST enforces this at provision time?

  • ARegister a "CloudFormation hook" that inspects resource configurations during stack operations and fails the operation when an RDS instance lacks storage encryption. Correct
  • BRun "AWS CloudFormation Guard" against template files in each team's pipeline so non-compliant templates fail the build before they reach CloudFormation.
  • CCreate an "AWS Config" rule that evaluates new resources and a remediation action that deletes any encryption-less database shortly after the stack finishes.
  • DAttach a "permission boundary" to the deployment roles that denies creating unencrypted RDS instances so the provisioning call is rejected by IAM.
Use a CloudFormation hook to inspect resource configurations during stack operations and block non-compliant provisioning across all deploy paths. A CloudFormation hook is invoked by CloudFormation before resources are created or updated and can return a failure that stops the operation, so the offending resource is never provisioned; because the hook executes within CloudFormation itself, it governs every stack regardless of whether it was launched from a pipeline, AWS CDK, or the console, which a pipeline-only Guard check or a detective Config rule cannot guarantee.

Why A is correct: A CloudFormation hook runs inside the provisioning operation and can fail it before a non-compliant resource is created, and because it acts in CloudFormation it applies to stacks from pipelines, AWS CDK, and the console alike.

Why B is wrong: Guard in a pipeline catches violations in template files, but teams deploying through the console or other paths bypass that pipeline, so the control would not apply uniformly to every provisioning route as required.

Why C is wrong: A Config rule with remediation is detective and post-hoc: the database is created and then deleted, so the resource does exist for a window, which violates the requirement that it never be created.

Why D is wrong: A permission boundary can constrain a role's API calls, but it is configured per principal in the account and an administrator can change it, and it does not give the resource-level configuration inspection a hook performs across all deploy paths.

Other domains in this exam

See also the DOP-C02 cert hub, the study guide, and the cheat sheet.

Examworthy is not affiliated with or endorsed by Amazon Web Services. Original, blueprint-aligned practice material only.