Courseiva

CCNA Security and Compliance Questions

75 of 179 questions · Page 1/3 · Security and Compliance · Answers revealed

1
Multi-Selectmedium

A company uses AWS CodeBuild to build and test code. The build jobs need to access a private S3 bucket to download dependencies. Which THREE steps are required to securely grant access?

Select 3 answers
A.Configure the S3 bucket policy to allow access from the CodeBuild service principal
B.Set up a VPC endpoint for S3
C.Create an IAM role with a policy that allows s3:GetObject on the bucket
D.Create a KMS key and grant CodeBuild access to it
E.Attach the IAM role to the CodeBuild project in the service role field
AnswersA, C, E

The bucket policy must explicitly allow the role to access the bucket, unless the role has cross-account permissions.

Why this answer

To grant CodeBuild access to an S3 bucket, you need an IAM role that allows the required actions, attach it to the CodeBuild project, and also ensure the bucket policy allows the role. KMS key is not required if SSE-S3 is used. VPC endpoint is optional.

2
MCQeasy

A DevOps engineer needs to ensure that all API calls made to AWS are logged for compliance. The logs must be stored in S3 for at least 7 years. Which AWS service should they use?

A.VPC Flow Logs
B.AWS Config
C.Amazon CloudWatch Logs
D.AWS CloudTrail
AnswerD

CloudTrail records all AWS API calls and can deliver logs to S3 for long-term retention.

Why this answer

AWS CloudTrail is the correct service because it records all API calls made to AWS, including the identity, source IP, and timestamp, and can deliver log files to an S3 bucket for long-term retention. The requirement to store logs for at least 7 years aligns with CloudTrail's ability to integrate with S3 lifecycle policies for archival or deletion after a specified period.

Exam trap

The trap here is that candidates often confuse CloudTrail with CloudWatch Logs or AWS Config, thinking that any logging service can capture API calls, but only CloudTrail is designed specifically for auditing AWS API activity.

How to eliminate wrong answers

Option A is wrong because VPC Flow Logs capture network traffic metadata (IP addresses, ports, protocols) for VPCs, not API calls to AWS services. Option B is wrong because AWS Config records resource configuration changes and evaluates compliance rules, but it does not log API calls. Option C is wrong because Amazon CloudWatch Logs is designed for real-time monitoring and log storage from applications and AWS services, but it is not the primary service for auditing AWS API calls; CloudTrail is the dedicated service for that purpose.

3
MCQhard

A company wants to enforce that S3 buckets are not publicly accessible. Which AWS service can continuously monitor and automatically remediate non-compliant buckets?

A.AWS Config
B.Amazon Macie
C.AWS Security Hub
D.AWS Trusted Advisor
AnswerA

Config can evaluate rules and trigger remediation actions.

Why this answer

AWS Config can evaluate S3 bucket policies against managed rules like 's3-bucket-public-read-prohibited' and 's3-bucket-public-write-prohibited'. It can automatically remediate non-compliant buckets using AWS Systems Manager Automation or custom remediation actions. Option A is correct.

Amazon Macie is for sensitive data discovery, not for continuous monitoring of public access. AWS Security Hub aggregates security findings but does not automatically remediate. AWS Trusted Advisor provides checks but requires manual remediation.

4
MCQeasy

A company uses AWS Secrets Manager to store database credentials for a legacy application running on an on-premises server. The application retrieves the secret via the AWS SDK. Recently, the database password was rotated in Secrets Manager, but the application continued to use the old password and failed to connect. The application code is correct and uses the latest SDK. The IAM role attached to the server has the secretsmanager:GetSecretValue permission. What is the MOST likely cause?

A.The IAM role does not have permission to list secrets
B.The application is using the wrong secret ID
C.The secret rotation Lambda function is failing
D.The application is caching the secret and not refreshing it after rotation
AnswerD

Secrets Manager SDK caches credentials by default; the application may need to force refresh or wait for cache expiry.

Why this answer

The most likely cause is that the application is caching the secret and not refreshing it after rotation. By default, the AWS SDK for Secrets Manager caches secrets in memory for a configurable TTL (default 1 hour). Even though the secret is rotated in Secrets Manager, the application will continue to use the cached old secret until the cache expires or is explicitly refreshed.

Option A is incorrect because the IAM role has the required permission (secretsmanager:GetSecretValue) and listing secrets is not necessary for retrieval. Option B is unlikely because the application would fail immediately if using the wrong secret ID, not only after rotation. Option C is about the rotation Lambda function, but the application's failure to connect after rotation does not indicate the Lambda function itself is failing; rotation may have succeeded but the application is not fetching the new version.

5
MCQhard

Refer to the exhibit. The S3 bucket policy is applied to a bucket. An application attempts to upload an object to the bucket using HTTP (not HTTPS). What will happen?

A.The upload fails because the condition matches HTTP requests
B.The upload succeeds if the bucket also has an allow policy for the user
C.The upload succeeds because there is no explicit allow statement
D.The upload fails because the bucket policy does not allow any access
AnswerA

Deny applies when SecureTransport is false.

Why this answer

The bucket policy includes an explicit deny for all S3 actions when aws:SecureTransport is false (i.e., HTTP). This deny overrides any allow policies, so the upload fails. Option A is correct because the condition matches HTTP requests.

Option B is incorrect because the explicit deny overrides any allow. Option C is incorrect because the deny is explicit, so the condition is evaluated. Option D is incorrect because the policy only denies HTTP, not HTTPS.

6
Matchingmedium

Match each AWS security and identity service to its function.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Manages users, groups, roles, and permissions

Creates and manages encryption keys

Rotates and manages secrets like database credentials

DDoS protection service

Web application firewall

Why these pairings

IAM handles access control, AWS Organizations manages multi-account structure, and AWS Shield protects against DDoS attacks. The distractors incorrectly swap these definitions.

7
MCQhard

Refer to the exhibit. An IAM policy is attached to a group. A user in the group tries to terminate an EC2 instance with the tag 'Environment=production' in us-east-1. What will happen?

A.The action is denied because the Deny statement explicitly denies the action for production instances.
B.The action is allowed because there is no explicit Deny for the user.
C.The action is denied only if the instance is in the us-east-1 region.
D.The action is allowed because the Allow statement grants ec2:TerminateInstances.
AnswerA

Correct. The Deny statement explicitly denies TerminateInstances for production instances, and explicit Deny overrides any Allow.

Why this answer

The Deny statement explicitly denies ec2:TerminateInstances for instances with the tag 'Environment=production', and an explicit Deny overrides any Allow. Option B is wrong because the Deny applies to the user via group membership. Option C is wrong because the Deny is not region-specific; it applies globally.

Option D is wrong because the Allow statement is overridden by the explicit Deny.

8
MCQmedium

A DevOps engineer needs to securely store and automatically rotate database credentials for a web application running on Amazon ECS. Which solution should be used?

A.Use AWS KMS to generate and rotate a data key for encrypting the credentials in a file on ECS.
B.Store the credentials in AWS Systems Manager Parameter Store as a SecureString. Use a Lambda function to rotate them.
C.Store the credentials in AWS Secrets Manager and configure rotation. Grant the ECS task IAM role permission to retrieve the secret.
D.Use AWS Certificate Manager to store the credentials as a certificate.
AnswerC

Secrets Manager supports automatic rotation and ECS can retrieve secrets.

Why this answer

AWS Secrets Manager can store database credentials and automatically rotate them on a schedule. The ECS task can retrieve the credentials using the Secrets Manager secret. Option C is correct.

Option A (AWS KMS) is for encryption keys, not credential rotation. Option B (SSM Parameter Store) can store secrets but does not support automatic rotation. Option D (AWS Certificate Manager) is for SSL/TLS certificates.

9
MCQmedium

A DevOps engineer needs to encrypt data at rest in an Amazon S3 bucket that stores sensitive customer information. The company requires that the encryption key be managed by AWS and rotated automatically. Which encryption option should be used?

A.Server-side encryption with customer-provided keys (SSE-C)
B.Server-side encryption with AWS KMS managed keys (SSE-KMS) using a customer-managed key
C.Client-side encryption with an AWS KMS managed key
D.Server-side encryption with Amazon S3 managed keys (SSE-S3)
AnswerD

SSE-S3 uses AWS-managed keys with automatic rotation.

Why this answer

SSE-S3 uses AWS-managed keys and automatically rotates them, meeting the requirement. Option A (SSE-C) requires customer-managed keys and no automatic rotation. Option B (SSE-KMS with customer-managed key) does not automatically rotate unless configured.

Option D (client-side encryption) does not use AWS-managed keys.

10
MCQmedium

A company wants to centralize IAM user management across multiple AWS accounts. The company currently uses individual IAM users in each account. What is the BEST practice for centralized access control?

A.Use AWS Organizations and AWS IAM Identity Center (AWS SSO) to manage users centrally.
B.Create the same IAM users in each account with identical permissions.
C.Create IAM roles in each account and allow cross-account access from a central account.
D.Use IAM federation with an external identity provider and assign permissions based on SAML attributes.
AnswerA

