Skip to content
Visual explainer 1h 30m to learn 4 steps

Free-tier account, billing alarms & CLI

Set up a safe lab account with MFA, a budget alert and the AWS CLI.

By Invicly Tech, , in AWS Solutions Architect – Associate. About 11 minutes to read.

Topic 4 of 34

In short

A safe lab account protects the root user with MFA, uses a separate admin identity for daily work, and alerts you before you overspend. Then the AWS CLI lets you script and repeat labs. New accounts get Free Tier credits, but usage on a paid plan beyond those credits is billed.

Explained simply

Your first AWS account will be your lab for the whole course, so set it up safely. When you sign up, you create the root user: the email and password that own the account. Root can do everything, including closing the account. That is why you protect it with MFA and then stop using it.

For daily work, create a separate admin identity. The modern way is IAM Identity Center, which gives you a sign-in page and short-lived keys that expire on their own. If a laptop is stolen, old keys stop working within hours. Long-lived access keys in a file never expire unless you delete them.

Cloud bills grow quietly. A forgotten NAT gateway or load balancer costs money every hour. Since July 2025, new accounts get Free Tier credits and pick a free plan or a paid plan. Either way, add a budget alert from day one so you get an email long before a surprise.

Finally, install the AWS CLI, the command-line tool for AWS. Clicking in the console is fine for learning, but the CLI lets you repeat labs, script clean-up and see exactly which API call does what. Most exam services feel clearer once you have called them yourself.

Press Play on a diagram to walk through it one step at a time.

FlowLab account setup
  1. 1
    Create account

    Sign up with a unique email and strong root password.

  2. 2
    Root MFA

    Enable MFA, then lock root credentials away.

  3. 3
    Admin identity

    IAM Identity Center user or IAM admin user for daily use.

  4. 4
    Budget alert

    AWS Budgets emails you at a small monthly threshold.

  5. 5
    Configure CLI

    Install AWS CLI v2 and log in with SSO.

LayersSafety nets in a lab account
  1. 1
    Root user

    MFA on, no access keys, locked away.

  2. 2
    Admin identity

    Identity Center user with short-lived credentials.

  3. 3
    Budget alerts

    Forecast and actual thresholds by email.

  4. 4
    Billing alarm

    CloudWatch EstimatedCharges in us-east-1.

  5. 5
    Clean-up habit

    Tag resources and delete after each lab.

In depth

Protecting the root user

Enable MFA on root right after sign-up. A passkey or hardware security key is the strongest choice; an authenticator app is fine for a lab. You can register more than one MFA device, so add a backup. AWS now requires MFA on root for most accounts, so do it before you are forced to.

Never create access keys for root. Store the password in a password manager and set alternate contacts for billing, operations and security.

Only a few tasks need root: changing the account email or root password, changing the support plan, closing the account, restoring an IAM admin who locked themselves out, and fixing an S3 bucket policy that denies everyone. In an Organization, administrators can even remove root credentials from member accounts entirely and perform those tasks centrally.

  • MFA on root, ideally a passkey or security key
  • No root access keys, ever
  • Root only for account-level tasks
  • Set billing and security contacts

Identity Center login for console and CLI

IAM Identity Center lets you create a user, assign it the AdministratorAccess permission set in your account, and sign in through an access portal. Behind the scenes, each permission set becomes an IAM role, and every sign-in gets temporary credentials for that role.

The CLI uses the same login. aws configure sso stores a profile that points at your portal URL, account and permission set. aws sso login opens a browser, you approve, and the CLI caches a token. When the session expires, you simply log in again. No secret key ever sits in a file.

If you cannot use Identity Center, the fallback is an IAM user with MFA. Give it console access only, and create access keys only if a tool truly needs them.

