Courseiva
Question 556 of 724
SecuritymediumMultiple ChoiceObjective-mapped

DVA-C02 Security Practice Question

A developer is using AWS CodePipeline to deploy a web application. The pipeline includes a source stage from CodeCommit, a build stage using CodeBuild, and a deploy stage using CodeDeploy to EC2 instances. The application stores sensitive data in an S3 bucket. The developer needs to ensure that the S3 bucket is only accessible from the EC2 instances and not from any other AWS service or account. The EC2 instances have an IAM role that allows s3:GetObject. What additional configuration is required?

⚠ Common exam trap

It's easy for candidates to confuse encryption (SSE-KMS) or public access controls (Block Public Access) with network-level access restrictions, failing to realize that IAM permissions alone are insufficient to prevent access from other AWS services or accounts that have their own valid credentials.

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

Add a bucket policy that allows access only from the VPC endpoint or specific IP addresses of the EC2 instances.

A bucket policy that restricts access to the S3 bucket from a specific VPC endpoint or the EC2 instances' IP addresses ensures that only requests originating from those sources are allowed. This complements the IAM role's s3:GetObject permission by adding a network-level condition, preventing other AWS services or accounts from accessing the bucket even if they have valid IAM credentials. The condition key `aws:SourceVpce` or `aws:SourceIp` in the bucket policy enforces this restriction.

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 SSE-KMS encryption on the bucket.

    Why it's wrong here

    Server-Side Encryption with KMS (SSE-KMS) protects data at rest by encrypting objects before saving them to disk and decrypting them when downloaded. While crucial for data security, encryption is a data protection mechanism, not an access control mechanism. It does not restrict *who* or *what* can request access to the objects in the bucket, only that the requester must have permission to use the KMS key to decrypt the data *after* being granted access to the object itself. Therefore, it doesn't prevent unauthorized access attempts.

  • Enable S3 Block Public Access on the bucket.

    Why it's wrong here

    Enabling S3 Block Public Access (BPA) is a critical security control designed to prevent accidental or intentional public exposure of S3 buckets and objects. However, BPA primarily targets anonymous access and access from authenticated AWS users outside the account, or cross-account access not explicitly allowed by a bucket policy. It does not inherently restrict access from other AWS services or EC2 instances within the same AWS account, which might still be able to access the bucket if their IAM roles or policies permit it.

  • Add a bucket policy that allows access only from the VPC endpoint or specific IP addresses of the EC2 instances.

    Why this is correct

    A well-crafted S3 bucket policy can precisely define which principals, from which network locations, can perform specific actions on the bucket and its objects. By incorporating conditions that check for a VPC endpoint ID (using `aws:sourceVpce`) or specific source IP addresses (using `aws:SourceIp` for public IPs or `aws:VpcSourceIp` for private IPs within a VPC), access can be strictly limited to the intended EC2 instances or services operating within a controlled network environment. This granular control directly addresses the requirement to restrict access to authorized resources.

  • Move the sensitive data to a different S3 bucket and update the application.

    Why it's wrong here

    Moving sensitive data to a different S3 bucket, even if the application is updated to reflect the new location, does not inherently improve the security posture regarding access control. The new bucket would still require proper access policies to prevent unauthorized access. Without implementing specific restrictions on the new bucket, it would be just as vulnerable to unauthorized access as the original bucket, merely shifting the problem rather than solving the underlying access control challenge.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 24, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This DVA-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 DVA-C02 exam.