Sub topic 11
Getting Access to Billing and Cost Data
This chapter assumes you have already signed up, secured the root user with MFA, and created an administrative IAM identity for daily work. It also assumes you can run AWS CLI commands as that identity. Here you will make cost data visible to that identity, so you do not have to sign in as root to check your spending.
Why billing is hidden by default
A new AWS account has one surprising behavior. An IAM user or role with AdministratorAccess still cannot open the Billing and Cost Management console pages for the account. The root user can see them, and nobody else can until the root user opts in.
AWS made this choice because billing pages expose payment methods, invoices, tax details, and account-wide spending. Administrator rights over services like EC2 do not imply a need to see those things.
Two separate layers control access:
- The account-level switch. The root user turns on "IAM user and role access to Billing information". Without it, IAM policies are ignored for the billing pages.
- IAM permissions. After the switch is on, the identity still needs policies that allow the billing and cost actions.
Both layers must allow the request.
Step 1: Activate IAM access to billing (root only)
This is one of the few tasks that requires root, as covered in the earlier chapter on root-only tasks. Do it once.
- Sign in to the console as the root user, with MFA.
- Choose your account name in the top-right corner, then Account.
- Find the section IAM user and role access to Billing information and choose Edit.
- Select Activate IAM Access and save.
- Sign out of root.
This setting does not give anyone billing access by itself. It only stops blocking IAM policies from granting it.
Accounts that belong to an AWS Organization behave differently. Billing for member accounts is consolidated in the management account. Member accounts can still see their own usage, but many billing pages exist only in the management account.
Step 2: Grant billing permissions to your admin identity
Give billing permissions through a group or role instead of attaching them one user at a time. AWS provides managed policies for the common cases:
| Managed policy | What it allows | Typical use |
|---|---|---|
| `AWSBillingReadOnlyAccess` | View billing, cost, and usage data | People who only need to look at spending |
| `job-function/Billing` | View and manage billing, including budgets and payment settings | The person who administers billing |
Start with the read-only policy. Attach it to the group that holds your administrators, and replace the group name with your own:
aws iam attach-group-policy \
--group-name Administrators \
--policy-arn arn:aws:iam::aws:policy/AWSBillingReadOnlyAccessIf you created the budget in the later chapter through the console, you need budget management rights as well. The job-function/Billing policy covers that. Alternatively, write a small custom policy that allows only the budgets actions you need.
Fine-grained billing actions
Older documentation refers to IAM actions with the aws-portal: prefix, such as aws-portal:ViewBilling. AWS has been replacing these with fine-grained actions in the billing:, account:, ce:, budgets:, cur:, and payments: namespaces. The older actions are deprecated, so check the current IAM documentation before writing custom policies. If you maintain an existing policy that uses aws-portal:, it may need migrating. Prefer the AWS managed policies where possible, since AWS keeps them updated as the action names change.
Step 3: Turn on Cost Explorer
Cost Explorer is the tool for charts and breakdowns of your spend. It is not active until someone enables it.
- Sign in as your admin identity, not as root.
- Open Billing and Cost Management, then Cost Explorer.
- Choose to launch Cost Explorer.
AWS then prepares your data. The first set of charts can take up to 24 hours to appear. A brand-new account also has little to show for the first few days, so an empty chart does not mean something is broken.
Billing data is never real time. Usage is reported and priced with a delay of up to a day, and some charges, such as support fees, taxes, and credits, appear only at the end of the month. This delay matters for the budget chapter, because alerts react to the data that has been processed, not to what you used a moment ago.
Step 4: Read cost data from the CLI
Once the admin identity has the permissions and Cost Explorer is on, the CLI can retrieve the same figures. First confirm which identity you are using:
aws sts get-caller-identityThe Arn in the output should name your IAM user or role, not :root. Then request last month's cost grouped by service:
aws ce get-cost-and-usage \
--time-period Start=2026-10-01,End=2026-11-01 \
--granularity MONTHLY \
--metrics UnblendedCost \
--group-by Type=DIMENSION,Key=SERVICE \
--query 'ResultsByTime[0].Groups[].[Keys[0],Metrics.UnblendedCost.Amount]' \
--output tablePoints to notice:
- The
Enddate is exclusive.End=2026-11-01covers October through the 31st. UnblendedCostis the cost as charged for each usage record. Other metrics, such asBlendedCostandAmortizedCost, matter mostly with consolidated billing or reserved capacity.- The
ceAPI is served fromus-east-1. The CLI normally handles this, but if you see endpoint errors, add--region us-east-1. - Each call to the Cost Explorer API is billed at a small per-request charge. Running it once by hand costs almost nothing. Do not put it in a tight loop or a script that runs every minute.
A new account often returns empty groups or amounts of 0. That is correct if you have used nothing yet.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Billing pages say you are not authorized, even as an administrator | IAM access to Billing is not activated | Sign in as root and activate it (Step 1) |
| `AccessDeniedException` from `aws ce ...` | The identity has no `ce:` permissions | Attach a billing policy (Step 2) |
| Cost Explorer shows no data | Just enabled, or the account is new | Wait up to 24 hours |
| Totals differ from the invoice | Taxes, credits, and support charges post later | Compare again after the month closes |
| Budget actions are denied but cost viewing works | Read-only policy does not allow budget changes | Add the `Billing` job function policy, or a custom budgets policy |
Other settings worth checking while you are here
- Billing contacts. Make sure the alternate billing contact is a monitored mailbox, ideally a shared address. Notices about overdue payments or unusual activity go there.
- Free tier usage alerts. The Billing console includes preferences to receive email about free tier usage and about billing. These are separate from AWS Budgets and take only a minute to set.
- Cost allocation tags. If you plan to tag resources by project, tags must be activated as cost allocation tags in the Billing console before they appear in cost reports. Tags are not retroactive, so cost before activation is not broken down by tag.
With visibility in place, the next chapter creates a monthly budget with email alerts. Budgets read the same underlying cost data, so the delay described above applies to them.
Exercise
You sign in as an IAM user with the AdministratorAccess policy and open the Billing console. You get an access denied message. Name the first thing to check, who must perform the fix, and what to do afterward so that this user can view cost data.
Show answer
First check whether "IAM user and role access to Billing information" is activated in the account settings. Only the root user can change it. Sign in as root with MFA, open Account, choose Edit on that setting, and select Activate IAM Access. Then confirm the IAM identity has a billing policy such as AWSBillingReadOnlyAccess, and enable Cost Explorer if you want charts. Allow up to 24 hours for the first Cost Explorer data to appear.
Exercise
Why does aws ce get-cost-and-usage --time-period Start=2026-10-01,End=2026-10-31 leave out October 31, and how do you fix the command?
Show answer
The End date is exclusive, so the query covers up to but not including the end date. To include all of October, set End=2026-11-01.