Data Operations and Support

A Python application on Amazon EC2 uses Boto3 to read Amazon S3 objects. An instance profile grants the required permissions; how should the application obtain credentials without storing access keys?

Show the answer

Correct answerC. Use the default credential chain to obtain role credentials.

AWhy not this: An instance profile ARN identifies a resource; it is not a credential that can sign API requests.

BWhy not this: Copied temporary credentials expire and do not provide the automatic refresh available through the instance role provider.

CWhy this is right: The default chain obtains temporary instance role credentials and refreshes them as needed.

DWhy not this: IAM user access keys require storage and management rather than using the role already assigned to the instance.

Boto3's default credential provider chain can obtain and refresh temporary credentials for the EC2 instance role. Copying temporary credentials into a configuration file requires managing their expiration instead of using automatic refresh.