IAM Identity Center provides centralized user management and SSO.

Why this answer

AWS Organizations with IAM Identity Center (AWS SSO) enables centralized user management and single sign-on across multiple AWS accounts, eliminating the need to manage individual IAM users in each account. Option B is incorrect because creating the same IAM users in each account leads to duplication and inconsistent permissions. Option C is incorrect because cross-account roles still require local IAM users or federated identities to assume those roles, and do not provide centralized user management.

Option D is incorrect because IAM federation with an external IdP centralizes authentication but does not inherently manage users across accounts unless combined with AWS Organizations and IAM Identity Center.

11
Multi-Selectmedium

A company is designing a secure CI/CD pipeline. Which TWO actions should be taken to protect secrets (e.g., API keys) used in the pipeline? (Choose TWO.)

Select 2 answers
A.Encrypt secrets with AWS KMS and store the encrypted value in the source code
B.Store secrets in AWS Secrets Manager
C.Use IAM roles to grant the CI/CD service access to secrets
D.Store secrets in plaintext in the buildspec file
E.Pass secrets as environment variables in the build
AnswersB, C

Secrets Manager provides secure storage and rotation.

Why this answer

AWS Secrets Manager stores and rotates secrets securely. IAM roles should be used to grant access to secrets without hardcoding. Storing secrets in buildspec or environment variables is insecure.

Using KMS to encrypt secrets is good, but the question asks for TWO best practices: using Secrets Manager and IAM roles.

12
MCQhard

A company's security team notices that an IAM user has permissions to terminate EC2 instances but should only be allowed to stop them. The current policy allows ec2:TerminateInstances. What is the most secure way to prevent termination while allowing stop?

A.Use an SCP to deny ec2:TerminateInstances for the entire account.
B.Modify the existing policy to include ec2:StopInstances and remove ec2:TerminateInstances.
C.Add a Deny statement for ec2:TerminateInstances with a condition for the user's ARN.
D.Attach a separate managed policy that denies ec2:TerminateInstances to the user.
AnswerC

Explicitly denies termination for that user while allowing stop via other policies.

Why this answer

The most secure because adding a Deny statement for ec2:TerminateInstances with a condition for the user's ARN explicitly blocks the termination action, regardless of any other policies that might allow it. Option A is wrong because an SCP affects the entire account, not just the user, and may be too broad. Option B is wrong because simply modifying the policy to include ec2:StopInstances and remove ec2:TerminateInstances does not prevent termination if the user has other policies that grant ec2:TerminateInstances.

Option D is wrong because attaching a separate Deny policy is effective but less direct and more complex than adding a Deny in the same policy.

13
MCQeasy

A company wants to centrally manage and audit access to AWS KMS keys across multiple accounts. Which AWS feature should be used?

A.AWS Config aggregated rules
B.Cross-account IAM roles
C.AWS CloudTrail with organization trail
D.AWS Organizations tag policies
AnswerC

Organization trails aggregate logs from all accounts.

Why this answer

AWS CloudTrail with an organization trail can log all API calls, including KMS key usage, across multiple accounts in an AWS Organization. This provides centralized audit logging for KMS key access. Option A (AWS Config aggregated rules) can evaluate resource compliance but does not audit key usage.

Option B (Cross-account IAM roles) allows access but not centralized auditing. Option D (AWS Organizations tag policies) manage tags, not auditing. Therefore, option C is correct.

14
MCQhard

A DevOps engineer needs to ensure that an S3 bucket policy enforces encryption in transit for all access. Which policy statement should be added?

A.{"Effect":"Deny","Condition":{"StringEquals":{"aws:SecureTransport":"true"}}}
B.{"Effect":"Allow","Condition":{"Bool":{"aws:SecureTransport":"false"}}}
C.{"Effect":"Allow","Condition":{"Bool":{"aws:SecureTransport":"true"}}}
D.{"Effect":"Deny","Condition":{"Bool":{"aws:SecureTransport":"false"}}}
AnswerD

Denies access when SecureTransport is false, effectively requiring HTTPS.

Why this answer

To enforce encryption in transit, use a condition that denies access unless the request uses 'aws:SecureTransport' set to 'true'. This requires a Deny effect with the condition.

15
Multi-Selecthard

A company has an IAM policy that allows users to manage their own passwords and MFA devices. The policy includes a condition that requires MFA for all API operations except for changing passwords and MFA. Which THREE statements are true about this policy? (Choose THREE.)

Select 3 answers
A.The policy creates an IAM role for MFA enforcement.
B.The policy applies to the AWS account root user.
C.The policy uses NotAction to exclude password and MFA actions.
D.The policy uses the aws:MultiFactorAuthPresent condition key.
E.The policy must be attached to IAM users or groups.
AnswersC, D, E

NotAction allows those actions without MFA.

Why this answer

Options C, D, and E are correct. The policy uses NotAction to exclude password and MFA actions from the MFA requirement, and uses the aws:MultiFactorAuthPresent condition key to require MFA for all other actions. The policy must be attached to IAM users or groups to take effect.

Option A is incorrect because the policy is an identity-based policy, not a role. Option B is incorrect because IAM policies do not apply to the root user.

16
MCQeasy

A DevOps engineer is configuring AWS Config rules to detect non-compliant security groups. The rule should trigger if any security group allows inbound SSH (port 22) from 0.0.0.0/0. Which AWS managed Config rule should be used?

A.vpc-sg-open-only-to-authorized-ports
B.ec2-security-group-attached-to-eni
C.restricted-ssh
D.incoming-ssh-disabled
AnswerC

Checks for SSH from 0.0.0.0/0.

Why this answer

'restricted-ssh' is the managed rule that checks for SSH access from 0.0.0.0/0. Option A is wrong because 'vpc-sg-open-only-to-authorized-ports' is not specific to SSH. Option B is wrong because 'ec2-security-group-attached-to-eni' checks attachment, not rules.

Option D is wrong because 'incoming-ssh-disabled' is not a managed rule.

17
MCQmedium

The IAM policy above is attached to a user. The user tries to stop an EC2 instance. What will happen?

A.The user is denied due to an implicit deny.
B.The user cannot stop the instance because there is no explicit allow for all instances.
C.The user cannot stop the instance because the Deny statement overrides the Allow.
D.The user can stop the instance.
AnswerD

Explicit allow for StopInstances.

Why this answer

The policy includes an explicit Allow for ec2:StopInstances on all resources, and the Deny statement only applies to ec2:TerminateInstances. Since the user is attempting to stop (not terminate) the instance, the Allow applies and there is no applicable Deny, so the action is permitted. Therefore, the user can stop the instance.

18
MCQmedium

A DevOps engineer needs to encrypt data in transit between an Application Load Balancer (ALB) and backend EC2 instances. The application uses HTTPS. What is the simplest way to achieve this encryption?

A.Use an AWS Private Certificate Authority to issue certificates for the instances.
B.Use a Network Load Balancer instead with TLS listeners.
C.Place both ALB and instances in a VPC with default security groups.
D.Configure the ALB listener to use HTTPS, and configure the target group to use HTTPS with a self-signed certificate on the instances.
AnswerD

This encrypts traffic between ALB and instances.

Why this answer

An ALB can terminate HTTPS at the listener and then communicate with backend instances using HTTP if desired. However, to encrypt in transit, you can use HTTPS between ALB and instances as well. The simplest way is to install the same certificate on both ALB and instances, but ALB can use a self-signed certificate.

Using an internal CA or ACM Private CA is more complex. Using a TCP listener does not provide encryption.

19
MCQeasy

A company uses AWS Secrets Manager to store database credentials. The security team needs to automatically rotate the secrets every 30 days. Which action should be taken?

A.Enable automatic rotation on the secret and configure the rotation interval to 30 days
B.Manually rotate the secret every 30 days using the AWS Management Console
C.Store the secret in AWS Systems Manager Parameter Store and use a scheduled Lambda to update it
D.Use AWS KMS to rotate the secret by re-encrypting with a new key
AnswerA

Secrets Manager supports automatic rotation with a Lambda function.

Why this answer

AWS Secrets Manager supports automatic rotation of secrets using a Lambda function. You can enable automatic rotation on the secret and configure the rotation interval to 30 days (option A). Option B is not automatic, as it requires manual intervention each month.

Option C is incorrect because AWS Systems Manager Parameter Store does not natively rotate secrets; implementing a scheduled Lambda is a custom solution, not a direct action. Option D is incorrect because AWS KMS rotates encryption keys, not the secret value itself.

20
MCQhard

A company uses AWS Organizations with multiple accounts. The security team requires that all newly created S3 buckets in any account automatically have default encryption enabled and block public access. Which solution is MOST operationally efficient?

A.Use AWS CloudTrail to monitor bucket creation and trigger a Lambda function to apply settings
B.Apply a service control policy (SCP) that denies creation of buckets without encryption and public access block
C.Create a bucket policy on each existing bucket and rely on developers to apply it to new buckets
D.Use AWS Config rules to detect non-compliant buckets and send notifications
AnswerB

