nerdexam
Amazon

DVA-C02 · Question #702

A developer has an application that pushes files from an on-premises local server to an Amazon S3 bucket. The application uses an AWS access key and a secret key that are stored on the server for auth

The correct answer is C. Remove the access key, the secret key, and the code that calls the STS AssumeRole operation.. When running on an EC2 instance with an attached IAM instance profile, the application should use the instance profile’s role credentials directly, eliminating the need for hardcoded access keys or explicit calls to assume roles. This is the most secure and best practice approach

Submitted by manish99· Mar 5, 2026Security

Question

A developer has an application that pushes files from an on-premises local server to an Amazon S3 bucket. The application uses an AWS access key and a secret key that are stored on the server for authentication. The application calls AWS STS to assume a role with access to perform the S3 PUT operation to upload the file. The developer is migrating the server to an Amazon EC2 instance. The EC2 instance is configured with an IAM instance profile in the same AWS account that owns the S3 bucket. What is the MOST secure solution for the developer to use to migrate the automation code?

Options

  • ARemove the code that calls the STS AssumeRole operation. Use the same access key and secret
  • BRemove the access key and the secret key. Use the STS AssumeRole operation to add
  • CRemove the access key, the secret key, and the code that calls the STS AssumeRole operation.
  • DRemove the access key, the secret key, and the code that calls the STS AssumeRole operation.

How the community answered

(19 responses)
  • A
    26% (5)
  • B
    5% (1)
  • C
    53% (10)
  • D
    16% (3)

Explanation

When running on an EC2 instance with an attached IAM instance profile, the application should use the instance profile’s role credentials directly, eliminating the need for hardcoded access keys or explicit calls to assume roles. This is the most secure and best practice approach.

Community Discussion

No community discussion yet for this question.

Full DVA-C02 Practice