During a credential review, a CloudOps engineer finds that an application on an EC2 instance reads an IAM user's access key ID and secret access key from a configuration file to call Amazon S3. The security team wants no long-term credentials on the instance and no change to how the AWS SDK is configured in the code. What should the engineer do?
Choose one.
Workloads on EC2 should get credentials from an IAM role delivered through an instance profile, not from long-term access keys stored on the instance.
An instance profile makes the role's temporary credentials available through the instance metadata service, and every AWS SDK's default credential provider chain finds them without code changes. Deleting the IAM user's keys removes the long-term secret entirely. Secrets Manager and KMS protect the keys but keep them long-term and need code changes; environment variables via user data keep long-term keys in a readable place.
- Identify the risk: long-term IAM user keys on the instance.
- Prefer temporary credentials from an IAM role for any AWS-hosted workload.
- For EC2, attach the role through an instance profile; the SDK finds it automatically.
- Remove the file and delete the user's access keys.
Exam tip: Workloads on EC2 use an instance profile role, never stored access keys.
IAM, AWS Organizations, and Compliance Tools for CloudOps (SOA-C03) — the lesson that teaches this.