A developer is troubleshooting a local C# application that uses the AWS SDK for .NET to publish messages to an Amazon SNS topic. During local testing, the application publishes messages to the production AWS account instead of the development AWS account.
The developer has set the AWS_PROFILE environment variable to development-profile in the active terminal session. The local ~/.aws/credentials file is configured as follows:
ini
[default]
aws_access_key_id = AKIA_PROD_KEY
aws_secret_access_key = PROD_SECRET
[development-profile]
aws_access_key_id = AKIA_DEV_KEY
aws_secret_access_key = DEV_SECRET
Upon investigation, the developer discovers that the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are also set to the production keys within the same terminal session.
Why is the application using the production credentials, and how should the developer resolve this issue?
- AThe AWS SDK loads credentials from the global configuration file before evaluating environment variables. To resolve this, the developer must modify the ~/.aws/config file to set profile_precedence = development-profile.
- The AWS SDK default credential provider chain evaluates environment variables before looking up profiles in the shared credentials file. To resolve this, the developer must unset the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables in the terminal session.Cevap
- CThe AWS SDK cannot parse the credentials file because the local developer's IAM user lacks a trust policy mapping. To resolve this, the developer must update the development IAM trust policy to allow the local machine to assume the role.
- DThe AWS SDK retrieves the production credentials from AWS Systems Manager Parameter Store, which overrides local configuration settings. To resolve this, the developer must delete the production credentials parameters from the Parameter Store.