SCPs are preventive and apply organization-wide automatically.

Why this answer

The most operationally efficient solution is to use an SCP in AWS Organizations that denies creation of S3 buckets without default encryption and public access block. This enforces the security requirements at the organization level, preventing non-compliant bucket creation across all accounts without additional automation. Option A relies on CloudTrail and Lambda, which is reactive and adds complexity.

Option C is manual and not scalable. Option D uses AWS Config to detect non-compliant buckets but requires additional remediation steps, making it less efficient than a preventive SCP.

21
MCQhard

A company is using AWS CloudFormation to deploy infrastructure. The security team wants to ensure that any changes to IAM roles must be reviewed and approved by a security engineer before deployment. The DevOps engineer needs to implement a gating mechanism. Which approach should the engineer use?

A.Use AWS Config to detect changes to IAM roles and trigger a Lambda function that reverts the change.
B.Apply a service control policy that denies iam:CreateRole and iam:UpdateAssumeRolePolicy across the organization.
C.Add a condition to the IAM policy that requires MFA for any CloudFormation action.
D.Create a CodePipeline that deploys CloudFormation stacks and include a manual approval step for changes that modify IAM resources.
AnswerD

Manual approval step enforces review before deployment.

Why this answer

AWS CodePipeline can include a manual approval step before deploying CloudFormation stacks, allowing the security engineer to review and approve any changes to IAM roles. Option A is incorrect because AWS Config only detects changes after they occur; it cannot prevent deployment. Option B is incorrect because a service control policy would deny all IAM role creation across the organization, which is too restrictive and not a gating mechanism.

Option C is incorrect because requiring MFA for CloudFormation actions does not specifically gate changes to IAM resources.

22
Multi-Selectmedium

Which THREE are components of the AWS Shared Responsibility Model? (Choose THREE.)

Select 3 answers
A.AWS is responsible for patching customer applications on EC2
B.Customers are responsible for managing IAM users and permissions
C.AWS is responsible for managing customer IAM roles
D.Customers are responsible for securing their data in the cloud
E.AWS is responsible for the security of the cloud infrastructure
AnswersB, D, E

IAM is customer-managed.

Why this answer

In the AWS Shared Responsibility Model, AWS is responsible for the security of the cloud infrastructure (Option E), while customers are responsible for security in the cloud, including managing IAM users and permissions (Option B) and securing their data (Option D). Option A is incorrect because customers are responsible for patching their own applications on EC2, not AWS. Option C is incorrect because customers manage their own IAM roles, not AWS.

23
MCQmedium

An S3 bucket has the above bucket policy. What is the net effect on GetObject requests?

A.All anonymous users can read objects
B.All requests are denied
C.Only requests from IP range 192.0.2.0/24 are allowed
D.Only authenticated users can read objects
AnswerC

Deny with condition allows only that IP range.

Why this answer

The Allow statement grants public read access. The Deny statement denies all S3 actions when the source IP is not in 192.0.2.0/24. Since a Deny overrides an Allow, only requests from within that IP range are allowed.

Option C is correct.

24
MCQmedium

A DevOps engineer created the IAM policy shown in the exhibit and attached it to a user. The user tries to upload an object to my-bucket without specifying the ACL. Why does the upload fail?

A.The Effect should be Deny for this policy to work
B.The resource ARN is incorrect; it should be arn:aws:s3:::my-bucket
C.The user does not have permission to list the bucket
D.The policy condition requires the ACL to be bucket-owner-full-control, but the user did not specify it
AnswerD

The condition is not met, so the request is implicitly denied.

Why this answer

The policy condition requires the ACL to be 'bucket-owner-full-control'. If the user does not specify an ACL, the default is usually 'private', which does not satisfy the condition. Therefore the action is denied.

The resource ARN is correct. The action is allowed. The condition specifies StringEquals, which is correct for comparison.

25
Multi-Selecteasy

Which TWO are best practices for securing an Amazon RDS database? (Choose 2)

Select 2 answers
A.Enable public accessibility for easy management.
B.Use a single Availability Zone to reduce complexity.
C.Launch the RDS instance in a private subnet.
D.Enable encryption at rest using AWS KMS.
E.Grant direct IAM user access to the database.
AnswersC, D

Placing the database in a private subnet restricts direct internet access.

Why this answer

(launch RDS in a private subnet) and Option D (enable encryption at rest using AWS KMS) are correct best practices for securing an Amazon RDS database. Launching in a private subnet ensures the database is not directly accessible from the internet, enhancing security. Encryption at rest protects data stored on disk.

Option A is incorrect because enabling public accessibility increases exposure to attacks. Option B is incorrect because using a single Availability Zone does not enhance security and may reduce availability. Option E is incorrect because direct IAM user access to the database is not a standard practice; RDS uses database authentication, though IAM database authentication can be used, it's not a direct IAM user access and is not a best practice for all scenarios.

26
MCQhard

A company uses AWS Organizations to manage multiple accounts. The security team wants to ensure that no member account can disable AWS CloudTrail or delete CloudTrail logs. What is the most effective way to enforce this control?

A.Require all accounts to use the same CloudTrail trail.
B.Apply a Service Control Policy that denies cloudtrail:DeleteTrail and cloudtrail:StopLogging.
C.Create an IAM policy in each account that denies cloudtrail:DeleteTrail.
D.Configure CloudTrail to log to an S3 bucket in a centralized logging account and deny access to the bucket from member accounts.
AnswerB

SCPs are applied at the organization level and cannot be overridden by account admins.

Why this answer

A Service Control Policy (SCP) can deny the cloudtrail:DeleteTrail and cloudtrail:StopLogging actions across all accounts in the organization, effectively preventing member accounts from disabling CloudTrail or deleting logs. Option A is incorrect because requiring all accounts to use the same trail does not prevent them from disabling or deleting that trail; they could still perform those actions. Option C is incorrect because IAM policies within each account are managed by the account administrator and can be overridden, so they are not a reliable control.

Option D is incorrect because while logging to a centralized bucket helps protect logs, it does not prevent member accounts from disabling CloudTrail or deleting the trail itself in their own account; member accounts may still have permissions to modify or delete the trail.

27
Multi-Selecthard

A company is using AWS Lambda to process sensitive data. The security team requires that the Lambda function only be invoked from within a specific VPC and that the function's environment variables be encrypted at rest. Which TWO actions should the DevOps engineer take to meet these requirements?

Select 2 answers
A.Enable AWS KMS encryption for the Lambda function's environment variables using a customer-managed key.
B.Enable encryption for CloudWatch Logs using a KMS key.
C.Configure the Lambda function to be VPC-enabled and set up a VPC endpoint for Lambda.
D.Assign an IAM execution role with permissions to access a KMS key.
E.Attach a resource-based policy to the Lambda function that denies invoke unless the request comes from the VPC.
AnswersA, C

KMS encryption protects environment variables at rest.

Why this answer

Using a customer-managed KMS key to encrypt the Lambda function's environment variables satisfies the encryption at rest requirement. Option C is correct because configuring the Lambda function to be VPC-enabled and setting up a VPC endpoint for Lambda restricts invocation to within the specific VPC. Option B is incorrect because encrypting CloudWatch Logs does not encrypt the Lambda environment variables.

Option D is incorrect because assigning an IAM execution role with KMS permissions is necessary but not sufficient; the encryption is enabled by configuring KMS on the function. Option E is incorrect because resource-based policies cannot restrict invocation to VPC origin alone; VPC configuration and endpoints are required.

28
MCQmedium

An organization uses AWS Organizations with multiple accounts. The Security team needs to enforce a policy that prohibits the creation of S3 buckets with public access in any account. Which policy type should be used?

A.Service control policy (SCP)
B.IAM permissions boundary
C.AWS CloudTrail trail
D.AWS Config rule
AnswerA

SCPs can be applied to organizational units or the entire organization to deny actions like s3:PutBucketPublicAccessBlock.

Why this answer

Service control policies (SCPs) allow you to centrally control permissions across all accounts in an organization. SCPs can deny actions like creating public buckets. IAM policies are account-specific.

AWS Config rules can detect but not prevent.

29
Multi-Selecteasy

Which AWS services can be used to protect a web application from common web exploits like SQL injection and cross-site scripting? (Select TWO.)

Select 2 answers
A.AWS WAF
B.AWS Shield Advanced
C.Amazon CloudFront with AWS WAF
D.Amazon Inspector
E.Amazon Cognito
AnswersA, C

WAF can inspect HTTP requests and block SQL injection and XSS.

Why this answer

AWS WAF is a web application firewall that filters malicious requests. CloudFront can be integrated with WAF to provide protection at the edge. Shield Advanced provides DDoS protection, not application-layer exploits.

Cognito is for authentication. Inspector is for vulnerability scanning.

30
MCQmedium

