Courseiva
Security and CompliancemediumMultiple ChoiceObjective-mapped

DOP-C02 Security and Compliance Practice Question

A security audit reveals that EC2 instances have security groups with overly permissive inbound rules allowing all traffic (0.0.0.0/0) on SSH port 22. What is the BEST way to remediate this at scale?

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Use AWS Config with a managed rule to detect and auto-remediate.

AWS Config with the managed rule 'restricted-ssh' can detect and auto-remediate non-compliant security groups. Option B is wrong because service control policies (SCPs) do not control security group rules directly; they apply to IAM actions. Option C is wrong because manually updating each security group is not scalable across many instances. Option D is wrong because while a Lambda function triggered by CloudWatch Events could modify security groups, AWS Config provides a built-in, easier-to-manage remediation solution.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use AWS Config with a managed rule to detect and auto-remediate.

    Why this is correct

    Correct. AWS Config with the 'restricted-ssh' managed rule can detect non-compliant security groups and trigger auto-remediation, such as removing overly permissive rules or replacing them with restricted ones. This is the most scalable and integrated approach.

  • Apply a service control policy (SCP) to deny opening port 22.

    Why it's wrong here

    SCPs are an AWS Organizations feature that governs which AWS API calls principals in an account or OU can make; they cannot directly modify or rewrite security group rules, and they cannot 'deny opening port 22' as a network-level action. Although an SCP could deny the ec2:AuthorizeSecurityGroupIngress actions, that would block all ingress rule changes across the account rather than selectively restrict SSH from known IPs, and it still would not remediate rules that already exist. Network access control is enforced in the VPC by security group rules, which are evaluated in the data plane, not by IAM authorization policies.

  • Manually update each security group to restrict SSH to known IPs.

    Why it's wrong here

    Manually updating each security group is operationally brittle because it relies on human effort to track and edit every current and future group, and it fails to detect configuration drift or newly created groups that reintroduce the same SSH exposure. In a dynamic environment with many instances, this approach is time-intensive, prone to errors (e.g., allowing the wrong CIDR), and provides no audit trail or automated verification. AWS Config's managed rule, by contrast, continuously evaluates all security groups against the restricted-ssh rule and can trigger automatic remediation the moment an offending rule appears.

  • Use CloudWatch Events to trigger a Lambda function that modifies security groups.

    Why it's wrong here

    CloudWatch Events can trigger a Lambda function to modify security groups, but this approach lacks the ability to automatically detect newly created or modified EC2 instances whose security groups violate the policy. The scenario requires continuous, scalable remediation across all current and future resources, which CloudWatch Events cannot achieve without custom logic to poll for changes. This option is tempting because CloudWatch Events is commonly used to react to state changes, such as triggering a Lambda on an EC2 instance state change, and would be correct if the requirement were to remediate only existing, static security groups after a one-time audit.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

One of 251 original DOP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.