exam questions

Exam AWS Certified Cloud Practitioner CLF-C02 All Questions

View all questions & answers for the AWS Certified Cloud Practitioner CLF-C02 exam

Exam AWS Certified Cloud Practitioner CLF-C02 topic 1 question 4 discussion

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.
  • 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.
  • D. Modify the S3 bucket policy so that any service can upload to it at any time.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
TheFivePips
Highly Voted 1 year, 10 months ago
Selected Answer: C
The recommended security best practice for giving an Amazon EC2 instance access to an Amazon S3 bucket is option C: Have the EC2 instance assume a role to obtain the privileges to upload the file. This involves using AWS Identity and Access Management (IAM) roles to grant temporary permissions to the EC2 instance, rather than hard-coding or storing access keys directly in the application or on the instance. This approach enhances security by minimizing the exposure of long-term credentials and following the principle of least privilege. The EC2 instance assumes a role with specific permissions to interact with the S3 bucket, and AWS automatically rotates temporary credentials for the instance. Options A and B involve storing IAM user's secret keys on the EC2 instance, which is not recommended due to security risks. Option D, modifying the S3 bucket policy to allow any service to upload to it at any time, is also not recommended as it may lead to security vulnerabilities and compromises the principle of least privilege.
upvoted 23 times
...
sarat5646
Most Recent 1 day, 8 hours ago
Selected Answer: C
The recommended security best practice for giving an Amazon EC2 instance access to an Amazon S3 bucket is option C: Have the EC2 instance assume a role to obtain the privileges to upload the file. This involves using AWS Identity and Access Management (IAM) roles to grant temporary permissions to the EC2 instance, rather than hard-coding or storing access keys directly in the application or on the instance.
upvoted 1 times
...
3veryday
1 month, 4 weeks ago
Selected Answer: C
Usually roles are given to EC2 instances. Anything else is a security threat
upvoted 1 times
...
Kostiantyn12
2 months, 3 weeks ago
Selected Answer: C
C. Have the EC2 instance assume a role to obtain the privileges to upload the file.
upvoted 1 times
...
1507a4f
3 months, 3 weeks ago
Selected Answer: C
✅ C. Have the EC2 instance assume a role to obtain the privileges to upload the file. Explanation: According to AWS security best practices, IAM roles should be used to grant temporary credentials to Amazon EC2 instances to securely access AWS resources such as S3 buckets. This avoids storing or hardcoding credentials, which is insecure. Why the other options are incorrect: A. Hard coding access keys: ❌ Not secure. Credentials could be exposed in source code repositories. B. Storing keys in a text file on EC2: ❌ Also insecure. If the instance is compromised, so are the credentials. D. Modifying bucket policy to allow any service: ❌ Overly permissive and a security risk. Violates least privilege principle. 🔐 IAM roles with instance profiles allow EC2 to securely access S3 with temporary, automatically rotated credentials.
upvoted 2 times
...
AyushPanwar
4 months, 3 weeks ago
Selected Answer: C
C is the recommended practice for an instance to use s3 service
upvoted 1 times
...
elijahmugariri
6 months, 1 week ago
Selected Answer: C
C is correct answer
upvoted 1 times
...
foxewa
6 months, 2 weeks ago
Selected Answer: C
• Assuming an IAM role is the recommended and secure method to grant temporary, limited access to AWS resources like S3 for EC2 instances. • When you attach an IAM role to an EC2 instance, AWS automatically provides temporary security credentials to the instance via the metadata service — eliminating the need to hard code or store keys.
upvoted 1 times
...
foxewa
6 months, 2 weeks ago
Selected Answer: C
• Assuming an IAM role is the recommended and secure method to grant temporary, limited access to AWS resources like S3 for EC2 instances. • When you attach an IAM role to an EC2 instance, AWS automatically provides temporary security credentials to the instance via the metadata service — eliminating the need to hard code or store keys.
upvoted 1 times
...
Roroyoshi
6 months, 3 weeks ago
Selected Answer: C
C is correct
upvoted 1 times
...
newbieaws9x
7 months, 1 week ago
Selected Answer: C
C is valid
upvoted 1 times
...
Roroyoshi
7 months, 1 week ago
Selected Answer: C
C is correct, always follow the least privilege principle
upvoted 1 times
...
klaus___1000
8 months, 1 week ago
Selected Answer: C
AWS Services always assumes roles to gain access to other aws services.
upvoted 1 times
...
Qurresh
9 months, 2 weeks ago
Selected Answer: C
c option is valid
upvoted 1 times
...
Collinsk
10 months ago
Selected Answer: C
Have the EC2 instance assume a role to obtain the privileges to upload the file
upvoted 1 times
...
Sir_Kay
10 months ago
Selected Answer: C
Best security practice as it provides temporary credentials with the necessary permissions without storing static keys.
upvoted 1 times
...
Frankdespi
10 months, 1 week ago
Selected Answer: C
C. Have the EC2 instance assume a role to obtain the privileges to upload the file.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...