Practice free →
HomeAWS Developer Associatecloudcomputingawsdevsecurity › Which IAM construct is best for granting a CodeB…

Which IAM construct is best for granting a CodeBuild project the right to read from one specific S3 bucket and write to one specific ECR repo?

AA scoped IAM role attached to the CodeBuild service role with a least-privilege inline policy
BGranting the CodeBuild service the `AdministratorAccess` managed policy
CSharing the AWS root account access key with CodeBuild
DDisabling IAM entirely for the build environment
Answer & Solution
Correct answer: A. A scoped IAM role attached to the CodeBuild service role with a least-privilege inline policy
Least privilege = a narrow role scoped to the exact bucket and repo. Admin access, root-credential sharing, or disabling IAM all violate the principle. CodeBuild assumes its service role at runtime.
Solve this in the app — AWS Developer Associate practice & 24k+ MCQs →
Related questions