SAP-C01 Exam QuestionsBrowse all questions from this exam

SAP-C01 Exam - Question 19


The following policy can be attached to an IAM group. It lets an IAM user in that group access a "home directory" in AWS S3 that matches their user name using the console.

{

"Version": "2012-10-17",

"Statement": [

{

"Action": ["s3:*"],

"Effect": "Allow",

"Resource": ["arn:aws:s3:::bucket-name"],

"Condition":{"StringLike":{"s3:prefix":["home/${aws:username}/*"]}}

},

{

"Action":["s3:*"],

"Effect":"Allow",

"Resource": ["arn:aws:s3:::bucket-name/home/${aws:username}/*"]

}

]

}

Show Answer
Correct Answer: B

The given IAM policy allows users to perform S3 actions within their own 'home directory' but is missing permissions necessary for using the console effectively. Specifically, it lacks permissions for listing all buckets (ListAllMyBuckets) and obtaining bucket locations (GetBucketLocation). These actions are required for a user to navigate to their 'home directory' using the AWS S3 console. Without these permissions, users will receive access denied errors when attempting to use the console to access their specific directories.

Discussion

17 comments
Sign in to comment
Moon
Sep 21, 2021

Answer B: explanation: https://aws.amazon.com/blogs/security/writing-iam-policies-grant-access-to-user-specific-folders-in-an-amazon-s3-bucket/

sarah1
Oct 2, 2021

I thought this link was super helpful. Here's a quote: "The ListAllMyBuckets action grants David permission to list all the buckets in the AWS account, which is required for navigating to buckets in the Amazon S3 console (and as an aside, you currently can’t selectively filter out certain buckets, so users must have permission to list all buckets for console access). The console also does a GetBucketLocation call when users initially navigate to the Amazon S3 console, which is why David also requires permission for that action. Without these two actions, David will get an access denied error in the console."

FAB1975
Sep 17, 2022

Thank you Sarah. Really good and concise summary: Is missing: List on resource: all buckets GetBucketLocation on resource: all buckets

fw
Oct 7, 2021

The link indeed is very helpful. It shows how to configure policies so that user can use console to upload/download objects from S3 to his own directory. Basically two more blocks are needed (in addition to two blocks listed in this question): Block 1: Allow required Amazon S3 console permissions Block 2: Allow listing objects in root and home folders

nitinz
Oct 24, 2021

that ink is super helpful, many config are missing from it, hence B

cldy
Nov 1, 2021

"s:*" covers everything, so the correct answer is A TRUE.

tan9
Sep 27, 2021

User has no permission to list the ancestor directories, so that they won't be possible to navigate into their own home directory. And full working policy can be found at: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_examples_s3_home-directory-console.html

Musk
Sep 28, 2021

But if they type the right URL they get in. I don't see why it would not work. The question is not whether the user can navigate down to the right path. I think it's TRUE

amog
Sep 30, 2021

Answer is B "using the console.". They can use this policy to access home directory by URL, but not the console

awssp12345
Oct 11, 2021

Should s3:* cover all the s3 permissions including list?

fullaws
Oct 15, 2021

B is correct (s3:ListAllMyBuckets, s3:GetBucketLocation need to Resource *)

BillyC
Oct 7, 2021

Yes B is Correct!

noisonnoiton
Oct 15, 2021

go with B

01037
Nov 2, 2021

B. "Using the console" is the key. If only program access is needed, then it's enough.

Tamili
Sep 25, 2021

False because either one should be present. Both satisfy the requirement

Danao
Sep 26, 2021

Missing quite a few configs, like console access, root and home folder access, etc

srknbngl
Oct 16, 2021

Correct Answer: B

cldy
Oct 24, 2021

A. Shouldn't s:* cover all S3 actions?

shammous
Jan 6, 2024

The issue here is not with the action, but with which resource is applied. In our case, it's applied to the folder's content, not the folder itself.

tkanmani76
Dec 18, 2021

Answer A - In the same link being discussed here the last block is as below - which provides * for all S3 Actions and take to his home page. { "Sid": "AllowAllS3ActionsInUserFolder", "Action":["s3:*"], "Effect":"Allow", "Resource": ["arn:aws:s3:::my-company/home/${aws:username}/*"] }

RVivek
Dec 29, 2021

It still gives permission only to "my-company/home/${aws:username}/*" , Permission to list all buckets is necessary to navigate to this folder

tkanmani76
Jan 14, 2022

Agree, stand corrected - Option B

roka_uaOption: B
Apr 4, 2022

Vote B

sjpd10
Oct 27, 2022

The second action provides access to all S3 buckets unlike the first with a 'Condition'

SkyZeroZxOption: B
Jun 9, 2023

Answer B: explanation: https://aws.amazon.com/blogs/security/writing-iam-policies-grant-access-to-user-specific-folders-in-an-amazon-s3-bucket/

Narendragpt
Jul 16, 2024

A is True .