An application hosted on an Amazon EC2 instance needs to securely retrieve configuration settings from an Amazon S3 bucket. A developer is tasked with setting up the necessary IAM permissions using security best practices. Which configuration steps should the developer perform to grant the application access to the S3 bucket? (Select TWO.)
- Create an IAM role with a trust policy that permits the ec2.amazonaws.com service principal to assume the role.Answer
- Associate the IAM role with the EC2 instance by attaching an EC2 instance profile containing the role to the instance.Answer
- CHardcode the Access Key ID and Secret Access Key of an IAM user with S3 permissions inside the application's source code.
- DAttach a permissions policy to the IAM role that lists ec2.amazonaws.com as the Principal in the policy statement.
- EConfigure an Amazon ECS Task Execution Role with S3 access permissions and assign it to the EC2 instance.
Answer
To allow the application on the EC2 instance to access the S3 bucket, the developer must create an IAM role with a trust policy that allows the EC2 service to assume the role, and then associate the IAM role with the EC2 instance using an EC2 instance profile.
Securing access to AWS services from an Amazon EC2 instance requires creating an IAM role with a trust policy that allows the EC2 service principal to assume the role. The role must then be attached to the EC2 instance via an EC2 instance profile, enabling the application to automatically assume the role and access S3 using temporary credentials.
Step-by-Step Solution
Key Concept
Securing Amazon EC2 applications using IAM roles and instance profiles.
Estimated Time:1m 0s