Practice free →
HomeAWS Solutions Architect Associatecloudcomputingsecurearchitectures › What is the BEST practice for granting an EC2 in…

What is the BEST practice for granting an EC2 instance access to an S3 bucket?

AMake the bucket publicly readable and writable to the internet
BAttach an IAM role to the EC2 instance with a policy granting the needed S3 permissions
CHard-code an IAM user's access key into the application code on the instance
DEmail the AWS root credentials to the instance owner
Answer & Solution
Correct answer: B. Attach an IAM role to the EC2 instance with a policy granting the needed S3 permissions
Instance roles deliver short-lived credentials via the metadata service — no keys to leak. Hard-coded keys, public buckets, and root creds are the classic anti-patterns.
Solve this in the app — AWS Solutions Architect Associate practice & 24k+ MCQs →
Related questions