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

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

A developer has created a web API that uses Amazon Elastic Container Service (Amazon ECS) and an Application Load Balancer (ALB). An Amazon CloudFront distribution uses the API as an origin for web clients. The application has received millions of requests with a JSON Web Token (JWT) that is not valid in the authorization header. The developer has scaled out the application to handle the unauthenticated requests.
What should the developer do to reduce the number of unauthenticated requests to the API?

  • A. Add a request routing rule to the ALB to return a 401 status code if the authorization header is missing.
  • B. Add a container to the ECS task definition to validate JWTs Set the new container as a dependency of the application container.
  • C. Create a CloudFront function for the distribution Use the crypto module in the function to validate the JWT.
  • D. Add a custom authorizer for AWS Lambda to the CloudFront distribution to validate the JWT.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

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
Danbraga
Highly Voted 2 years, 7 months ago
Selected Answer: C
C seems right to me https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/example-function-validate-token.html
upvoted 12 times
m4r0ck
2 years, 2 months ago
the function uses crypto module indeed, however D is the correct answer here as the custom authorizer would decide whether or not a particular call should be made to the API based on the validity of the token
upvoted 1 times
LittleSoap
2 years ago
AWS Lambda are not mentionned in the question so D is not correct
upvoted 1 times
...
...
...
sumanshu
Most Recent 3 months ago
Selected Answer: C
A) Eliminated - ALB does not have built-in support for JWT validation. It cannot determine if a JWT is valid or invalid, only whether the authorization header exists. B) Eliminated - This approach introduces unnecessary complexity and does not efficiently reduce unauthenticated requests. D) Eliminated - it is less efficient than CloudFront functions - due to increase cost
upvoted 1 times
...
pranay_2406
1 year, 11 months ago
Selected Answer: A
A. AWS CloudTrail AWS CloudTrail provides detailed logging and auditing capabilities for API actions across various AWS services, including AWS Lambda and Amazon S3. By enabling CloudTrail, the developer can capture the API calls made to create the S3 buckets and review the logs to identify any errors or issues in the Lambda function execution. With CloudTrail, the developer can track the API activity and see if the Lambda function is invoked properly when a new S3 bucket is created. It can help identify any errors, exceptions, or misconfigurations that may be causing the S3 Lifecycle policy not to be attached. By reviewing the CloudTrail logs, the developer can gain visibility into the sequence of API calls, parameters, and responses, allowing them to troubleshoot and resolve the issue with the Lambda function not attaching the S3 Lifecycle policy as expected.
upvoted 1 times
pranay_2406
1 year, 11 months ago
It's irrelevant to this question the answer is for next question
upvoted 1 times
...
...
Rpod
2 years ago
Selected Answer: D
D should be the answer . This is from ChatGpt :- Option C, creating a CloudFront function for the distribution to validate the JWT, is not recommended as the crypto module is not officially supported by AWS for use in CloudFront functions. Moreover, it can be complex to manage and maintain custom code in a CloudFront function.
upvoted 1 times
kagu
1 year, 10 months ago
>This is from ChatGpt... answer D will increase your AWS cost to high heavens, implementing D would in fact have no affect on the current problem. You want to reduce the number of calls to the api, using a probabilistic method to filter out some invalid JWTs is the correct way. Please think carefully before considering ChatGpt as your default answer.
upvoted 1 times
...
...
Syre
2 years ago
Selected Answer: D
I don’t think you guys are correct. The answer Should be D. A custom authorizer is an AWS Lambda function that verifies the token and returns an IAM policy that specifies the permissions for the requested resource. This will ensure that only authenticated requests are passed through to the API, reducing the number of unauthenticated requests.
upvoted 1 times
...
Krok
2 years ago
Selected Answer: C
C is correct.
upvoted 1 times
...
aws_leo
2 years, 4 months ago
Selected Answer: C
You can offload authorization by using CloudFront Function. Find full example code here: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/example-function-validate-token.html
upvoted 1 times
...
ACZ
2 years, 5 months ago
https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html The question states the JWT is sent as part of authorization header. In the solution C, it assumes that JWT will be sent as part of query string.
upvoted 2 times
ACZ
2 years, 5 months ago
The correct answer is D
upvoted 2 times
kaes
1 year, 7 months ago
That URL is for the ApiGateway and here we have only CloudFront, ALB and ECS! I wouldn't say that's the correct explanation
upvoted 1 times
...
...
...
princajen
2 years, 7 months ago
Selected Answer: C
I vote for C! The following example function validates a JSON web token (JWT) in the query string of a request. If the token is valid, the function returns the original, unmodified request to CloudFront. If the token is not valid, the function generates an error response. This function uses the crypto module. This function assumes that requests contain a JWT value in a query string parameter named jwt. Also, for this function to work, you must configure CloudFront to cache based on the jwt query string parameter. https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/example-function-validate-token.html
upvoted 4 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