Bird
0
0

Which AWS CLI command correctly fetches free tier usage data for the previous calendar month?

easy📝 Syntax Q3 of 15
AWS - Account and Billing
Which AWS CLI command correctly fetches free tier usage data for the previous calendar month?
Aaws ce get-cost-and-usage --time-period Start=2024-03-01,End=2024-03-31 --metrics BlendedCost
Baws ce get-cost-and-usage --time-period Start=$(date -d 'last month' +%Y-%m-01),End=$(date -d 'last month' +%Y-%m-%d) --metrics UsageQuantity --filter '{"Dimensions":{"Key":"USAGE_TYPE","Values":["FreeTier"]}}'
Caws ce get-cost-and-usage --time-period Start=2024-04-01,End=2024-04-30 --metrics UsageQuantity --filter '{"Tags":{"Key":"FreeTier"}}'
Daws ce get-cost-and-usage --time-period Start=2024-04-01,End=2024-04-30 --metrics UsageQuantity
Step-by-Step Solution
Solution:
  1. Step 1: Define correct time period

    Use dynamic date commands to get last month's start and end dates.
  2. Step 2: Use correct filter key and value

    Filter by "USAGE_TYPE" with value "FreeTier" to get free tier usage.
  3. Step 3: Use correct metric

    "UsageQuantity" metric shows usage amount.
  4. Final Answer:

    aws ce get-cost-and-usage --time-period Start=$(date -d 'last month' +%Y-%m-01),End=$(date -d 'last month' +%Y-%m-%d) --metrics UsageQuantity --filter '{"Dimensions":{"Key":"USAGE_TYPE","Values":["FreeTier"]}}' uses dynamic dates, correct filter, and metric.
  5. Quick Check:

    Dynamic dates + correct filter = accurate free tier data [OK]
Quick Trick: Use USAGE_TYPE=FreeTier filter with UsageQuantity metric [OK]
Common Mistakes:
MISTAKES
  • Using static dates without adjusting for last month
  • Filtering by incorrect dimension keys
  • Omitting the filter for free tier usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes