You want an EC2 instance to access S3 buckets securely without embedding credentials. Which IAM role setup is best?
hard📝 Application Q8 of 15
AWS - Identity and Access Management
You want an EC2 instance to access S3 buckets securely without embedding credentials. Which IAM role setup is best?
ACreate an IAM role with S3 access policy and attach it to the EC2 instance
BCreate an IAM user with S3 access and store its keys on the EC2 instance
CUse the root account credentials on the EC2 instance
DCreate an IAM group with S3 access and add the EC2 instance to it
Step-by-Step Solution
Solution:
Step 1: Identify secure credential method for EC2
IAM roles attached to EC2 provide temporary credentials automatically without storing keys.
Step 2: Evaluate options
Create an IAM role with S3 access policy and attach it to the EC2 instance uses roles correctly. Create an IAM user with S3 access and store its keys on the EC2 instance stores keys insecurely. Use the root account credentials on the EC2 instance uses root credentials (bad practice). Create an IAM group with S3 access and add the EC2 instance to it is invalid because EC2 instances cannot be added to IAM groups.
Final Answer:
Create an IAM role with S3 access policy and attach it to the EC2 instance -> Option A
Quick Check:
Use IAM roles for EC2 to access AWS securely [OK]
Quick Trick:Attach roles to EC2 for secure, temporary AWS access [OK]
Common Mistakes:
MISTAKES
Storing user keys on EC2
Using root credentials
Trying to add EC2 to IAM groups
Master "Identity and Access Management" in AWS
9 interactive learning modes - each teaches the same concept differently