# Security in Billing

Who may see costs, invoices and budgets and change them (IAM), what is recorded in the audit log, and which billing permissions reach into other services.

## IAM actions

Every request, through the API, the CLI, Terraform or the console, is checked against your IAM
policies. Billing's resource names carry the region: an invoice is
`rn:ews:de1:<organization id>:billing:invoice/<id>`, and budgets (`budget/<id>`), payment methods
(`payment-method/<id>`) and saved views (`cost-view/<id>`) follow the same pattern.

Requests for one budget, invoice, payment method or saved view are checked against that resource.
Everything else, including lists, the cost explorer, creating a budget or a view, the billing
account and the cost report, is checked against `rn:ews:de1:<organization id>:billing:*`. The
console decides which buttons to show by the same wildcard.

(The table of IAM actions is generated on the web page.)
- `billing:GetCostAndUsage` covers the cost explorer, its exports, usage lines, credits, the
  comparison with other clouds, the **Usage** and **Savings** pages, saved views and the **Cost**
  cards of resources.
- `billing:EstimateCost` is not needed by whoever holds the IAM action of the operation priced.
- Checking a budget's scope also needs `tags:ListTags`.
- Approving a budget's proposal also needs, for each resource, `ec2:StopInstances`,
  `rds:StopDBInstance` or `autoscaling:UpdateAutoScalingGroup`.
- Grouping or filtering costs by where resources run needs `iam:UpdateOrganization`.
- Closing the organization needs `iam:DeleteOrganization` (see
  [Close the organization](close-the-organization.md)).

A policy for someone who may read costs and manage budgets, but not invoices or the billing account
(replace _org-id_ with your organization's id):

```json
{
  "Version": "2024-01-01",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "billing:GetBillingSummary",
        "billing:GetCostAndUsage",
        "billing:GetBudgets",
        "billing:CreateBudget",
        "billing:UpdateBudget",
        "billing:DeleteBudget"
      ],
      "Resource": "rn:ews:de1:org-id:billing:*"
    }
  ]
}
```

## Audit

Every write (creating, changing and deleting budgets, saved views and payment methods, changing the
billing account and the cost report settings, sending a report, keeping a finding, approving or
dismissing a proposal) is recorded in the audit log, allowed or denied, once the request has passed
its validation: a request with a malformed body, or an id that is not a UUID, is refused before the
permission check and not recorded, and so is approving or dismissing a proposal that does not
exist. Reads are recorded only when they are denied, at most once a minute per user and action.

The stops an approved proposal runs are recorded under the approver's name, as the services' own
actions.

## Who sees the numbers

The cost explorer, the budgets and the reports are scoped to your organization. A private saved view
is visible to its creator only. The monthly cost report and budget alerts go only to the addresses
configured for them; the report's default recipients are the owners and the invoice e-mail.

## Related

- [Budgets](budgets.md)
- [Save and mail a cost view](save-a-cost-view.md)
