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 70 discussion

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

A developer is creating a serverless application that uses an AWS Lambda function The developer will use AWS CloudFormation to deploy the application The application will write logs to Amazon CloudWatch Logs. The developer has created a log group in a CloudFormation template for the application to use. The developer needs to modify the CloudFormation template to make the name of the log group available to the application at runtime.
Which solution will meet this requirement?

  • A. Use the AWS::Include transform in CloudFormation to provide the log group's name to the application.
  • B. Pass the log group's name to the application in the user data section of the CloudFormation template
  • C. Use the CloudFormation template's Mappings section to specify the log group's name for the application.
  • D. Pass the log group's Amazon Resource Name (ARN) as an environment variable to the Lambda function.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
Millerules
Highly Voted 2 years, 6 months ago
Selected Answer: C
I believe C is the right answer. The Developer needs to modify the CloudFormation template not the Lambda function. Therefore, Mappings can be used to make the log group name available to the application using Fn::FindInMap
upvoted 12 times
bearcandy
2 years, 3 months ago
It's D, the questions asks the Developer to make it available to the application (Lambda) at run time. Your answer still wouldn't make Lambda work. Also D is more effective and simpler and most cost-effective!!!
upvoted 5 times
captainpike
2 years, 1 month ago
the application and the lambda function are distincts.
upvoted 1 times
...
...
...
sidvic
Highly Voted 2 years, 7 months ago
Selected Answer: D
I think D
upvoted 6 times
Spamuel
2 years, 7 months ago
Agreed - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html
upvoted 6 times
captainpike
2 years, 1 month ago
This link does not help to answer the question at all.
upvoted 1 times
...
...
...
Sinthu_62024
Most Recent 3 months, 3 weeks ago
Selected Answer: D
Option D is correct - Passing the log group's ARN (or name) as an environment variable to the Lambda function ensures that the application can access it easily at runtime, making Option D the correct choice. Eliminating Option C because the Mappings section is used for static key-value pairs or configurations, not for dynamic resource names or ARNs.
upvoted 1 times
...
sumanshu
4 months, 1 week ago
Selected Answer: D
B) Eliminated - User data is used for EC2 instances, not for AWS Lambda.
upvoted 1 times
sumanshu
4 months, 1 week ago
C) Eliminated - The Mappings section in CloudFormation is used to define key-value mappings for static configuration, but it does not dynamically provide values to resources like Lambda functions at runtime
upvoted 1 times
sumanshu
4 months, 1 week ago
A) Eliminated - The AWS::Include transform is used to include external files in CloudFormation templates, not for passing values to a Lambda function at runtime.
upvoted 1 times
sumanshu
4 months, 1 week ago
D) Correct Resources: MyLogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: /aws/lambda/my-log-group MyLambdaFunction: Type: AWS::Lambda::Function Properties: Handler: index.handler Runtime: python3.9 Code: S3Bucket: my-bucket S3Key: my-code.zip Environment: Variables: LOG_GROUP_ARN: !GetAtt MyLogGroup.Arn
upvoted 1 times
...
...
...
...
cerulean
1 year, 2 months ago
Selected Answer: D
Option C (Use the CloudFormation template's Mappings section to specify the log group's name) is not suitable for dynamic runtime values like log group names. Mappings are typically used for static values like AMI IDs in different regions. herefore, T option D is the most appropriate solution for making the log group's name available to the application at runtime.
upvoted 1 times
...
Jonalb
1 year, 6 months ago
A solução que atenderá a esse requisito é D. Passe o nome de recurso da Amazon (ARN) do grupo de logs como uma variável de ambiente para a função Lambda. Ao fazer isso, o nome do grupo de logs estará disponível para o aplicativo em tempo de execução, e a função Lambda poderá acessar e escrever logs no grupo de logs especificado no Amazon CloudWatch Logs.
upvoted 1 times
...
sweetheatmn
1 year, 6 months ago
Selected Answer: D
I go with D FunctionName: MyLambdaFunction Code: S3Bucket: your-lambda-code-bucket S3Key: lambda-code.zip Runtime: nodejs14.x # Specify the desired runtime for your Lambda function Environment: Variables: LOG_GROUP_NAME: !Ref MyLogGroup
upvoted 1 times
...
Chinnu_37
1 year, 7 months ago
Selected Answer: D
The developer can pass the log group's Amazon Resource Name (ARN) as an environment variable to the Lambda function to meet this requirement. This is option D. By specifying the log group's ARN as an environment variable in the CloudFormation template, the developer can make the ARN available to the Lambda function at runtime. The function can then use the ARN to write logs to the specified log group in Amazon CloudWatch Logs. This approach allows the developer to easily specify the log group for the application and make its name available to the application at runtime without requiring changes to the function code. Options A, B, and C are not effective ways to make the name of the log group available to the application at runtime.
upvoted 1 times
...
Yasser001
1 year, 9 months ago
Selected Answer: D
D. Pass the log group's Amazon Resource Name (ARN) as an environment variable to the Lambda function. By passing the log group's ARN as an environment variable to the Lambda function, the application will have access to the log group's name at runtime. The ARN contains the necessary information to uniquely identify the log group and can be used by the application to interact with CloudWatch Logs.
upvoted 2 times
...
[Removed]
1 year, 9 months ago
Selected Answer: D
Pass the log group's Amazon Resource Name (ARN) as an environment variable to the Lambda function.
upvoted 1 times
...
YYM86
1 year, 10 months ago
Selected Answer: C
You don't know an ARN of a Clowdwatch log group as it is not created yet. So D is not correct. I believe it is C.
upvoted 1 times
...
MrTee
2 years ago
Selected Answer: D
The solution that will meet the requirement of making the name of the log group available to the application at runtime is D. Pass the log group’s Amazon Resource Name (ARN) as an environment variable to the Lambda function. This allows the Lambda function to access the log group’s ARN at runtime and use it to write logs to Amazon CloudWatch Logs.
upvoted 1 times
...
KDennisss
2 years ago
Selected Answer: D
The answer is D. When deploying an application using AWS CloudFormation and writing logs to Amazon CloudWatch Logs, a log group can be created. In this scenario, the developer needs to modify the CloudFormation template to enable the application to use the log group's name at runtime. To do this, the Amazon resource name (ARN) of the log group should be passed to the Lambda function as an environment variable. The Lambda function can then reference the environment variable when the log group's name is required. Therefore, D is the correct answer. A is used to include one AWS CloudFormation stack in another when using the AWS::Include transform, and is not relevant in this scenario. B is used to pass data to an EC2 instance when running a script using the user data section of a CloudFormation template, and is not relevant in this scenario. C is used to specify mapping data for each region in a CloudFormation template's mapping section, and is not relevant in this scenario.
upvoted 1 times
...
xifengying
2 years ago
Selected Answer: C
Should be C, Lambda environment variable should get called inside the code. Log group definition should be in the cfn level.
upvoted 2 times
...
appuNBablu
2 years, 2 months ago
D https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-environment.html
upvoted 2 times
...
Aiyappa
2 years, 6 months ago
Selected Answer: D
I vote D - https://stackoverflow.com/questions/65325865/aws-how-to-pass-arn-from-cloud-formation-template-to-aws-lambda-function
upvoted 4 times
...
Aiyappa
2 years, 6 months ago
I vote D - https://stackoverflow.com/questions/65325865/aws-how-to-pass-arn-from-cloud-formation-template-to-aws-lambda-function
upvoted 3 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