A developer is troubleshooting a local Python application that uses the Boto3 SDK to retrieve configuration parameters from AWS Systems Manager Parameter Store. The developer previously configured the local machine using the AWS CLI and confirmed that the shared credentials file (~/.aws/credentials) contains valid credentials under the default profile. However, when executing the script in a terminal session, the application returns a signature mismatch error (SignatureDoesNotMatch).
Which of the following is the most likely cause of this error?
- AThe Boto3 SDK requires access keys to be explicitly passed as arguments in the client initialization constructor when running outside of EC2.
- BThe developer must use Secrets Manager instead of Parameter Store because local applications cannot authenticate to Parameter Store without using automatic credential rotation.
- The terminal session has invalid or expired credentials set in the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, which override the shared credentials file.Answer
- DThe local machine is missing an IAM trust policy that explicitly grants permission for the local operating system to assume the user's IAM role.
Answer
The terminal session contains active environment variables for AWS credentials that are invalid or expired, overriding the valid credentials configured in the shared credentials file.
The correct answer is correct because the AWS SDK default credential provider chain evaluates environment variables (such as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) before it checks the shared credentials file (~/.aws/credentials). If invalid or expired credentials are set in the terminal environment variables, the SDK will attempt to use them and fail, ignoring the valid credentials configured in the default profile of the shared credentials file.
Step-by-Step Solution
Key Concept
AWS SDK Default Credential Provider Chain Precedence