SequenceWhat aws sso login does
You
AWS CLI
Identity Center
Your account
  1. 1aws sso login --profile lab
    You to AWS CLI: aws sso login --profile lab
  2. 2Start browser authorization
    AWS CLI to Identity Center: Start browser authorization
  3. 3Sign in with MFA and approve
    You to Identity Center: Sign in with MFA and approve
  4. 4Access token, cached locally
    Identity Center to AWS CLI: Access token, cached locally
  5. 5Get role credentials for account
    AWS CLI to Identity Center: Get role credentials for account
  6. 6Temporary keys for the role
    Identity Center to AWS CLI: Temporary keys for the role
  7. 7Signed API calls until expiry
    AWS CLI to Your account: Signed API calls until expiry

Budgets and billing alarms

AWS Budgets is the main tool. Create a monthly cost budget, for example 10 USD, with two alerts: one when forecasted spend passes 80 percent, and one when actual spend passes 100 percent. Alerts go to email or an SNS topic. Budgets can also track usage, Reserved Instance coverage and Savings Plans, and budget actions can apply a restrictive IAM policy or stop EC2 and RDS instances when a threshold is hit.

A second safety net is a CloudWatch billing alarm. First turn on billing alerts in the Billing console preferences. Then create an alarm on the EstimatedCharges metric, which only exists in us-east-1.

Billing data is not real time. It updates a few times a day, so a runaway resource can run for hours before an alert. That is why low thresholds and a clean-up habit matter.

How the CLI finds your credentials

The CLI checks several places in a fixed order and uses the first credentials it finds. Command-line options win first, such as --profile or --region. Next come environment variables: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, or AWS_PROFILE to pick a profile. Then the shared files: ~/.aws/config holds profiles, Regions and SSO settings, and ~/.aws/credentials holds static keys. Last come credentials from the environment the CLI runs in: a container role on ECS, or the instance profile role on EC2.

This order explains many surprises. An old AWS_ACCESS_KEY_ID left in your shell overrides your nice SSO profile. When in doubt, run aws sts get-caller-identity, which prints the account and ARN you are really using. Run aws configure list to see where each value came from.

FlowCLI credential lookup order
  1. 1
    Command line

    --profile and --region options.

  2. 2
    Environment

    AWS_ACCESS_KEY_ID or AWS_PROFILE.

  3. 3
    Config files

    SSO, role or key profiles in ~/.aws.

  4. 4
    Container role

    Task role on ECS.

  5. 5
    Instance profile

    Role attached to the EC2 instance.

Cleaning up so labs stay cheap

Some resources cost money even when idle. NAT gateways and load balancers bill per hour. Every public IPv4 address costs about 0.005 USD per hour, including Elastic IPs that are not attached to anything. EBS volumes and snapshots stay after you terminate an instance unless they were set to delete. RDS instances, interface VPC endpoints and CloudWatch log groups with long retention also add up.

Tag every lab resource, for example project=lab, and delete by tag at the end of each session. The Tag Editor in Resource Groups searches all Regions for a tag. Cost Explorer grouped by service shows what is costing money, and the Free Tier page shows how much of your credits or free usage is left.

  • NAT gateways and load balancers bill hourly
  • Idle public IPv4 addresses are billed too
  • Check EBS volumes and snapshots after labs
  • Tag everything and clean up by tag

Learn it in 4 short steps

About 25m each. Track them with a timer in your plan.

  1. 1
    Create an account and enable root MFA~25m
  2. 2
    Create an admin IAM user or SSO login~25m
  3. 3
    Set up a budget and billing alarm~25m
  4. 4
    Install and configure the AWS CLI~25m

Key points

  • Never use the root user for daily work and never create root access keys.
  • Use AWS Budgets for spend alerts; it works with forecast and actual cost.
  • Prefer IAM Identity Center and short-lived credentials over long-lived access keys.
  • Verify your CLI identity with aws sts get-caller-identity before running labs.

Key terms

Tap a card to flip it. 0/5 known

Examples

bash
# Log in with IAM Identity Center
aws configure sso --profile lab
aws sso login --profile lab

# Confirm who you are
aws sts get-caller-identity --profile lab

