0
0
AWScloud~20 mins

API keys and usage plans in AWS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
API Key Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
How does API Gateway enforce usage limits with usage plans?

API Gateway allows you to create usage plans to control how clients use your APIs. What happens when a client exceeds the quota or rate limits defined in a usage plan?

AAPI Gateway automatically increases the quota and rate limits to allow more requests.
BAPI Gateway blocks further requests from the client until the quota resets or the rate limit window passes.
CAPI Gateway queues the extra requests and processes them after the quota resets.
DAPI Gateway ignores the usage plan limits and allows all requests to pass.
Attempts:
2 left
💡 Hint

Think about how limits protect your API from overuse.

Configuration
intermediate
2:00remaining
Which AWS CLI command creates an API key linked to a usage plan?

You want to create an API key and associate it with an existing usage plan using AWS CLI. Which command correctly does this?

Aaws apigateway create-api-key --name MyKey --enabled --usage-plan-id xyz789
Baws apigateway create-api-key --name MyKey --enabled --stage-keys restApiId=abc123,stage=prod --usage-plan-id xyz789
Caws apigateway create-api-key --name MyKey --enabled && aws apigateway create-usage-plan-key --key-id <key-id> --usage-plan-id xyz789
Daws apigateway create-usage-plan-key --name MyKey --enabled --usage-plan-id xyz789
Attempts:
2 left
💡 Hint

Creating an API key and linking it to a usage plan are two separate steps.

Architecture
advanced
3:00remaining
Designing API key usage for multiple clients with different limits

You have an API used by two clients: Client A needs 1000 requests/day, Client B needs 5000 requests/day. How should you configure usage plans and API keys to enforce these limits?

ACreate one usage plan with a 5000 requests/day quota and assign both clients the same API key.
BCreate one usage plan with a 6000 requests/day quota and assign each client a unique API key.
CCreate two API keys with no usage plans; rely on client-side throttling.
DCreate two usage plans with different quotas (1000 and 5000 requests/day) and assign each client a unique API key linked to their respective usage plan.
Attempts:
2 left
💡 Hint

Think about how usage plans control limits per API key.

security
advanced
2:00remaining
What is a security risk of using API keys without usage plans?

If you deploy an API with API keys enabled but do not attach usage plans, what security risk arises?

AClients can use unlimited requests, potentially causing denial of service or unexpected costs.
BAPI keys become invalid immediately after creation.
CAPI Gateway automatically disables the API keys after 24 hours.
DClients cannot authenticate and will be blocked from accessing the API.
Attempts:
2 left
💡 Hint

Consider what usage plans control besides authentication.

Best Practice
expert
3:00remaining
How to rotate API keys securely without downtime?

You want to rotate API keys used by clients without causing service interruption. Which approach follows best practices?

ACreate a new API key, associate it with the usage plan, update clients to use the new key, then delete the old key after confirmation.
BUse the same API key indefinitely to avoid rotation complexity.
CUpdate the usage plan to disable API keys temporarily during rotation.
DDelete the old API key first, then create a new one and update clients immediately.
Attempts:
2 left
💡 Hint

Think about minimizing downtime and ensuring clients can switch keys smoothly.