Read your budget, your bill and your costs, then estimate before you build

short · 30 min · Task statement 4.2

Task

Use each of this lesson's billing tools for the job it is built for, in your own account and without making anything. By the end you will have read back the budget that watches your account, found out whether your account belongs to an organisation and who pays its bill, analysed past spending in Cost Explorer, seen where cost allocation tags are activated, and produced a Pricing Calculator estimate for something that does not exist yet. You will also be able to say, for any billing question, which of these tools answers it, which is exactly what the exam asks.

Steps

  1. Open AWS CloudShell from the console toolbar. Confirm who you are, then list the budgets in the account:
aws sts get-caller-identity --query Arn --output text
aws budgets describe-budgets --account-id 111122223333 --query 'Budgets[].[BudgetName,BudgetType,TimeUnit]' --output table

The ARN should contain assumed-role/AWSReservedSSO_ (an IAM Identity Center user) or :user/ (an IAM user). If it ends in :root, sign out now: this lab must not run as the root user. In the table, find the budget you made in lesson 1's lab. Write down its exact name and how many budgets the table lists in total; you need both later. 2. Read the alert attached to that budget, clf-zero-spend-budget. If you named yours differently, put your name in its place, keeping the double quotes:

aws budgets describe-notifications-for-budget --account-id 111122223333 --budget-name "clf-zero-spend-budget"

Note the NotificationType (ACTUAL or FORECASTED), the ComparisonOperator and the Threshold. Then open Billing and Cost Management, then Budgets, and open the same budget. Compare its current spend with the amount budgeted. This is what AWS Budgets is for: it watches and warns. Leave the budget exactly as it is. 3. Find out whether your account belongs to an organisation, and which account pays:

aws organizations describe-organization --query 'Organization.[MasterAccountId,FeatureSet]' --output text

If the command fails with AWSOrganizationsNotInUseException, your account is standalone and pays its own bill. If it prints an account ID equal to your own, your account is the management account and pays the consolidated bill for every member account. If it prints a different ID, your account is a member account and that other account pays for it. Write down which case is yours. 4. In Billing and Cost Management, open Bills. Read this month's charges by service, and, if your account is a management account, find where the page lists charges per account. Then open AWS Support Center from the console's help menu and find where an account and billing case is opened. Every plan, including Basic Support, can open one. Read the page only; there is no question to send. 5. Open Cost Explorer from Billing and Cost Management. If it has never been opened in this account, opening it turns it on at no charge, and AWS says data can take up to 24 hours to appear; come back to this step tomorrow if the chart is empty. Set the date range to the last 6 months, the granularity to Monthly, and Group by to Service. Read which service cost the most. Then switch Group by to Linked account if your account is a management account, and find the forecast for this month. This is what Cost Explorer is for: it looks back and analyses, and forecasts from that past. 6. Still in Billing and Cost Management, open Cost allocation tags. Read both tabs, User-defined cost allocation tags and AWS-generated cost allocation tags, and find aws:createdBy and its status. Change nothing. A tag that is not active does not appear in Cost Explorer or the Cost and Usage Report, however many resources carry it. A member account may find the page unavailable: in an organisation, the management account activates tags. 7. Now estimate something that does not exist. Open the Amazon S3 pricing page and list the dimensions S3 charges for. Then open the AWS Pricing Calculator at calculator.aws and start a new estimate. Add Amazon S3, pick a Region near you, and enter 50 GB of S3 Standard storage. Add a second S3 entry with the same storage in a different Region. Compare the two monthly figures, and leave the estimate unsaved and unshared. 8. Write one line for each question below, naming the tool that answers it: how much will a new project cost before anything is built; which service cost the most last quarter; tell me when this month's spend passes a limit; show test and production costs separately; who pays when ten accounts share one bill; and where do I ask about a charge I do not recognise. Check your answers against the lesson's closing list.

Verify

Lesson 1's budget is still there and unchanged in type. It is called clf-zero-spend-budget:

aws budgets describe-budgets --account-id 111122223333 --query "Budgets[?BudgetName=='clf-zero-spend-budget'].BudgetType" --output text

Expected output: COST.

aws budgets describe-budgets --account-id 111122223333 --query 'length(Budgets)'

Expected output: the same number of budgets you wrote down in step 1, and never less than 1.

Cost and clean-up

The tools this lab opens, Budgets, Bills, Cost Explorer in the console, cost allocation tags and the Pricing Calculator, carry no charge to view, and the lab makes nothing in your account. It never calls the Cost Explorer API, which is charged per request. Check the AWS Budgets and AWS Cost Explorer pricing pages if you want the current terms.

Created by this lab: an unsaved estimate in the public AWS Pricing Calculator, which lives only in your browser tab and nowhere in your account.

  1. Close the Pricing Calculator tab. The estimate was never saved or shared, so it is gone with the tab. If you exported it, delete the downloaded file.
  2. Leave the Cost allocation tags page, Cost Explorer and Budgets as you found them. Keep lesson 1's budget: every later lab relies on it, and this lab never changed it.

Check it is gone

aws budgets describe-budgets --account-id 111122223333 --query 'length(Budgets)'

Expected output: the same number you wrote down in step 1. A higher number means a budget was saved by accident; a lower one means lesson 1's budget needs setting up again from lesson 1's lab.

Notes

This lab does not make a budget, even though AWS Budgets is this lesson's main tool. Your account already has the one budget it needs, from lesson 1's lab, and a near-identical second budget is how people end up removing the wrong one. Reading a budget back teaches the same thing. Cost Explorer's console and the Cost Explorer API return the same data, but only the API is charged per request, so every lab in this course uses the console.

This is an independent study companion for the AWS Certified Cloud Practitioner (CLF-C02) exam and is not produced by or endorsed by Amazon Web Services. AWS, Amazon Web Services and AWS Certified Cloud Practitioner are trademarks of Amazon.com, Inc. or its affiliates.

This is an independent study companion for AWS Certified Cloud Practitioner CLF-C02 and is not produced by or endorsed by CompTIA.