44.2k views
2 votes
You have an application developed in .NET. This application works with the S3 buckets in a particular region. The application is hosted on an EC2 Instance. Which of the following should ideally be used to ensure that the EC2 Instance has the appropriate access to the S3 buckets?

A) AWS Users
B) AWS Groups
C) AWS IAM Roles
D) AWS IAM Policies

User Andreamazz
by
8.1k points

1 Answer

3 votes

Final answer:

The appropriate way to give an EC2 instance access to S3 buckets is to use C. AWS IAM Roles, which provide temporary, automatically rotated credentials and follow the principle of least privilege.

Step-by-step explanation:

To ensure that an EC2 instance has the appropriate access to S3 buckets, the ideal choice would be to use AWS IAM Roles. Unlike users or groups, IAM roles are designed to be assumed by AWS services. When you assign an IAM role to an EC2 instance, it allows the applications running on that instance to make API requests to other AWS services without the need to manage static AWS credentials. IAM roles provide temporary credentials that are automatically rotated, reducing the risk of compromised credentials. Additionally, using roles, you can follow the best practice of least privilege by granting only the permissions necessary to perform a given task.



While AWS IAM Policies are used to define permissions, they are attached to users, groups, or roles to specify what actions are allowed or denied. Therefore, the correct approach would be to create an IAM policy that defines the required permissions to access S3 and then attach this policy to an IAM role. Finally, you would attach the role to the EC2 instance.



It’s worth noting that IAM users are designed for individuals who need to interact with AWS services, whereas IAM groups are for managing a set of users.

User Jwinn
by
8.0k points