Refer to the exhibit. An EC2 instance with the IAM role MyAppRole is running. An application on the instance tries to delete an object from the S3 bucket 'example-bucket'. What will happen?

A.The request is allowed because the instance has full access to the bucket.
B.The request is denied because the bucket policy overrides the IAM role.
C.The request is denied because the IAM role does not have the s3:DeleteObject permission.
D.The request is allowed because the role has s3:GetObject permission, which includes delete.
AnswerC

The policy only allows s3:ListBucket and s3:GetObject.

Why this answer

The IAM role MyAppRole does not include the s3:DeleteObject permission, so the request to delete an object from the S3 bucket is denied. Option A is incorrect because the role does not have full access—it only has specific permissions. Option B is incorrect because the bucket policy does not override the IAM role; both policies must allow the action for it to be permitted.

Option D is incorrect because s3:GetObject does not include the delete permission; they are separate actions.

31
MCQmedium

An IAM policy is attached to an IAM user. The user reports that they cannot download objects from the S3 bucket 'example-bucket' even though they are connecting from within the 10.0.0.0/16 IP range. What is the MOST likely reason?

A.The policy needs an additional condition for VPC endpoint.
B.The policy does not allow the s3:ListBucket action.
C.The user is accessing S3 through a VPC endpoint, but the condition only works for public IP addresses.
D.The resource ARN is missing the bucket-level permission.
AnswerC

The aws:SourceIp condition does not work for VPC endpoint traffic; use aws:VpcSourceIp instead.

Why this answer

The condition 'aws:SourceIp' evaluates the IP address of the requester. However, if the user is accessing S3 through a VPC endpoint, the source IP is a private IP from the VPC, but the condition works only for public IP addresses. Option C is correct.

Option A is wrong because the policy allows GetObject. Option B is wrong because the resource is correct. Option D is wrong because the condition is for source IP, not VPC endpoint.

32
MCQmedium

A DevOps engineer needs to grant cross-account access to an S3 bucket in Account A for users in Account B. The users in Account B must be able to list objects and read them. What is the most secure way to configure this access?

A.Create a bucket policy in Account A that grants access to the IAM user ARNs from Account B.
B.Create a KMS key in Account A and share it with Account B to decrypt objects.
C.Create a bucket policy in Account A granting access to the root user of Account B, and create an IAM policy in Account B allowing the users to access the bucket.
D.Create an IAM role in Account A with trust policy allowing Account B to assume it, and attach a policy granting S3 access.
AnswerC

This is the standard cross-account S3 access pattern.

Why this answer

It combines a bucket policy in Account A granting access to Account B's root or specific ARN, and an IAM policy in Account B allowing users to access that bucket. Option A is wrong because a bucket policy alone is insufficient; Account B users also need IAM permissions. Option B is wrong because KMS is for encryption, not access control.

Option D is wrong because creating an IAM role in Account A with a trust policy allowing Account B to assume it is a valid pattern, but the question specifies users in Account B; they would need to assume the role, which is less direct than Option C for S3 access.

33
Multi-Selecteasy

A company wants to protect its AWS account credentials. Which TWO practices are recommended by AWS? (Choose TWO.)

Select 2 answers
A.Generate and share access keys for all users.
B.Store IAM user passwords in a shared document.
C.Enable multi-factor authentication (MFA) for privileged users.
D.Use the root user for daily administrative tasks.
E.Use IAM roles for applications that require AWS access.
AnswersC, E

Adds security.

Why this answer

Enabling multi-factor authentication (MFA) adds an extra layer of security beyond a password, which is especially important for privileged users. Option E is correct because IAM roles provide temporary credentials for applications, eliminating the need to store long-term access keys and reducing security risks. Option A is incorrect because access keys should not be shared; each user should have their own keys and they should be rotated regularly.

Option B is incorrect because storing IAM user passwords in a shared document violates security best practices and increases the risk of unauthorized access. Option D is incorrect because using the root user for daily administrative tasks is dangerous; the root user should be used only for limited, high-privilege tasks, and otherwise should be protected with MFA and not used for routine operations.

34
Multi-Selecteasy

Which TWO AWS services can be used to manage and rotate database credentials automatically? (Select TWO.)

Select 2 answers
A.AWS Systems Manager Parameter Store
B.AWS Secrets Manager
C.AWS CloudFormation
D.AWS KMS
E.AWS IAM
AnswersA, B

Can store secrets and with custom Lambda can rotate.

Why this answer

Options A and B are correct. AWS Systems Manager Parameter Store can store database credentials as SecureString parameters, and you can implement automatic rotation using a custom AWS Lambda function. AWS Secrets Manager provides built-in automatic rotation for supported databases (e.g., Amazon RDS, Amazon Redshift) without requiring custom code.

Option C (AWS CloudFormation) is an infrastructure-as-code service and does not manage or rotate credentials. Option D (AWS KMS) is a key management service that encrypts data but does not handle credential rotation. Option E (AWS IAM) manages access permissions and roles, not database credentials.

35
MCQmedium

A DevOps engineer receives an alert that an EC2 instance has been compromised. The instance is part of an Auto Scaling group. What is the first step the engineer should take to isolate the instance?

A.Create a snapshot of the instance's root volume
B.Detach the instance from the Auto Scaling group and remove it from the load balancer
C.Create an AMI of the instance for analysis
D.Terminate the instance immediately
AnswerB

Isolates the instance by stopping traffic and decoupling from ASG.

Why this answer

The first step to isolate a compromised EC2 instance in an Auto Scaling group is to detach it from the Auto Scaling group and remove it from the load balancer. This stops all incoming traffic to the instance, preventing further damage or data exfiltration while preserving the instance for forensic analysis. Option A (snapshot) is useful for preserving evidence but does not isolate the instance.

Option C (AMI) similarly does not provide immediate isolation. Option D (terminate) may destroy evidence and should only be done after investigation.

36
MCQmedium

A company runs a web application on EC2 instances behind an Application Load Balancer (ALB). The security team requires that all traffic to the ALB must be encrypted (HTTPS) and that the ALB must only accept traffic from CloudFront. The DevOps engineer has configured CloudFront with an origin pointing to the ALB, and the ALB has a listener on port 443 with a valid SSL certificate. The engineer also added a security group rule to the ALB that allows HTTPS traffic only from CloudFront's IP ranges. However, users are reporting intermittent 503 errors. The engineer checks CloudFront logs and sees that some requests are failing with 'Origin Connect Error'. What is the most likely cause?

A.The ALB has a Web Application Firewall (WAF) that is blocking requests from CloudFront.
B.The security group rule is using an outdated list of CloudFront IP ranges, and CloudFront has added new IP ranges that are being blocked.
C.The SSL certificate on the ALB is not trusted by CloudFront, causing handshake failures.
D.The ALB idle timeout is set too low, causing CloudFront to close connections prematurely.
AnswerB

Correct. The security group rule using an outdated list of CloudFront IP ranges can cause intermittent 503 errors when CloudFront adds new IPs that are blocked.

Why this answer

The most likely cause is that the security group rule is using an outdated list of CloudFront IP ranges. CloudFront's IP ranges are dynamic and change over time; AWS publishes these ranges but they are not static. When a new range is added that is not in the security group rule, requests from those IPs are blocked, leading to 'Origin Connect Error' and intermittent 503 errors.

The correct approach is to use a custom header (e.g., X-Origin-Verify) from CloudFront and validate it at the ALB, rather than relying on IP-based security groups. Option A (WAF blocking) would typically result in 403 Forbidden, not 503. Option C (SSL certificate) would cause handshake failures with a different error.

Option D (idle timeout) would cause consistent timeout errors, not intermittent ones.

37
MCQeasy

A company uses AWS Organizations to manage multiple accounts. The security team wants to centrally enforce that S3 buckets in all accounts block public access. Which policy should be attached to the root organizational unit to achieve this?

A.Configure a bucket policy on each S3 bucket to deny public access.
B.Create an AWS Config rule to mark noncompliant buckets.
C.Attach an IAM policy to the root user of each account.
D.Attach a service control policy (SCP) to the root organizational unit.
AnswerD

SCPs provide preventive guardrails at the organization level, denying actions across all accounts.

Why this answer

Service control policies (SCPs) attached to the root organizational unit can centrally deny actions across all member accounts. An SCP that denies `s3:PutBucketPublicAccessBlock` and related actions can enforce that S3 buckets block public access. Option D is correct.

Option B is incorrect because AWS Config rules only detect noncompliant resources but cannot prevent the action; they are detective, not preventive. Options A and C are also incorrect as explained.

38
Multi-Selectmedium

Which TWO actions are effective ways to protect an AWS account root user? (Choose 2)

Select 2 answers
A.Use a strong, complex password and change it every 90 days.
B.Use the root user for everyday administrative tasks.
C.Enable multi-factor authentication (MFA) on the root user.
D.Rotate the root user password every 30 days.
E.Delete or disable the root user access keys.
AnswersC, E

MFA adds an extra layer of security.

