Development with AWS Services

A long-running ECS task uses task-role credentials to assume a cross-account role, but its S3 client receives a fixed copy of the returned credentials and fails after they expire. The task must retain the cross-account identity without restarts or stored access keys; which change BEST meets these requirements?

Show the answer

Correct answerB. Use a refreshable assume-role provider backed by task-role credentials.

AWhy not this: A longer session delays expiration but does not refresh the client's fixed credentials.

BWhy this is right: The provider renews assumed-role sessions using automatically supplied task-role credentials.

CWhy not this: Changing environment variables does not update credentials explicitly supplied to an existing client.

DWhy not this: The default chain alone supplies the task-role identity, not the required cross-account assumed-role identity.

A refreshable assume-role provider obtains new cross-account credentials as needed, using the task role as its source. Using the default chain directly would select the task identity rather than perform the required role assumption.