A developer is running a local Node.js application that uses the AWS SDK for JavaScript (v3) to read data from an Amazon DynamoDB table. The local machine has multiple AWS profiles defined in the `~/.aws/credentials` file. When executing the application, it fails with an `AccessDeniedException` because it attempts to use the default profile instead of a specific profile named `development-admin`. Which of the following actions can the developer take to resolve this issue? (Select TWO.)
- Set the `AWS_PROFILE` environment variable to `development-admin` in the local terminal before executing the application.Answer
- Import the `fromIni` credential provider from the SDK and use it to explicitly instantiate the DynamoDB client with the `development-admin` profile.Answer
- CHardcode the AWS Access Key ID and Secret Access Key from the `development-admin` profile directly into the application code during client initialization.
- DStore the access keys in AWS Systems Manager Parameter Store and retrieve them dynamically without configuring any local credentials.
- EUpdate the IAM trust policy of the DynamoDB service role to allow access from local development IP addresses without credentials.
Answer
Configure the local application to use the correct profile by setting the AWS_PROFILE environment variable or by explicitly loading the profile using the fromIni credential provider in the application code.
Setting the AWS_PROFILE environment variable forces the AWS SDK to look for the specified profile inside the shared credentials file. Alternatively, programmatically loading the profile via the fromIni credential provider configures the client to explicitly request credentials matching the development-admin profile.
Step-by-Step Solution
Key Concept
AWS SDK Credential Provider Chain and Named Profiles
Estimated Time:1m 0s