Why this answer

The correct actions to protect the root user are enabling MFA (Option C) and disabling or deleting any access keys associated with the root user (Option E). Option A is incorrect because a strong password alone is insufficient; MFA is essential. Option B is wrong because the root user should not be used for everyday tasks—it should be reserved for limited administrative actions.

Option D is incorrect because rotating the password every 30 days does not address the core security risk; the root user should not have access keys at all.

39
MCQhard

A company has an AWS Lambda function that processes sensitive data. The function needs to access an RDS database with credentials stored in Secrets Manager. What is the MOST secure way to grant the Lambda function access to the secret?

A.Use AWS KMS to encrypt the credentials and pass them as parameters.
B.Attach an IAM role to the Lambda function with permissions to read the secret and retrieve it at runtime.
C.Store the credentials directly in the Lambda function's environment variables.
D.Use Lambda environment variables with encryption enabled.
AnswerB

Securely grants access without embedding secrets.

Why this answer

The most secure way to grant a Lambda function access to a secret in AWS Secrets Manager is to attach an IAM role to the Lambda function with permissions to read the secret and retrieve it at runtime (Option B). This follows the principle of least privilege and avoids hardcoding or embedding secrets in the function code. Option A is incorrect because AWS KMS is used for encryption, not for storing or retrieving secrets; Secrets Manager handles secret storage, and KMS can be used to encrypt secrets at rest.

Option C is insecure because storing credentials directly in environment variables exposes them in plain text. Option D is also insecure because even with encryption enabled, environment variables can be exposed in logs or through the AWS Management Console, and they are not designed for secret management.

40
MCQeasy

The AWS Config rule 's3-bucket-ssl-requests-only' returns NON_COMPLIANT for the bucket 'my-bucket'. What does this mean?

A.The bucket's policy does not deny requests that are not using SSL.
B.The bucket is publicly accessible.
C.The bucket does not have server access logging enabled.
D.The bucket does not have default encryption enabled.
AnswerA

Correct interpretation of the rule.

Why this answer

The AWS Config rule 's3-bucket-ssl-requests-only' checks whether the bucket policy explicitly denies requests that are not using SSL (i.e., HTTP). A NON_COMPLIANT result indicates the bucket policy does not contain a deny effect for HTTP requests, meaning SSL-only access is not enforced. Option A correctly describes this condition.

Option B is incorrect because the rule does not check public access. Option C is incorrect because server access logging is unrelated. Option D is incorrect because default encryption is not checked by this rule.

41
MCQeasy

A DevOps engineer needs to store secrets such as database passwords for a serverless application. Which AWS service is most appropriate?

A.Amazon DynamoDB with encryption
B.Amazon S3 with server-side encryption
C.AWS Systems Manager Parameter Store (SecureString)
D.AWS Secrets Manager
AnswerD

Designed for secrets with rotation and fine-grained access.

Why this answer

AWS Secrets Manager is the most appropriate service because it is specifically designed to manage secrets like database passwords, with automatic rotation, encryption, and fine-grained access control. Option A (DynamoDB) is a database, not a secrets manager. Option B (S3) can store encrypted data but lacks built-in secret rotation and management.

Option C (Systems Manager Parameter Store SecureString) can store secrets but does not support automatic rotation, making Secrets Manager the better choice.

42
MCQhard

A company uses Amazon Inspector to scan EC2 instances for vulnerabilities. The security team discovers that a critical vulnerability is present on an instance, but the instance is part of an Auto Scaling group. What is the MOST efficient way to remediate this vulnerability while ensuring the Auto Scaling group remains operational?

A.Patch the instance manually via SSH, then create a new AMI from it and update the launch configuration.
B.Detach the instance from the Auto Scaling group, patch it, and reattach it.
C.Use AWS Systems Manager Patch Manager to patch the instance and then set the instance to not receive future updates.
D.Create a new AMI with the patch, update the Auto Scaling group's launch template, and terminate instances one by one to trigger replacement.
AnswerD

This ensures all new instances are patched with minimal disruption.

Why this answer

The most efficient way is to create a new Amazon Machine Image (AMI) with the vulnerability patched, update the Auto Scaling group's launch configuration/template to use the new AMI, and then perform a rolling update (e.g., by terminating instances one by one). Manually patching each instance is inefficient because Auto Scaling will launch new instances from the old AMI. Using AWS Systems Manager Patch Manager can patch on the fly but does not update the launch template for future instances.

Isolating the instance does not fix the root cause.

43
Multi-Selectmedium

Which TWO actions are best practices for securing an AWS account root user? (Select TWO.)

Select 2 answers
A.Use the root user for daily administrative tasks
B.Create access keys for the root user to use with CLI
C.Create an IAM user with administrator access and use that instead
D.Enable multi-factor authentication (MFA) for the root user
E.Delete the root user after creating an IAM admin user
AnswersC, D

Avoid using root user for daily tasks.

Why this answer

Best practices for root user include enabling MFA, using a strong password, and not using root for daily tasks. Deleting the root user is not possible. Access keys should not be created for root user.

44
MCQhard

Refer to the exhibit. An IAM policy is attached to an IAM user. The user tries to download an object from the S3 bucket 'example-bucket' from an IP address of 10.1.2.3. What will happen?

A.The request is denied because the policy does not include a Deny statement.
B.The request is denied because the policy does not explicitly allow the action.
C.The result depends on the bucket policy.
D.The request is allowed because the condition matches the IP address.
AnswerD

The IP 10.1.2.3 is within the 10.0.0.0/8 CIDR range.

Why this answer

The IAM policy includes a condition that allows s3:GetObject only if the request originates from an IP address within the 10.0.0.0/8 range. The user's IP 10.1.2.3 falls within this range, so the condition is satisfied and the action is allowed. Option A is wrong because a Deny statement is not required; an explicit Allow with a condition is sufficient.

Option B is wrong because the policy does explicitly allow the action when the condition is met. Option C is wrong because the bucket policy is not specified and the IAM policy already grants permission; the result does not depend on the bucket policy unless it explicitly denies, but no such policy is shown.

45
MCQeasy

A DevOps engineer needs to grant cross-account access to an S3 bucket. The source account is 111111111111 and the destination account is 222222222222. Which policy should be attached to the S3 bucket?

