AWS - S3 FundamentalsYou 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?A{ "Effect": "Deny", "Principal": "*", "Action": "s3:DeleteObject", "Resource": "arn:aws:s3:::secure-bucket/*", "Condition": { "StringNotEquals": { "aws:PrincipalAccount": "123456789012" } } }B{ "Effect": "Allow", "Principal": {"AWS": "arn:aws:iam::123456789012:root"}, "Action": "s3:DeleteObject", "Resource": "arn:aws:s3:::secure-bucket/*" }C{ "Effect": "Deny", "Principal": {"AWS": "arn:aws:iam::123456789012:root"}, "Action": "s3:DeleteObject", "Resource": "arn:aws:s3:::secure-bucket/*" }D{ "Effect": "Allow", "Principal": "*", "Action": "s3:DeleteObject", "Resource": "arn:aws:s3:::secure-bucket/*" }Check Answer
Step-by-Step SolutionSolution:Step 1: Understand the requirementWe want to deny delete actions to everyone except the specified account.Step 2: Analyze each option{ "Effect": "Deny", "Principal": "*", "Action": "s3:DeleteObject", "Resource": "arn:aws:s3:::secure-bucket/*", "Condition": { "StringNotEquals": { "aws:PrincipalAccount": "123456789012" } } } denies delete to all principals except where the principal account equals 123456789012 using Condition StringNotEquals. This matches the requirement.{ "Effect": "Allow", "Principal": {"AWS": "arn:aws:iam::123456789012:root"}, "Action": "s3:DeleteObject", "Resource": "arn:aws:s3:::secure-bucket/*" } allows only the specified account but does not deny others explicitly.{ "Effect": "Deny", "Principal": {"AWS": "arn:aws:iam::123456789012:root"}, "Action": "s3:DeleteObject", "Resource": "arn:aws:s3:::secure-bucket/*" } denies only the specified account, opposite of requirement.{ "Effect": "Allow", "Principal": "*", "Action": "s3:DeleteObject", "Resource": "arn:aws:s3:::secure-bucket/*" } allows everyone, which is incorrect.Final Answer:Option A correctly denies delete to all except the specified account -> Option AQuick Check:Deny with Condition StringNotEquals excludes one account [OK]Quick Trick: Use Deny with Condition StringNotEquals for exceptions [OK]Common Mistakes:Using Allow without Deny for blocking othersDenying the allowed account by mistakeNot specifying Condition for exceptions
Master "S3 Fundamentals" in AWS9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More AWS Quizzes AWS CLI - Basic CLI commands (s3, ec2) - Quiz 11easy AWS CLI - Why CLI matters for automation - Quiz 4medium Cloud Computing Fundamentals - Why cloud over on-premises - Quiz 7medium Cloud Computing Fundamentals - AWS Management Console walkthrough - Quiz 1easy Identity and Access Management - IAM roles concept - Quiz 13medium Security Groups and Network ACLs - Security group as virtual firewall - Quiz 8hard Security Groups and Network ACLs - Inbound and outbound rules - Quiz 10hard VPC Fundamentals - NAT Gateway for private subnet internet - Quiz 6medium VPC Fundamentals - VPC peering concept - Quiz 11easy VPC Fundamentals - Creating a custom VPC - Quiz 2easy