Challenge - 5 Problems
REST API Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate2:00remaining
REST API Endpoint Response Behavior
You have created a REST API in AWS API Gateway with a GET method integrated with a Lambda function. The Lambda function returns a JSON object with a statusCode and body. What will the API Gateway return to the client if the Lambda returns {"statusCode": 200, "body": "{\"message\": \"Hello\"}"}?
Attempts:
2 left
💡 Hint
Remember that API Gateway expects the Lambda to return a string in the body field, which is sent as-is to the client.
✗ Incorrect
API Gateway treats the 'body' field as a string and sends it as the HTTP response body. Since the body is a JSON string, the client receives it as a string containing escaped JSON, not as a parsed JSON object.
❓ Configuration
intermediate2:00remaining
Configuring CORS for REST API
You want to enable CORS on an AWS API Gateway REST API resource to allow requests from any origin. Which configuration will correctly enable CORS?
Attempts:
2 left
💡 Hint
CORS requires a preflight OPTIONS request that returns specific headers.
✗ Incorrect
To enable CORS, you must add an OPTIONS method that responds with the required CORS headers. This is often done with a MOCK integration returning Access-Control-Allow-Origin: '*'.
❓ Architecture
advanced2:00remaining
Designing a Secure REST API with AWS Services
You need to design a REST API that only allows authenticated users to access certain endpoints. Which AWS service combination provides the best security and scalability?
Attempts:
2 left
💡 Hint
Think about managed authentication services and token validation.
✗ Incorrect
Using API Gateway with a Lambda authorizer that validates JWT tokens from Amazon Cognito provides secure, scalable authentication for REST APIs.
✅ Best Practice
advanced2:00remaining
Optimizing REST API Performance in AWS
Which practice will most effectively reduce latency and improve performance for a global REST API deployed with AWS API Gateway and Lambda?
Attempts:
2 left
💡 Hint
Consider caching and geographic distribution to reduce latency.
✗ Incorrect
API Gateway caching reduces repeated backend calls, and deploying Lambda in multiple regions with latency-based routing ensures users connect to the nearest region, reducing latency.
❓ security
expert3:00remaining
Preventing Unauthorized Access in REST API
You have a REST API in API Gateway integrated with Lambda. You want to ensure that only requests with a valid API key and a specific custom header 'X-Client-Id' are allowed. Which configuration enforces this requirement most securely?
Attempts:
2 left
💡 Hint
Think about combining API Gateway features for authentication and custom header validation.
✗ Incorrect
API Gateway can require API keys natively, and Lambda authorizers can inspect headers like 'X-Client-Id' to allow or deny requests before invoking the backend.