# Set a default Region for this profile
aws configure set region us-east-1 --profile lab

Configure the CLI with short-lived SSO credentials.

A 10 USD budget with two alerts from the CLI

Step 1: find your account ID with aws sts get-caller-identity. Step 2: create a monthly cost budget of 10 USD. Step 3: attach a forecasted alert at 80 percent, so you hear early if the month is heading over. Step 4: check the inbox for the subscription email. You can add an actual-spend alert at 100 percent the same way, by adding a second object to the notifications list.

bash
ACCT=$(aws sts get-caller-identity --query Account --output text)
aws budgets create-budget --account-id "$ACCT" \
  --budget '{"BudgetName":"lab-monthly",
    "BudgetLimit":{"Amount":"10","Unit":"USD"},
    "TimeUnit":"MONTHLY","BudgetType":"COST"}' \
  --notifications-with-subscribers '[{
    "Notification":{"NotificationType":"FORECASTED",
      "ComparisonOperator":"GREATER_THAN",
      "Threshold":80,"ThresholdType":"PERCENTAGE"},
    "Subscribers":[{"SubscriptionType":"EMAIL",
      "Address":"me@example.com"}]}]'

Fixing "wrong account" in the CLI

You logged in with SSO, but aws s3 ls shows buckets from an old job. Step 1: run aws sts get-caller-identity; it shows an IAM user ARN from another account. Step 2: run aws configure list; the access_key line says its source is env, so environment variables are winning over your profile. Step 3: unset those variables. Step 4: set AWS_PROFILE=lab and check again. The identity now shows a role named AWSReservedSSO_AdministratorAccess_ followed by a random suffix, which is your Identity Center session.

bash
aws sts get-caller-identity
aws configure list          # shows where each value comes from
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
export AWS_PROFILE=lab
aws sso login
aws sts get-caller-identity # now the SSO role in the lab account

Quick reference

  • Root: MFA on, no access keys, use only for account-level tasks
  • aws configure sso then aws sso login --profile lab for short-lived credentials
  • aws sts get-caller-identity shows which account and identity you are really using
  • aws configure list shows where each credential and Region value came from
  • Billing alarm metric: AWS/Billing EstimatedCharges, only in us-east-1, after enabling alerts
  • Budgets support forecasted and actual alerts, plus actions that stop instances
  • Idle NAT gateways, load balancers and public IPv4 addresses all bill by the hour
  • Tag lab resources project=lab and use Tag Editor to find them across Regions

Common mistakes

  • Leaving labs running; NAT gateways and load balancers bill by the hour.
  • Committing access keys to Git; bots find them within minutes.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Which task requires the root user?

Question 2

2Your SSO profile is set, but the CLI uses an old IAM user. What is the most likely cause?

Question 3

3In which Region do you create a CloudWatch billing alarm?

Question 4

4Which alert type warns you before the money is actually spent?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Install AWS CLI v2, configure an SSO profile called lab, and confirm your identity.

  2. Exercise 2medium

    Create a CloudWatch billing alarm that emails you when estimated charges pass 20 USD.

  3. Exercise 3hard

    Write a short script that lists every resource tagged project=lab in your lab Region, so you can review it before deleting.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Is the AWS Free Tier really free?
Free plan accounts use credits and cannot run up charges beyond them. On a paid plan, anything beyond the credits and free allowances is billed, so a budget alert is essential.
Should I use IAM Identity Center or an IAM user for my lab?
Identity Center, if you can. It gives short-lived credentials for both console and CLI. An IAM user with MFA is an acceptable fallback.
I lost my root MFA device. What now?
Use your backup MFA device if you registered one. Otherwise, use the sign-in page's troubleshooting option, which verifies you through the account email and phone number.
Can AWS stop my resources automatically when I hit my budget?
Yes. Budget actions can apply an IAM or SCP policy or stop specific EC2 and RDS instances when a threshold is reached, though billing data can lag by hours.

Go deeper

ShareXLinkedInWhatsApp