A.Attach an IAM policy to the user in account 111111111111 allowing s3:GetObject.
B.Set the bucket ACL to grant full control to account 222222222222.
C.{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":"arn:aws:iam::222222222222:root"},"Action":"s3:GetObject","Resource":"arn:aws:s3:::example-bucket/*"}]}
D.{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"AWS":"arn:aws:iam::111111111111:root"},"Action":"s3:GetObject","Resource":"arn:aws:s3:::example-bucket/*"}]}
AnswerC

Bucket policy grants cross-account access to objects.

Why this answer

It uses a bucket policy to grant cross-account access to the S3 bucket. The policy specifies the destination account (222222222222) as the principal, allowing s3:GetObject on the bucket's objects. This is the standard AWS approach for cross-account S3 access, as bucket policies can grant permissions to principals in other AWS accounts.

Exam trap

The trap here is that candidates often confuse which account's ARN to use in the Principal field, mistakenly using the source account (111111111111) instead of the destination account (222222222222), or they incorrectly assume an IAM policy in the source account can grant cross-account access.

How to eliminate wrong answers

Option A is wrong because attaching an IAM policy to a user in the source account (111111111111) does not grant access to the destination account; it only grants permissions to that specific user within the source account. Option B is wrong because bucket ACLs are legacy and do not support granting cross-account access to objects in a bucket that has S3 Object Ownership enabled (default since April 2023), and they are less secure and flexible than bucket policies. Option D is wrong because it specifies the source account (111111111111) as the principal, which would only grant access to the source account itself, not the destination account (222222222222).

46
MCQeasy

A DevOps engineer needs to securely store database credentials for an application running on Amazon ECS. Which AWS service should be used to manage the credentials and provide them to the ECS tasks?

A.AWS Secrets Manager
B.Amazon S3 with server-side encryption
C.AWS Systems Manager
D.AWS Systems Manager Parameter Store
AnswerA

Secrets Manager provides secure storage, automatic rotation, and fine-grained access control for secrets.

Why this answer

AWS Secrets Manager (Option A) is the correct service for securely storing database credentials. It provides automatic rotation, fine-grained access control, and native integration with Amazon ECS via task roles, allowing containers to retrieve secrets at runtime. Option B (Amazon S3 with SSE) is wrong because S3 is a general-purpose object store; storing credentials in S3 requires manual encryption and access management, and it lacks native rotation.

Option C (AWS Systems Manager) is a broad management service that includes features like Run Command and Patch Manager, but it is not specifically designed for secrets management. Option D (AWS Systems Manager Parameter Store) can store parameters and secrets, but it lacks automatic rotation and is less secure for credential management compared to Secrets Manager.

47
MCQhard

Refer to the exhibit. An S3 bucket policy is configured as shown. A user from IP 192.0.2.10 is unable to download an object from the bucket. What is the most likely cause?

A.The bucket policy requires HTTPS, but the user is using HTTP.
B.The policy does not allow s3:ListBucket, so the user cannot list objects.
C.The bucket policy does not allow s3:GetObjectVersion.
D.The IP address is not in the allowed range.
AnswerB

Without ListBucket, the user cannot see the objects to download them via the console.

Why this answer

The bucket policy does not grant the s3:ListBucket action, so the user cannot list objects. The GetObject action allows reading a specific object if the key is known, but the user might be trying to list first, or the bucket is not public. However, the most common issue is that the user needs s3:ListBucket to navigate.

Option B is correct.

48
MCQmedium

A company needs to store audit logs for 7 years to meet compliance requirements. Which S3 storage class is the most cost-effective for long-term archival?

A.S3 Glacier Deep Archive
B.S3 Intelligent-Tiering
C.S3 Standard
D.S3 Glacier Flexible Retrieval
AnswerA

Deep Archive is the lowest-cost storage class for long-term retention.

Why this answer

S3 Glacier Deep Archive is the lowest-cost storage class designed for long-term archival of data that is accessed rarely (once or twice per year) and can tolerate retrieval times of 12-48 hours. For a 7-year compliance retention requirement, it provides the most cost-effective storage compared to S3 Glacier Flexible Retrieval, S3 Intelligent-Tiering, or S3 Standard.

49
MCQeasy

A company wants to centralize logging of all API calls made within their AWS account for auditing. Which service should they use?

A.Amazon S3 access logs
B.AWS CloudTrail
C.VPC Flow Logs
D.Amazon CloudWatch Logs
AnswerB

Records all API calls for auditing and compliance.

Why this answer

AWS CloudTrail records API calls for auditing. Option A is wrong because Amazon S3 access logs only record HTTP requests to S3 buckets, not all API calls across the account. Option C is wrong because VPC Flow Logs capture network traffic metadata, not API calls.

Option D is wrong because Amazon CloudWatch Logs is a service for storing and monitoring log files, but it does not inherently capture API calls.

50
MCQmedium

A company is using AWS KMS to encrypt data at rest in Amazon S3. The Security team requires that all encryption keys be automatically rotated annually. Which key type should be used to meet this requirement?

A.Asymmetric KMS key
B.AWS managed symmetric key
C.Customer managed symmetric key
D.Custom key store backed by AWS CloudHSM
AnswerB

AWS managed keys are automatically rotated every year, meeting the requirement without additional configuration.

Why this answer

AWS managed KMS keys (AWS managed keys) are automatically rotated every year. Customer managed keys require manual rotation or key rotation configuration. AWS managed keys are used for services like S3, EBS, and RDS.

51
MCQeasy

A company is using Amazon S3 to store sensitive data. The security team mandates that all data must be encrypted at rest using server-side encryption with AWS Key Management Service (SSE-KMS). The DevOps engineer must ensure that any new objects uploaded to the bucket are automatically encrypted. What should the engineer do?

A.Enable CORS on the bucket to allow encrypted uploads.
B.Apply a bucket policy that denies PutObject unless the request includes the x-amz-server-side-encryption header with aws:kms.
C.Enable default encryption on the S3 bucket and select AWS-KMS as the encryption method.
D.Enable S3 Versioning to protect encrypted objects.
AnswerC

Default encryption applies SSE-KMS to all objects.

Why this answer

Enabling default encryption on the S3 bucket with SSE-KMS ensures that all objects uploaded to the bucket are automatically encrypted at rest with AWS KMS. Option A is incorrect because CORS is for cross-origin requests and does not affect encryption. Option B is incorrect because while a bucket policy can enforce encryption headers, it does not provide default encryption; it only denies requests without the header, and default encryption is a simpler and more reliable method.

Option D is incorrect because versioning does not encrypt data.

52
Multi-Selectmedium

Which TWO of the following are benefits of using AWS Certificate Manager (ACM) to manage SSL/TLS certificates? (Choose two.)

Select 2 answers
A.Ability to use the same certificate on multiple EC2 instances.
B.Support for wildcard certificates only.
C.Automatic renewal of certificates.
D.Integration with Elastic Load Balancing and Amazon CloudFront.
E.Free certificates for use on any AWS service.
AnswersC, D

ACM automatically renews certificates, reducing administrative burden.

Why this answer

ACM automatically renews certificates before expiry, reducing manual overhead. It integrates with AWS services like ALB and CloudFront for easy deployment. ACM can export certificates for use on EC2 instances, but that is not a primary benefit; the main benefits are automatic renewal and integration.

53
MCQmedium

A company is using AWS CloudTrail to log API calls. The security team needs to ensure that log files are tamper-proof and can be used to verify integrity. Which feature should be enabled?

A.Server-side encryption (SSE-S3)
B.CloudTrail log file integrity validation
C.S3 Object Lock
D.MFA delete on the S3 bucket
AnswerB

This feature provides a digest file that can be used to verify log integrity.

Why this answer

CloudTrail log file integrity validation uses SHA-256 hashing and digital signing to ensure logs have not been tampered with. S3 object lock prevents deletion but not modification. MFA delete protects deletion but not modification.

SSE encrypts data at rest but does not protect integrity.

54
MCQmedium

A security engineer runs the above CLI command to investigate IAM user 'Bob'. The output shows Bob logged in and then created a new IAM user. Which additional information should the engineer look for to determine if this was a security incident?

A.The event name for the user creation.
B.The time the new user was last modified.
C.The source IP address from the CloudTrail event details.
D.The IAM group memberships of the new user.
AnswerC

The source IP can help identify if the login came from an unusual location.

Why this answer

To determine if the activity is malicious, the engineer should check the source IP address from the CloudTrail event details. The source IP can indicate if the login came from an unexpected location, suggesting compromised credentials. Option A is wrong because the event name (CreateUser) is already known from the command output.

Option B is wrong because the time the new user was last modified does not provide direct evidence about the unauthorized nature of the login event. Option D is wrong because the IAM group memberships of the new user do not indicate whether the login itself was unauthorized.

55
MCQhard

A DevOps engineer executed the CLI command shown in the exhibit. After creation, the security team requires that the log files be encrypted with a KMS key that is rotated every 90 days. The current key is a customer managed key with automatic rotation enabled set to 365 days. What should the engineer do to meet the requirement?

A.Use the existing key and change the rotation period in KMS
B.Disable automatic rotation and manually rotate the key every 90 days
C.Modify the KMS key to set the rotation period to 90 days
D.Create a new KMS key with automatic rotation set to 90 days and update the trail with the new key
AnswerD

Create a new key with the desired rotation and update the trail's KMS key.

Why this answer

The requirement is to encrypt log files with a KMS key that rotates every 90 days. The current key rotates every 365 days, and you cannot change the rotation period of an existing customer managed key; you must create a new key with the desired rotation period. Once created, you update the CloudTrail trail to use the new key by specifying the --kms-key-id parameter.

Option D correctly describes this process. Option A is wrong because you cannot change the rotation period of an existing key. Option B is wrong because manually rotating a key does not meet the automatic rotation requirement and is not recommended.

Option C is wrong because you cannot modify the rotation period of an existing key.

56
MCQeasy

A company wants to securely store database credentials used by an application running on Amazon EC2. The credentials should be automatically rotated every 90 days. Which AWS service should be used?

A.AWS IAM
B.AWS KMS
C.AWS Systems Manager Parameter Store
D.AWS Secrets Manager
AnswerD

Secrets Manager provides automatic rotation of secrets, including database credentials.

Why this answer

AWS Secrets Manager is designed for securely storing secrets and provides automatic rotation. Systems Manager Parameter Store can store secrets but does not natively support rotation without custom automation. KMS is for encryption keys, not secret rotation.

57
MCQmedium

A company is migrating a legacy application to AWS. The application requires cross-account access to an S3 bucket in a different AWS account. The security team wants to follow the principle of least privilege. How should the DevOps engineer configure the access?

A.Generate an access key for the root user of the source account and use it in the application.
B.Create an IAM role in the source account with necessary permissions and attach a bucket policy in the target account granting access to that role.
C.Create an IAM user in the target account with access keys and store them in AWS Secrets Manager.
D.Create an IAM user in the source account with programmatic access and a bucket policy allowing that user.
AnswerB

Least privilege and secure cross-account access.

Why this answer

It follows the recommended pattern for cross-account access: create an IAM role in the source account with necessary permissions and attach a bucket policy in the target account granting access to that role. This ensures least privilege by delegating access through a role rather than sharing long-term credentials. Option A is wrong because using root user credentials is insecure and violates least privilege.

Option C is wrong because the IAM user should be in the source account, not the target account, and access keys should not be stored in Secrets Manager for this purpose; instead, a role is preferred. Option D is wrong because although it creates an IAM user in the source account, a role is the recommended practice for cross-account access as it avoids managing long-term credentials.

58
MCQhard

Refer to the exhibit. An IAM policy is attached to an IAM user. Which of the following actions will be allowed by this policy?

A.DescribeInstances on an instance in us-east-1
B.StartInstances on an instance in us-east-1
C.DescribeInstances on an instance in us-west-2
D.StopInstances on an instance in us-east-1
AnswerA

Allowed by the first statement and not denied because condition is false.

Why this answer

The Allow statement grants the ec2:DescribeInstances action on all instances. The Deny statement denies all ec2 actions (ec2:*) on instances when the requested region is not us-east-1. Since the request in Option A is for us-east-1, the condition in the Deny statement is false, so the Deny does not apply.

Therefore, the Allow stands and DescribeInstances is permitted. Option B (StartInstances) is not explicitly allowed by any statement, and although the Deny does not apply for us-east-1, there is no Allow, so it is implicitly denied. Option C (DescribeInstances in us-west-2) is denied because the region is not us-east-1, triggering the Deny.

Option D (StopInstances in us-east-1) is also implicitly denied because no Allow exists for that action.

59
Multi-Selecteasy

A company wants to enable AWS CloudTrail to log all API calls across multiple accounts in AWS Organizations. The security team requires that logs be encrypted at rest and that any unauthorized deletion of log files be prevented. Which TWO actions should the security team take? (Choose TWO.)

Select 2 answers
A.Create a trail in the management account that applies to all accounts in the organization.
B.Enable default encryption with SSE-S3 on the S3 bucket where CloudTrail delivers logs.
C.Configure CloudTrail to send logs to Amazon CloudWatch Logs and enable encryption using an AWS KMS key.
D.Enable S3 Object Lock on the destination S3 bucket to prevent log file deletion.
E.Enable CloudTrail Insights to detect unusual API activity.
AnswersA, D

A trail applied to the organization logs all accounts.

Why this answer

Enabling CloudTrail for all accounts in the organization ensures centralized logging. Option D is correct because S3 Object Lock prevents deletion of log files. Option B is incorrect because KMS with a customer managed key provides encryption, but the key must be created beforehand, not just enabled.

Option C is incorrect because CloudWatch Logs encryption uses KMS, not S3 SSE. Option E is incorrect because CloudTrail can be configured to log management events by default, and this is not about data events.

60
MCQmedium

A company's security policy requires that all data stored in Amazon S3 must be encrypted at rest using server-side encryption with customer-managed keys (SSE-KMS). When uploading an object via the AWS CLI, which parameter must be included to enforce this?

A.--kms-key-id <key-id>
B.--sse AES256
C.--encryption aws:kms
D.--server-side-encryption aws:kms
AnswerD

This parameter enables SSE-KMS.

Why this answer

The correct parameter to enforce server-side encryption with AWS KMS (SSE-KMS) when uploading an object via the AWS CLI is --server-side-encryption aws:kms, which corresponds to option D. Option A is incorrect because --kms-key-id only specifies the key ID but does not enable encryption by itself; it must be combined with --server-side-encryption aws:kms. Option B is incorrect because --sse AES256 is not a valid AWS CLI parameter; the correct parameter for SSE-S3 is --server-side-encryption AES256.

Option C is incorrect because --encryption is not a valid AWS CLI parameter for server-side encryption.

61
MCQmedium

A DevOps engineer is troubleshooting a failed CodeBuild project. The build fails with an error: 'Access Denied: Unable to put object to S3.' The build project has an S3 bucket as the artifact store. What should the engineer do to resolve this issue?

A.Add s3:PutObject permission to the CodeBuild service role for the artifact bucket.
B.Enable server-side encryption on the artifact bucket.
C.Enable CloudWatch Logs for the build project.
D.Add s3:GetObject permission to the CodeBuild service role for the source bucket.
AnswerA

The service role lacks write permission.

Why this answer

The CodeBuild service role requires the s3:PutObject permission on the artifact S3 bucket to upload build artifacts. Option B is incorrect because enabling server-side encryption does not grant write permissions; the issue is a missing IAM permission. Option C is incorrect because CloudWatch Logs are used for build logs, not for S3 access; enabling them does not resolve the access denied error.

Option D is incorrect because s3:GetObject permission is for reading objects from a source bucket, not for writing artifacts. The error specifically indicates a failure to put an object into the artifact bucket, so the needed permission is s3:PutObject on that bucket.

62
MCQeasy

A DevOps engineer needs to allow an AWS Lambda function to write logs to Amazon CloudWatch Logs. What should the engineer do?

A.Attach an IAM role to the Lambda function's instance profile.
B.Attach an IAM policy to the Lambda execution role that allows logs:CreateLogGroup, logs:CreateLogStream, and logs:PutLogEvents.
C.Generate an access key for the Lambda function and configure the function to use it.
D.Create a resource-based policy on the CloudWatch Logs log group that allows the Lambda function to write.
AnswerB

The execution role is the standard way to grant permissions to a Lambda function.

Why this answer

Lambda functions assume an IAM role (execution role) that grants permissions. To write logs to CloudWatch Logs, the execution role must include a policy allowing logs:CreateLogGroup, logs:CreateLogStream, and logs:PutLogEvents. Option A is incorrect because Lambda functions do not use instance profiles; they use execution roles.

Option C is incorrect because access keys are not used for Lambda; the function assumes a role. Option D is incorrect because resource-based policies on CloudWatch log groups are typically used for cross-account access, not for the same account Lambda to CloudWatch.

63
MCQeasy

An organization needs to audit all AWS API calls made in their account for compliance purposes. Which AWS service should they enable?

A.Amazon CloudWatch Logs
B.AWS Config
C.AWS CloudTrail
D.Amazon GuardDuty
AnswerC

Records API calls for auditing.

Why this answer

AWS CloudTrail records API activity for auditing and compliance. Option A (Amazon CloudWatch Logs) is incorrect as it is a log management service but does not record API calls. Option B (AWS Config) is incorrect because it tracks resource configuration changes, not API calls.

Option D (Amazon GuardDuty) is incorrect because it is a threat detection service, not a comprehensive API audit trail.

64
Multi-Selectmedium

A company uses AWS CodePipeline for CI/CD. The security team requires that all code changes be scanned for secrets before deployment. The pipeline consists of a source stage (CodeCommit), a build stage (CodeBuild), and a deploy stage (CodeDeploy). The security team wants to automatically scan for secrets and block the pipeline if any secrets are found. Which THREE actions should the team take? (Choose THREE.)

Select 3 answers
A.Add a scanning action in the deploy stage to scan after deployment.
B.Configure the build project to fail the build if the scanning tool returns a non-zero exit code.
C.Add a scanning action in the build stage using a custom action or a third-party action from AWS Marketplace.
D.Configure an S3 bucket policy to deny access if secrets are detected.
E.Grant the CodeBuild service role permissions to retrieve the scanning tool from an S3 bucket.
AnswersB, C, E

A failed build stops the pipeline.

Why this answer

To automatically scan for secrets and block the pipeline, the team should add a scanning action in the build stage (Option C) using a custom or third-party action that integrates with AWS Marketplace. The build project should be configured to fail the build if the scanning tool returns a non-zero exit code (Option B), which prevents deployment from proceeding. Additionally, the CodeBuild service role needs permissions to retrieve the scanning tool, for example from an S3 bucket (Option E).

Option A is incorrect because scanning after deployment does not block the pipeline before deployment. Option D is incorrect because an S3 bucket policy does not directly block the pipeline based on secrets detection.

65
MCQhard

A company's security policy requires that all EC2 instances must be launched with an IAM role that provides least privilege access. A DevOps engineer needs to enforce this across the organization. Which approach is MOST effective?

A.Create an SCP that denies ec2:RunInstances if the specified IAM role is not the approved role
B.Create a service control policy (SCP) that denies the ec2:RunInstances action unless an instance profile is attached
C.Use AWS Config to detect instances without the required role and terminate them via Lambda
D.Create an IAM policy that denies ec2:RunInstances unless the instance is launched with the required IAM role, and attach it to all users
AnswerD

IAM policies can use condition keys like iam:PassedToService to enforce specific roles.

Why this answer

Attaching an IAM policy to all users that denies ec2:RunInstances unless the instance is launched with the required IAM role directly enforces the requirement. Option A (SCP denying if not the approved role) is incorrect because SCPs cannot check for a specific role attachment at launch time; they only control permissions at the account level. Option B (SCP denying unless instance profile attached) only requires any instance profile, not specifically the approved one.

Option C (AWS Config + Lambda) is reactive and can have delays, so it is less effective than a preventive IAM policy.

66
MCQeasy

A DevOps engineer is designing a CI/CD pipeline that deploys code to an EC2 instance. The engineer needs to securely store and retrieve database credentials used by the application. Which AWS service should be used?

A.Amazon S3 with server-side encryption
B.AWS Systems Manager Parameter Store
C.AWS Secrets Manager
D.AWS Key Management Service (KMS)
AnswerC

Secrets Manager provides secure storage and automatic rotation of secrets.

Why this answer

WS Secrets Manager (Option C) because it is specifically designed for securely storing, managing, and automatically rotating database credentials and other secrets. Amazon S3 with server-side encryption (Option A) is an object storage service and not intended for secret management; it lacks automatic rotation and fine-grained access control for secrets. AWS Systems Manager Parameter Store (Option B) can store secrets but does not natively support automatic rotation, which is a key requirement for database credentials.

AWS Key Management Service (Option D) manages encryption keys, not secrets themselves, and is used for encryption, not secret storage.

67
Multi-Selectmedium

A company wants to audit all changes to IAM policies in their AWS account. Which THREE services can be used to capture and alert on IAM policy changes? (Choose THREE.)

Select 3 answers
A.AWS Config
B.AWS CloudTrail
C.AWS Trusted Advisor
D.Amazon EventBridge
E.Amazon Inspector
AnswersA, B, D

Can track changes to IAM resources and evaluate rules.

Why this answer

Options A, B, and D are correct. AWS CloudTrail logs all IAM API calls. AWS Config can track resource changes and trigger rules.

Amazon EventBridge can create rules to detect specific CloudTrail events and trigger notifications. Option C: AWS Trusted Advisor provides best practice checks, not change auditing. Option E: Amazon Inspector is for security vulnerabilities.

68
Multi-Selecthard

Which THREE components are necessary to implement a secure VPC with a public subnet and a private subnet that hosts a database? (Choose THREE.)

Select 3 answers
A.AWS Site-to-Site VPN connection.
B.Internet Gateway attached to the VPC.
C.NAT Gateway in the public subnet.
D.VPC Peering connection to a central VPC.
E.Security group for the database allowing traffic only from the application tier.
AnswersB, C, E

Provides internet access to public subnet.

Why this answer

To implement a secure VPC with a public subnet and a private subnet hosting a database, three components are necessary. First, an Internet Gateway attached to the VPC (B) enables the public subnet to communicate with the internet. Second, a NAT Gateway in the public subnet (C) allows instances in the private subnet to initiate outbound traffic to the internet (e.g., for updates) while keeping them private.

Third, a security group for the database (E) must be configured to allow inbound traffic only from the application tier's security group, providing a firewall that restricts access to the database. A Site-to-Site VPN connection (A) is not required because there is no on-premises connection needed. VPC Peering (D) is unnecessary as there is no need to connect to another VPC.

Therefore, options B, C, and E are correct.

69
MCQmedium

A company has a multi-account AWS environment using AWS Organizations. The security team wants to enforce that all S3 buckets in all accounts are encrypted with SSE-S3. They plan to use an SCP to deny the creation of unencrypted buckets. The DevOps engineer writes an SCP with a Deny effect for s3:PutBucketEncryption without a condition. However, when testing, an administrator in a member account is able to create a bucket without encryption. The engineer checks CloudTrail and sees that the bucket was created with a PutBucket call that did not include the x-amz-server-side-encryption header. What is the most likely reason the SCP did not prevent this?

A.The SCP should also deny s3:PutBucketDefaultEncryption, which is the correct action for default encryption.
B.The SCP denies s3:PutBucketEncryption, but the bucket creation does not call that action; it calls s3:CreateBucket. The SCP should deny s3:CreateBucket with a condition on the encryption parameter.
C.The SCP is not attached to the organizational unit that contains the member account.
D.The member account is the management account of the organization, so SCPs do not apply.
AnswerB

s3:PutBucketEncryption is for modifying encryption after creation.

Why this answer

SCPs can deny the s3:PutBucketEncryption action, but the bucket is created with the s3:CreateBucket action, not s3:PutBucketEncryption. The s3:CreateBucket action does not trigger s3:PutBucketEncryption when encryption is not explicitly set; encryption defaults are applied separately. To enforce encryption at creation, the SCP should deny s3:CreateBucket with a condition that the x-amz-server-side-encryption header is absent or not set to AES256.

Option B correctly identifies this issue. Option A is incorrect because s3:PutBucketEncryption is used to change encryption settings on an existing bucket, not during creation. Option C is incorrect because the SCP being attached to the wrong OU would cause a different error.

Option D is incorrect because the management account is not the one being tested.

70
MCQeasy

A company wants to ensure that all S3 buckets are encrypted at rest by default. Which S3 feature should be enabled at the bucket level to automatically encrypt new objects?

A.S3 Object Lock
B.Bucket policy with a Deny for unencrypted uploads
C.S3 Versioning
D.Default encryption
AnswerD

Default encryption automatically encrypts new objects.

Why this answer

S3 default encryption allows you to set a default encryption behavior for a bucket, so that all new objects are encrypted at rest automatically. Bucket policies can enforce encryption but do not automatically encrypt. Object lock is for retention.

Versioning is for object versions.

71
MCQmedium

A company uses AWS Secrets Manager to store database credentials. The security team requires that secrets be automatically rotated every 30 days. Which rotation strategy should the engineer configure to meet this requirement with minimal operational overhead?

A.Manually rotate the secret every 30 days using the AWS CLI.
B.Store the secret in AWS Systems Manager Parameter Store with a SecureString parameter.
C.Enable automatic rotation using the pre-built Lambda rotation function for the database type.
D.Enable automatic rotation with a custom Lambda function.
AnswerC

Secrets Manager provides pre-built rotation templates for common databases.

Why this answer

Secrets Manager can automatically rotate secrets using a Lambda function. The easiest way is to use the pre-built Lambda rotation function for the specific database type (e.g., Amazon RDS). Creating a custom Lambda function is more overhead.

Manually rotating via CLI defeats automation. Using Systems Manager Parameter Store with SecureString does not provide built-in rotation.

72
Multi-Selecthard

A DevOps team needs to enforce that all S3 buckets in an AWS account are encrypted at rest. Which THREE steps should be taken to achieve this? (Choose THREE.)

Select 3 answers
A.Configure AWS Config rules to detect buckets without encryption
B.Use an S3 bucket policy to deny PutObject requests that do not include encryption headers
C.Enable S3 server access logging
D.Enable default encryption on each S3 bucket
E.Enable S3 Transfer Acceleration
AnswersA, B, D

Detects and can trigger remediation.

Why this answer

To enforce encryption at rest for all S3 buckets, three steps are needed: (A) AWS Config rules can detect buckets without encryption, providing visibility and enforcement through remediation; (B) an S3 bucket policy that denies PutObject requests lacking encryption headers ensures objects are encrypted when uploaded; (D) enabling default encryption on each bucket ensures that new objects are encrypted even if the upload does not specify encryption. Together, these cover detection, prevention, and default behavior. Option C (server access logging) is for auditing access, not encryption.

Option E (Transfer Acceleration) improves transfer speed, not encryption.

73
Multi-Selectmedium

A company needs to audit all changes to IAM policies in their AWS account. Which services can be used to track and log these changes? (Select TWO.)

Select 2 answers
A.Amazon S3
B.Amazon CloudWatch Logs
C.AWS Config
D.AWS CloudTrail
E.Amazon GuardDuty
AnswersC, D

Config can track changes to IAM policies and provide a history of configuration changes.

Why this answer

AWS CloudTrail logs API calls, including IAM policy changes. AWS Config can track configuration changes to IAM resources. CloudWatch Logs stores logs but does not track changes itself.

GuardDuty is for threat detection. S3 is storage.

74
Multi-Selecthard

Which THREE of the following are best practices for managing IAM roles in AWS Organizations? (Choose three.)

Select 3 answers
A.Use service control policies (SCPs) to set permission boundaries.
B.Share the root user credentials of the master account with administrators.
C.Use a single IAM user with full permissions across all accounts.
D.Use IAM roles to delegate access to users and services across accounts.
E.Create IAM roles with the principle of least privilege.
AnswersA, D, E

SCPs help centrally control permissions for all accounts.

Why this answer

Using IAM roles to delegate access across accounts is a best practice. Creating roles with least privilege and using service control policies (SCPs) to enforce permission boundaries are also best practices. Sharing root user credentials is never a best practice.

Using a single IAM user across accounts is not recommended.

75
MCQhard

A company needs to enforce that all EC2 instances launched in an AWS account use a specific Amazon Machine Image (AMI) that is approved by the security team. Which combination of services should be used?

A.AWS Organizations SCP and AWS CloudTrail
B.AWS Config rule to check AMI ID and AWS Systems Manager Automation to remediate non-compliant instances
C.AWS Lambda and Amazon SNS
D.AWS CloudTrail and Amazon CloudWatch Events
AnswerB

Config detects, Systems Manager automates remediation.

Why this answer

AWS Config can detect non-compliant instances and AWS Systems Manager Automation can automatically remediate by stopping or terminating them. Option B is correct. Option A (SCP) cannot enforce AMI IDs.

Option C (CloudTrail) only logs. Option D (Lambda) could be used but is not the primary service.

Page 1 of 3 · 179 questions totalNext →

Ready to test yourself?

Try a timed practice session using only Security and Compliance questions.