# Put cost controls on a new cloud account

By the end of this guide, a new AWS account, Azure subscription or Google Cloud project has an owning team in Costfluent, a tag policy its cost is measured against, a budget and a spend alert from the day its first cost arrives. It is for the platform engineer or admin who creates accounts and hands them to teams. The path goes from making sure the account's cost reaches the right workspace, through its owner and the tags it must carry, to a budget and an alert on it, and the same controls kept as code. Each step links to the page that owns the detail.

## Before you start

- A connection that covers the new account: the management account of your AWS Organization, an Azure connection whose role reaches the subscription, or the Google Cloud billing export of the billing account the project is billed to; see [Manage connections](/connect/manage-connections).
- The account's ID as your provider writes it, and the team that will own it.
- Edit access to the workspace that reads the account's cost; see [Access model](/concepts/access-model).
- The steps do not run on the [sample data](/quickstart#sample-data): it holds no account you create, and nothing is sent from it.

## 1. Make sure the account's cost arrives

A new account needs no new connection when an existing one already covers it. In an AWS Organization, a new member account appears on the management account's **Accounts** card as **Covered**; see [After connecting](/connect/aws#after-connecting). On Azure, a subscription the connection's role reaches, such as one under a management group the role is assigned at, appears after the next check; see [Data and freshness](/connect/azure#data-and-freshness). On Google Cloud, a project billed to the exported billing account arrives in that export under **Sub-account**, by its project ID; see [Reporting dimensions](/connect/google-cloud#reporting-dimensions). An account no connection covers is connected on its provider's page.

Then check the workspace reads it. A workspace that reads **Chosen accounts** of an AWS or Azure connection does not read a new account until you tick it under **Choose accounts**, while **All accounts** includes the accounts a connection discovers later. See [Choose which workspaces see the cost](/connect/manage-connections#choose-which-workspaces-see-the-cost). Once its first cost is in, a report grouped by **Sub-account** lists the account by its ID.

## 2. Give it an owner

Add the account's ID to the **Sub-account** condition of the owning team's allocation rule, or add a segment and a rule for a team that has none yet, and check **Preview** before you save. Where your workspace names owners with a virtual tag instead, add the account to the rule that gives the team's value. See [Segments and allocation rules](/allocation/segments#add-a-rule) and [Virtual tags](/allocation/virtual-tags).

## 3. State the tags it must carry

In the **Tag policy** card under **Allocation**, then **Tags**, select "Add rule", choose the provider under **Provider**, add the account's ID under **Accounts**, and pick the keys under **Required tag keys**. Rules add up, so the account must also carry the keys of every rule for all accounts. The policy's report lists the account while its cost misses a required key. Costfluent measures the account's tags against the policy and changes nothing in it. See [Set a tag policy](/allocation/tags#set-a-tag-policy).

## 4. Put a budget and a spend alert on it

Save a cost report filtered to the account's **Sub-account**. From the report's **More actions**, choose **Create budget**: the budget counts what the report counts, so it holds the account alone. Set its amount and pick the team's email channel under **Send to**. From the same menu, choose **Create alert**, which starts with the report's filter, pick a **Kind** such as **Spend threshold**, enter the **Threshold**, and pick the same notification channel. A team that owns several accounts can instead budget its whole segment. See [Create a budget from a report](/planning/budgets#create-a-budget-from-a-report) and [Create a spend or change alert](/planning/alerts#create-a-spend-or-change-alert).

## 5. Keep the controls as code

Every control above has a Terraform resource: the workspace's accounts on `costfluent_workspace_provider`, the owner on `costfluent_segment` and `costfluent_allocation_rule`, the tags on `costfluent_tag_policy`, the budget on `costfluent_budget` and the alert on `costfluent_cost_alert`. A workspace has one tag policy, so the account's rule goes into the workspace's one `costfluent_tag_policy`. With the team's objects in a module, a new account is a change to the module's inputs, reviewed in the same pull request that creates the account. See [Roll out cost ownership with Terraform](/guides/cost-ownership-as-code) and [Terraform](/developers/terraform#manage-objects).

## Check the result

- A report grouped by **Sub-account** lists the account with its cost.
- On **Segments**, the **Rules** card shows the owning team's rule naming the account under **Matches**.
- The **Tag policy** card lists the rule for the account.
- On **Alerts**, **Configured alerts** lists the budget's thresholds and the account's spend alert.

## Keep it true

- Costfluent recommends working through the [new account checklist](https://costfluent.com/handbook/templates/new-account-cost-controls-checklist) for every new account before it is handed to a team, and again when an account changes owner: moving an account between teams is a change to the rules, not to its reports.
- Costfluent recommends reading the tag policy's report at each [Run a monthly cost review](/guides/monthly-cost-review), so an account's untagged cost is fixed while it is still new.

## Related

- [Manage connections](/connect/manage-connections), [Segments and allocation rules](/allocation/segments), [Tags and tag coverage](/allocation/tags), [Budgets](/planning/budgets) and [Alerts](/planning/alerts)
- [Cost controls for a new account or project](https://costfluent.com/handbook/templates/new-account-cost-controls-checklist), the checklist to work through before an account is handed to a team
- [Roll out cost ownership with Terraform](/guides/cost-ownership-as-code)
