A developer is using the AWS Serverless Application Model (AWS SAM) CLI to test an AWS Lambda function locally by running the `sam local invoke` command. The Lambda function, written in Node.js, uses the AWS SDK for JavaScript (v3) to read from an Amazon DynamoDB table in the cloud.
When the developer runs the function locally, the SDK operations fail with an `AccessDeniedException`. The developer has already configured a local AWS CLI profile named `developer-local` in the `~/.aws/credentials` file on the host machine. This profile possesses all necessary permissions to access the DynamoDB table. The developer has also set the environment variable `AWS_PROFILE=developer-local` on the host command line.
Which actions should the developer take to ensure the locally running function has access to the credentials? (Select TWO.)
- Invoke the Lambda function locally by passing the profile name using the `--profile developer-local` parameter with the `sam local invoke` command.Cevap
- Create a JSON file containing the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` from the profile, and pass this file to the command using the `--env-vars` parameter.Cevap
- CModify the Node.js application code to hardcode the `accessKeyId` and `secretAccessKey` properties in the DynamoDB client configuration using the credentials retrieved from the local profile.
- DUpdate the trust relationship policy of the Lambda function's IAM execution role to allow access from the public IP address of the local development environment.
- EStore the credentials in AWS Systems Manager Parameter Store and update the application code to retrieve them using the AWS Secrets Manager API.