Lock down a new AWS account and cap lab costs
Secure the root user with MFA, sign in without it day to day, set a budget alert and prove a lab has been cleaned up.
By Invicly Tech, , in AWS Cloud Engineering. About 12 minutes to read.
In short
The root user of a new AWS account can do everything, including closing the account, so you protect it with a strong password and MFA and then stop using it. Day-to-day work happens through IAM Identity Center or another administrative sign-in. A budget with email alerts, consistent tags and a cleanup check stop a forgotten lab from turning into a surprise bill.
Think of it like this: The root user is the master key to a building: you lock it in a safe, give people their own badges, and fit a meter that shouts when the electricity bill climbs.
Explained simply
When you open an AWS account, you get one login: the email address and password you signed up with. This is the root user, and it can do anything, including deleting every resource or closing the account. Treat it like the deed to a house: keep it safe and use it rarely.
The first job is to protect root with multi-factor authentication, or MFA. That means signing in needs a second proof, such as a passkey, a hardware security key or a code from an authenticator app. AWS now prompts for root MFA by default, but you still have to register a device. Make sure root has no access keys.
For everyday work, create a separate admin sign-in. The recommended path is IAM Identity Center. You create a user, give it an admin permission set, and sign in through a personal access portal. Each sign-in gives short-lived credentials, so nothing permanent sits on your laptop.
Next, set a budget. AWS Budgets watches your spending and emails you when it crosses limits you choose, such as 50, 80 and 100 percent of 10 US dollars a month. A budget does not switch anything off. It just makes sure you notice early.
Finally, tag what you create, for example project=filesvc and owner=yourname. Tags let you find leftovers after a lab and group costs by project. At the end of each lab, search for the tag in Tag Editor across all Regions. An empty result, plus a flat daily bill, means you really cleaned up.
Press Play on a diagram to walk through it one step at a time.
- 1Secure root
Strong unique password, MFA, no access keys.
- 2Admin sign-in
Enable IAM Identity Center and create an admin user.
- 3Budget
Monthly cost budget with alerts at 50, 80 and 100 percent.
- 4Tag rule
Every lab resource gets project and owner tags.
- 5Sign out of root
Use the access portal from now on.
- Root user
- Root-only tasks
- Account email and password changes
- Activate IAM billing access
- Identity Center admin
- Daily console work
- CLI via SSO profile
- Creating lab resources
- Workload roles (later)
- Lambda execution role
- CI deploy role
In depth
Securing the root user properly
Use a long, unique password stored in a password manager, and register MFA. AWS supports passkeys and FIDO2 security keys, virtual authenticator apps and hardware TOTP tokens, and you can register more than one device on the root user so losing one is not a lockout. Check the IAM console's security credentials page for the root user: there should be no access keys listed. If there are, delete them.
Also check the account contact details and alternate contacts, so security and billing emails reach someone who reads them. The account email itself should be a mailbox you control long term, ideally a shared address such as aws-sandbox@example.com rather than one person's inbox. Once you use AWS Organizations, centralised root access management lets the management account remove root credentials from member accounts entirely.
- Unique long password in a password manager
- MFA registered, ideally a passkey or security key
- No root access keys
- Contact and alternate contacts filled in
Choosing an administrative sign-in path
There are three common options. IAM Identity Center is the recommended one: it gives people a portal, permission sets, short-lived credentials and easy CLI sign-in. Enabling it in a standalone account creates an organization with that account as the management account, which is fine for a sandbox and ready for growth later. Identity Center itself has no extra charge.
The second option is an IAM user with a password and MFA. It works, but it is a long-term identity that you must manage per account. The third is federation from an existing identity provider, such as Microsoft Entra ID or Okta, into Identity Center, which suits companies that already manage staff there. Whichever you pick, sign in as root only for the short list of root-only tasks.
- Short-lived credentials
- Access portal and CLI SSO
- Works across many accounts
- Recommended starting point
- Long-term password, maybe keys
- Managed per account
- Simple for one account
- Harder to audit and rotate
- Staff sign in with company login
- Joiners and leavers handled centrally
- Needs an existing directory
- Best for organisations
Budgets, alerts and what they cannot do
In Billing and Cost Management, create a monthly cost budget, for example 10 USD. Add alert thresholds on actual cost at 50 and 80 percent and on forecasted cost at 100 percent, and send them to an email address you watch. Monitoring budgets and receiving these notifications is free; budget actions, which can apply an IAM policy or stop certain instances, are free for the first two action-enabled budgets per month and then charged per day.
Billing data is not real time. Charges usually show up within hours, and a forecast needs some history before it is meaningful, so a budget catches slow leaks better than a sudden spike. To let your Identity Center admin view billing, the root user must activate IAM access to the Billing console once; that is one of the root-only tasks.
- Monthly cost budget with email alerts
- Thresholds on actual and forecasted cost
- Alerts warn; they do not stop resources
- Root must activate IAM access to Billing once
Tagging and proving cleanup
Pick a small tag standard and apply it to every lab resource: project=filesvc, owner=alice, lab=01. Infrastructure as code tools can add tags automatically later in the course. To see costs grouped by tag, activate the tag keys as cost allocation tags in the Billing console; new tag keys only appear there after they have been used on a resource, and activation takes time to show in Cost Explorer.
Cleanup has three checks. First, Tag Editor in Resource Groups: search all Regions for project=filesvc and expect zero results. Second, look for common untagged leftovers such as EBS snapshots, Elastic IP addresses, NAT gateways and CloudWatch log groups. Third, a day later, open Cost Explorer filtered by the tag or service and confirm the daily cost has dropped to zero.
- 1Create with tags
project, owner, lab
- 2Run the lab
Budget watches spend
- 3Delete resources
Stack delete or manual
- 4Verify
Tag Editor empty, cost flat
- Back to step 1
Learn it in 5 short steps
About 30m each. Track them with a timer in your plan.
- 1Add MFA to the root user~30m
- 2Pick an admin sign-in path~30m
- 3Create a budget with email alerts~30m
- 4Tag lab resources for cost tracking~30m
- 5Check cleanup with Tag Editor and billing~30m
Key points
- Add MFA to the root user and do not create root access keys; delete any that exist.
- Use IAM Identity Center with a permission set for daily admin work so you get short-lived credentials.
- AWS Budgets sends email when actual or forecast spend crosses a threshold. It warns you; it does not stop spending.
- Tag every lab resource, for example project=filesvc, so Tag Editor and Cost Explorer can find what is left behind.
- A lab is cleaned up only when Tag Editor shows no tagged resources in any Region and the bill stops growing.
Key terms
Tap a card to flip it. 0/6 known
Examples
Creating a 10 USD budget from the CLI
You want a budget that emails you at 80 percent of actual spend. Step 1: sign in with your admin profile. Step 2: write the budget definition and notification to small JSON files (budget.json holds the name, amount, unit USD, time unit MONTHLY and budget type COST; notify.json holds the threshold and your email subscriber). Step 3: run the command below with your account ID. Step 4: check the Budgets console, where the new budget appears with its alert. An email arrives at that address the first time actual spend crosses the threshold.
ACCOUNT=$(aws sts get-caller-identity --query Account --output text)
aws budgets create-budget --account-id "$ACCOUNT" \
--budget file://budget.json \
--notifications-with-subscribers file://notify.json
# notify.json (one entry):
# [{"Notification":{"NotificationType":"ACTUAL","ComparisonOperator":"GREATER_THAN",
# "Threshold":80,"ThresholdType":"PERCENTAGE"},
# "Subscribers":[{"SubscriptionType":"EMAIL","Address":"aws-sandbox@example.com"}]}]
aws budgets describe-budgets --account-id "$ACCOUNT"Finding leftovers after a lab
You finished lab 01 and deleted what you remembered. Step 1: query the Resource Groups Tagging API for anything still tagged project=filesvc. Run it in each Region you used; Tag Editor in the console can search several Regions at once. Step 2: if results come back, delete them and run the query again. Step 3: check for resources that are often untagged, such as snapshots you own. Step 4: the next day, confirm in Cost Explorer that the service's daily cost is zero. Expected evidence: an empty list from the tagging query and a flat cost line.
aws resourcegroupstaggingapi get-resources \
--tag-filters Key=project,Values=filesvc \
--query "ResourceTagMappingList[].ResourceARN" --region eu-west-1
# Expect: []
aws ec2 describe-snapshots --owner-ids self --query "Snapshots[].SnapshotId"Quick reference
- Root: unique password, MFA, no access keys, root-only tasks only
- Daily admin: IAM Identity Center user with an admin permission set
- Budgets warn by email or SNS; they never delete resources on their own
- Budget monitoring and alerts are free; action-enabled budgets beyond two per month are charged
- Activate user-defined tags as cost allocation tags before grouping costs by them
- Cleanup proof: tagging API returns [] in every Region used, and cost goes flat
- Common leftovers: EBS snapshots, Elastic IPs, NAT gateways, log groups
Common mistakes
- Keeping root access keys for convenience. A leaked root key gives an attacker the whole account.
- Believing a budget is a spending cap. Alerts only notify; you still have to delete resources.
- Expecting a new tag to appear in Cost Explorer at once. User-defined tags must be activated as cost allocation tags first and take time to show.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Check that your root user has MFA and no access keys, using the IAM account summary.
- Exercise 2medium
Create a monthly cost budget of 10 USD with alerts at 50 and 80 percent of actual cost and 100 percent of forecasted cost, all to aws-sandbox@example.com.
- Exercise 3hard
Create a tagged S3 bucket and SQS queue, then delete them and prove the cleanup with the tagging API and Tag Editor.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Can I set a hard spending limit on AWS?
- Not as a simple switch. Budgets notify you, and budget actions can apply restrictive policies or stop some resources, but you should still delete resources yourself and check cost after each lab.
- Is the AWS Free Tier enough for these labs?
- Many labs fit within Free Tier offers or cost very little, but Free Tier terms changed in 2025 and differ by account age and plan. Check the Free Tier page for your account, and keep a budget alert on regardless.
- What if I lose my root MFA device?
- Register a second MFA device in advance so you can still sign in. If you lose all of them, AWS has a recovery process that verifies the account email and phone number, which is slow, so avoid needing it.
- Does enabling IAM Identity Center cost anything?
- IAM Identity Center has no additional charge. Enabling it creates an AWS Organizations organization, which is also free.