Security

An SDK application on EC2 uses the default credential provider chain but authenticates as an old IAM user whose keys remain in environment variables. An attached instance profile has the required permissions; which change enables automatically refreshed role credentials without storing keys?

Show the answer

Correct answerA. Remove the environment keys and retain the default credential provider chain

AWhy this is right: Removing the overriding credentials lets the default chain obtain and refresh the instance profile's credentials.

BWhy not this: Copied temporary credentials expire; static environment values do not provide the provider's automatic refresh behavior.

CWhy not this: A service endpoint is a service URL, not a role selector or credential provider.

DWhy not this: A shared credentials file still stores user keys and can take precedence over instance profile credentials.

Environment credentials take precedence over EC2 instance profile credentials. Removing the old keys allows the default chain to obtain and refresh role credentials automatically; copying temporary credentials into environment variables does not provide automatic refresh.