An organization wants to configure an application running on an Amazon EC2 instance to read files from an Amazon S3 bucket. The application must not store long-term AWS credentials on the instance. Which of the following solutions represents the AWS-recommended best practice to grant the necessary permissions?
- Create an IAM role with S3 read permissions and associate it with the EC2 instance using an instance profile.Cevap
- BCreate a dedicated IAM user, generate long-term access keys with S3 read permissions, and store them in the application's configuration file on the EC2 instance.
- CEnable programmatic access for the AWS account root user and configure the application to use the root access keys for administrative simplicity.
- DRely on the AWS shared responsibility model to automatically grant any EC2 instance within the VPC access to S3 buckets in the same region without manual configuration.
Cevap
Create an IAM role with S3 read permissions and associate it with the EC2 instance using an instance profile.
The correct option is to create an IAM role with S3 read permissions and associate it with the EC2 instance. This method uses temporary security credentials that are automatically distributed and rotated by AWS, fulfilling the security requirement of not storing long-term credentials on the instance.
Adım Adım Çözüm
Anahtar Kavram
AWS IAM Roles for EC2 Instances