exam questions

Exam AWS Certified Developer Associate All Questions

View all questions & answers for the AWS Certified Developer Associate exam

Exam AWS Certified Developer Associate topic 1 question 4 discussion

Exam question from Amazon's AWS Certified Developer Associate
Question #: 4
Topic #: 1
[All AWS Certified Developer Associate Questions]

A developer is testing an AWS Lambda function by using the AWS Serverless Application Model (AWS SAM) local CLI. The application that is implemented by the
Lambda function makes several AWS API calls by using the AWS software development kit (SDK). The developer wants to allow the function to make AWS API calls in a test AWS account from the developer's laptop.
What should the developer do to meet these requirements?

  • A. Edit the template.yml file. Add the AWS_ACCESS_KEY_ID property and the AWS_SECRET_ACCESS_KEY property in the Globals section.
  • B. Add a test profile by using the aws configure command with the --profile option. Run AWS SAM by using the sam local invoke command with the -profile option.
  • C. Edit the template.yml tile. For the AWS::Serverless::Function resource, set the role to an IAM role in the AWS account.
  • D. Run the function by using the sam local invoke command. Override the AWS_ACCESS_KEY_ID parameter and the AWS_SECRET_ACCESS_KEY parameter by specifying the --parameter-overrides option.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Spamuel
Highly Voted 2 years, 7 months ago
Selected Answer: B
Agree on B. You use the configure command. Alternatively, set up credentials in the credentials file. https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-set-up-credentials.html
upvoted 7 times
...
sumanshu
Most Recent 4 months, 1 week ago
Selected Answer: B
A) Eliminated: template.yml is meant to define AWS resources and configuration for the deployment, not for storing credentials. Hardcoding credentials in a file is a security risk and is against AWS best practices.
upvoted 1 times
sumanshu
4 months, 1 week ago
C) Eliminated: IAM role is only applied during execution in the AWS environment, not locally.
upvoted 1 times
sumanshu
4 months, 1 week ago
D) Eliminated: The --parameter-overrides option is for passing CloudFormation template parameters, not AWS credentials. https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-local-invoke.html
upvoted 1 times
sumanshu
4 months, 1 week ago
B) Correct --profile, This allows SAM to use the credentials from the specified profile, enabling the Lambda function to make AWS API calls in the test account. sam local invoke --profile test-profile
upvoted 1 times
...
...
...
...
Abdulla1007
1 year, 8 months ago
Selected Answer: D
I think it is D
upvoted 1 times
ja1092m
1 year, 7 months ago
Deez nuts
upvoted 2 times
...
...
ninomfr64
1 year, 8 months ago
Selected Answer: B
A) Global section is used for defining configurations shared across multiple resources https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-template-anatomy-globals.html C) To me, setting the profile for your function do not affect the credentials used from the sam cli D) the --parameter-override is used to overrides encoded as key-value pairs in the CloudFormation template https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-local-invoke.html B) looks a viable option https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/prerequisites.html#prerequisites-configure-credentials
upvoted 2 times
...
rcaliandro
1 year, 10 months ago
Rather than use the access keys and secret key (in env, in the cmd, or with aws configure) I would recomend to configure and use the profiles. (There will be a file in .aws folder called config) and it looks like: [profile test-profile] role_arn = arn:aws:iam::XXXXXXXXX:role/ec2AccessRole source_profile = default We can run the command by specifing the following parameter: "--profile test-profile" to have the rights associate with the ec2AccessRole
upvoted 3 times
...
Krt5894
2 years, 2 months ago
Selected Answer: B
It should be B
upvoted 2 times
...
Dirisme
2 years, 3 months ago
Its B saw it in another dump
upvoted 2 times
...
cwit63
2 years, 6 months ago
answer is B
upvoted 2 times
...
ramireze
2 years, 6 months ago
agree with B
upvoted 4 times
...
sidvic
2 years, 7 months ago
Selected Answer: B
For me is B "--profile TEXT The specific profile from your credential file that gets AWS credentials." https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-local-start-api.html
upvoted 4 times
...
JAMG54
2 years, 7 months ago
Maybe B
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago