exam questions

Exam ANS-C00 All Questions

View all questions & answers for the ANS-C00 exam

Exam ANS-C00 topic 1 question 46 discussion

Exam question from Amazon's ANS-C00
Question #: 46
Topic #: 1
[All ANS-C00 Questions]

You operate a production VPC with both a public and a private subnet. Your organization maintains a restricted Amazon S3 bucket to support this production workload. Only Amazon EC2 instances in the private subnet should access the bucket. You implement VPC endpoints (VPC-E) for Amazon S3 and remove the
NAT that previously provided a network path to Amazon S3. The default VPC-E policy is applied. Neither EC2 instances in the public or private subnets are able to access the S3 bucket.
What should you do to enable Amazon S3 access from EC2 instances in the private subnet?

  • A. Add the CIDR address range of the private subnet to the S3 bucket policy.
  • B. Add the VPC-E identifier to the S3 bucket policy.
  • C. Add the VPC identifier for the production VPC to the S3 bucket policy.
  • D. Add the VPC-E identifier for the production VPC to endpoint policy.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Windows98
Highly Voted 3 years, 8 months ago
I think B. There's an existing S3 policy and you need to add the VPC-E ID, not the VPC itself. You can't use private IPV4 in the buckets because they're not unique. https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints-s3.html
upvoted 18 times
...
route53
Highly Voted 3 years, 8 months ago
I think A is wrong because aws:sourceIp expects a public IP address. B is the correct answer since the traffic is routed via a vpc-e
upvoted 11 times
connorh
3 years, 8 months ago
"Condition": { "StringNotEquals": { "aws:sourceVpce": "vpce-1a2b3c4d" } } ... is valid
upvoted 7 times
...
...
PavanKushwah123
Most Recent 2 years, 5 months ago
Correct Answer B
upvoted 1 times
PavanKushwah123
2 years, 5 months ago
Correct Answer A
upvoted 1 times
...
...
soyyodario
3 years ago
Selected Answer: B
B https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
upvoted 1 times
...
ktulu2602
3 years, 3 months ago
Selected Answer: B
You cannot use an IAM policy or bucket policy to allow access from a VPC IPv4 CIDR range (the private IPv4 address range). VPC CIDR blocks can be overlapping or identical, which may lead to unexpected results. Therefore, you cannot use the aws:SourceIp condition in your IAM policies for requests to Amazon S3 through a VPC endpoint. This applies to IAM policies for users and roles, and any bucket policies. If a statement includes the aws:SourceIp condition, the value fails to match any provided IP address or range. Instead, you can do the following: Use your route tables to control which instances can access resources in Amazon S3 via the endpoint. For bucket policies, you can restrict access to a specific endpoint or to a specific VPC. For more information, see Amazon S3 bucket policies.
upvoted 2 times
...
LWang123
3 years, 4 months ago
I go with A The following example bucket policy blocks traffic to the bucket unless the request is from specified private IP addresses ( aws:VpcSourceIp): { "Id": "VpcSourceIp", "Version": "2012-10-17", "Statement": [ { "Sid": "VpcSourceIp", "Action": "s3:*", "Effect": "Deny", "Resource": [ "arn:aws:s3:::DOC-EXAMPLE-BUCKET", "arn:aws:s3:::DOC-EXAMPLE-BUCKET/*" ], "Condition": { "NotIpAddress": { "aws:VpcSourceIp": [ "10.1.1.1/32", "172.1.1.1/32" ] } }, "Principal": "*" } ] }
upvoted 1 times
...
AzureDP900
3 years, 4 months ago
B is right
upvoted 1 times
...
shammous
3 years, 5 months ago
Selected Answer: B
When creating a VPC endpoint (VPC-E), The target VPC and the private subnet are selected. Then, just allow traffic from that VPC-E in the S3 bucket policy.
upvoted 1 times
...
Emushu
3 years, 5 months ago
Selected Answer: A
I will go with 'A' because if you add the VPC-E to the S3 we are also adding the public range.
upvoted 2 times
...
Cyril_the_Squirl
3 years, 7 months ago
B is Correct. ---------------- Example: { "Version": "2012-10-17", "Id": "Policy1415115909152", "Statement": [ { "Sid": "Access-to-specific-VPCE-only", "Principal": "*", "Action": "s3:*", "Effect": "Deny", "Resource": ["arn:aws:s3:::example_bucket", "arn:aws:s3:::example_bucket/*"], "Condition": { "StringNotEquals": { "aws:sourceVpce": "vpce-1a2b3c4d" } } } ] } ------------------------ https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
upvoted 2 times
...
walkwolf3
3 years, 7 months ago
B A. aws:SourceIp in the S3 bucket policy could be public or private IPs, but AWS is not recommending this approach. You cannot use an IAM policy or bucket policy to allow access from a VPC IPv4 CIDR range (the private IPv4 address range). VPC CIDR blocks can be overlapping or identical, which may lead to unexpected results. C. This may allow EC2 instances in the public subnet to access S3, which doesn't meet requirment. D. The default VPC-E plicy is applied and allow everything, so this doesn't help https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html
upvoted 2 times
...
eeghai7thioyaiR4
3 years, 7 months ago
Ok, so after review, answer is B : Add the VPC-E identified to the S3 bucket policy. When you create a VPC endpoint, you need to specify the VPC as well as the subnet S3 policy can be used with VPC and VPC endpoint However, applying a policy based on the VPC would allow instances from the public subnet to reach the bucket, which should be forbidden As the VPC endpoint is mapped to a specific subnet, it can be mapped to the private subnet only
upvoted 3 times
...
jason2009
3 years, 7 months ago
This is just another example of very bad questions coming out of this exam. As matter of fact none of the options would satisfy the implied requirement of restricting access to the S3 bucket to private subnet only. I guess it's just there to confuse people. All choices are bad choices. In practice what I do is B. But B alone does not prevent public subnet from accessing S3 bucket through the endpoint because vpc-e as the name suggest is a VPC level construct. Because the default endpoint policy allows everything, the public subnet can simply add a route to the vpc-e and they will have access. You will need to modify either the security groups or the endpoint policies to restrict access. None of these are present in the questions or the answers. Fundamentally B and C are the same. Even if you choose C you can still block the access to the VPC-E in your ENI security group or only allow access from certain resources through the endpoint policy. Which you also have to do in B. They are the same folks.
upvoted 3 times
...
Pratap
3 years, 8 months ago
Add VPC-E identified to bucket policy
upvoted 2 times
...
andyo
3 years, 8 months ago
Answer is B - CORRECT - VPC-E ID will need to be added to policy D. is updating the endpoint policy. but the default for that has already been applied which allows full access C. If you attach VPC identifier both Private and Public will be allowed and the requirement only allows Private access A. No CIDR allowed for this. the S3 Bucket policy for Endpoints only allows VPC-E ID or the VPC.
upvoted 2 times
jason2009
3 years, 7 months ago
But in B you can still access the bucket in public subnet through VPC-E. Default endpoint policy does not disable such access.
upvoted 1 times
...
...
lunt
3 years, 8 months ago
Many comments when the solution is so text book. A. Nope. Cannot add CIDR range. C. Nope. D. Question states default VPCE policy applied. C. Yes. Default VPCE policy allows all access, bucket policy is then the next ACL to be evaluated. Answer is C. There is no other option that works within the questions requirements/statements.
upvoted 1 times
lunt
3 years, 8 months ago
Changing answer. Answer is B. A. Cannot add private CIDR to S3 bucket policy. C. Grants VPC permission overall. Too open. D. Endpoint = still needs to pass bucket policy. Default policy for EP permits all. B. Yes. S3 bucket updateded to allow VPCE.
upvoted 2 times
...
...
Ronanh
3 years, 8 months ago
You cannot use an IAM policy or bucket policy to allow access from a VPC IPv4 CIDR range (the private IPv4 address range). VPC CIDR blocks can be overlapping or identical, which may lead to unexpected results.For bucket policies, you can restrict access to a specific endpoint
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...