ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 514 - CLF-C02 discussion

Report
Export

According to security best practices, how should an Amazon EC2 instance be given access to an Amazon S3 bucket?

A.
Hard code an IAM user's secret key and access key directly in the application, and upload the file.
Answers
A.
Hard code an IAM user's secret key and access key directly in the application, and upload the file.
B.
Store the IAM user's secret key and access key in a text file on the EC2 instance, read the keys, then upload the file.
Answers
B.
Store the IAM user's secret key and access key in a text file on the EC2 instance, read the keys, then upload the file.
C.
Have the EC2 instance assume a role to obtain the privileges to upload the file.
Answers
C.
Have the EC2 instance assume a role to obtain the privileges to upload the file.
D.
Modify the S3 bucket policy so that any service can upload to it at any time.
Answers
D.
Modify the S3 bucket policy so that any service can upload to it at any time.
Suggested answer: C

Explanation:

According to security best practices, the best way to give an Amazon EC2 instance access to an Amazon S3 bucket is to have the EC2 instance assume a role to obtain the privileges to upload the file. A role is an AWS Identity and Access Management (IAM) entity that defines a set of permissions for making AWS service requests. You can use roles to delegate access to users, applications, or services that don't normally have access to your AWS resources. For example, you can create a role that allows EC2 instances to access S3 buckets, and then attach the role to the EC2 instance. This way, the EC2 instance can assume the role and obtain temporary security credentials to access the S3 bucket. This method is more secure and scalable than storing or hardcoding IAM user credentials on the EC2 instance, as it avoids the risk of exposing or compromising the credentials. It also allows you to manage the permissions centrally and dynamically, and to audit the access using AWS CloudTrail.For more information on how to create and use roles for EC2 instances, see Using an IAM role to grant permissions to applications running on Amazon EC2 instances1

The other options are not recommended for security reasons. Hardcoding or storing IAM user credentials on the EC2 instance is a bad practice, as it exposes the credentials to potential attackers or unauthorized users who can access the instance or the application code. It also makes it difficult to rotate or revoke the credentials, and to track the usage of the credentials. Modifying the S3 bucket policy to allow any service to upload to it at any time is also a bad practice, as it opens the bucket to potential data breaches, data loss, or data corruption. It also violates the principle of least privilege, which states that you should grant only the minimum permissions necessary for a task.

asked 16/09/2024
Jacquezz Shorter
23 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first