Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is a bucket policy in AWS S3?
A bucket policy is a set of rules in JSON format that defines who can access an S3 bucket and what actions they can perform on it.
Click to reveal answer
intermediate
How does a bucket policy differ from IAM policies?
Bucket policies are attached directly to an S3 bucket to control access to that bucket, while IAM policies are attached to users, groups, or roles to control their permissions across AWS services.
Click to reveal answer
beginner
What is the effect of the "Effect": "Deny" statement in a bucket policy?
It explicitly blocks the specified actions for the defined users or conditions, overriding any allow permissions.
Click to reveal answer
intermediate
Can bucket policies restrict access based on IP address?
Yes, bucket policies can include conditions to allow or deny access based on the requester's IP address or IP range.
Click to reveal answer
beginner
What happens if no bucket policy is attached to an S3 bucket?
By default, the bucket is private, and only the bucket owner has access unless permissions are granted through other means like IAM policies or ACLs.
Click to reveal answer
What does a bucket policy primarily control?
AWho can access the bucket and what actions they can perform
BThe physical location of the bucket
CThe cost of storing data in the bucket
DThe encryption method used for objects
✗ Incorrect
Bucket policies define access permissions for users and actions on the bucket.
Which JSON element in a bucket policy specifies whether access is allowed or denied?
AAction
BResource
CEffect
DPrincipal
✗ Incorrect
The "Effect" element specifies "Allow" or "Deny" for the policy statement.
Can a bucket policy grant access to all users on the internet?
ANo, bucket policies cannot grant public access
BOnly if the user has an AWS account
COnly if the bucket is encrypted
DYes, by setting Principal to "*"
✗ Incorrect
Setting Principal to "*" allows access to everyone, making the bucket public.
Which condition can be used in a bucket policy to restrict access by IP address?
A"IpAddress"
B"StringEquals"
C"Bool"
D"NumericLessThan"
✗ Incorrect
The "IpAddress" condition restricts access based on IP addresses.
If a bucket policy denies access to a user, what happens if an IAM policy allows it?
AAccess is allowed because IAM policies have priority
BAccess is denied because deny overrides allow
CAccess is allowed only during business hours
DAccess is denied only if MFA is not used
✗ Incorrect
Explicit deny in bucket policies overrides any allow permissions.
Explain how bucket policies control access to an S3 bucket.
Think about rules that say who can do what with the bucket.
You got /4 concepts.
Describe the difference between a bucket policy and an IAM policy.
Consider where each policy is applied and what it controls.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of a bucket policy in AWS S3?
easy
A. To monitor the bucket usage statistics
B. To store files inside the bucket
C. To control who can access and perform actions on the bucket
D. To backup the bucket data automatically
Solution
Step 1: Understand bucket policy role
A bucket policy defines permissions for users or services to access the bucket.
Step 2: Differentiate from other functions
Storing files, monitoring, and backup are separate features, not controlled by bucket policies.
Final Answer:
To control who can access and perform actions on the bucket -> Option C
Quick Check:
Bucket policy = Access control [OK]
Hint: Bucket policies manage access permissions only [OK]
Common Mistakes:
Confusing bucket policy with storage function
Thinking bucket policy handles backups
Assuming bucket policy monitors usage
2. Which of the following is the correct JSON key to specify who is allowed or denied access in a bucket policy?
easy
A. "Action"
B. "Principal"
C. "Resource"
D. "Effect"
Solution
Step 1: Identify the key for user or service
The "Principal" key specifies the user, account, service, or entity the policy applies to.
Step 2: Differentiate from other keys
"Action" defines allowed actions, "Resource" defines the bucket or objects, "Effect" states Allow or Deny.
Final Answer:
"Principal" -> Option B
Quick Check:
Who = Principal [OK]
Hint: Principal means who gets access [OK]
Common Mistakes:
Confusing "Action" with "Principal"
Using "Effect" to specify user
Mixing up "Resource" with user identity
3. Given this bucket policy snippet, what does it allow?
A. The Resource ARN is missing the /* to specify objects
B. The Action s3:PutObject is invalid
C. The Principal cannot be * for uploads
D. Effect should be Deny to allow uploads
Solution
Step 1: Check the Resource ARN format
To allow object uploads, Resource must include "/*" to specify objects inside the bucket.
Step 2: Validate Action and Principal
s3:PutObject is valid, Principal "*" is allowed, and Effect "Allow" is correct.
Final Answer:
The Resource ARN is missing the /* to specify objects -> Option A
Quick Check:
PutObject needs resource with /* [OK]
Hint: Resource must end with /* for object actions [OK]
Common Mistakes:
Using bucket ARN without /* for object actions
Thinking Principal * is disallowed
Confusing Allow and Deny effects
5. You want to create a bucket policy that denies all users except a specific AWS account (ID: 123456789012) from deleting objects in your bucket named "secure-bucket". Which policy snippet correctly enforces this?