A developer is troubleshooting a Node.js application running on a local development workstation. The application uses the AWS SDK for JavaScript v3 to write data to an Amazon DynamoDB table. The developer's local environment contains multiple AWS CLI profiles configured in ~/.aws/credentials.
The developer sets the environment variable AWS_PROFILE=dev-profile in the terminal and runs the application. However, the application fails to write to the development database and instead attempts to write to the production database, resulting in access denied errors. Further investigation reveals that the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are currently set in the active terminal session and correspond to production credentials.
Which two actions will resolve this issue by ensuring the application uses the dev-profile credentials? (Choose two.)
- Run the command to unset the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables in the active terminal session.Answer
- Modify the application code to initialize the DynamoDB client using the fromIni credential provider from the @aws-sdk/credential-providers package, explicitly specifying the dev-profile profile.Answer
- CHardcode the dev-profile access key and secret key directly into the credentials configuration property of the DynamoDB client constructor.
- DUpdate the trust policy of the production IAM user associated with the active terminal environment variables to permit cross-account delegation to the development IAM user.
- EStore the dev-profile credentials in AWS Systems Manager Parameter Store as secure strings and configure the SDK to read from it before environment variables.