Subscribe

Setting up a new AWS account safely: root MFA, IAM Identity Center, budgets and alerts

The first hour with a new AWS account: lock away the root user, sign in through IAM Identity Center instead of access keys, set a budget that emails you, and turn on CloudTrail. Every step with the console path and the CLI.

Setting up a new AWS account safely: root MFA, IAM Identity Center, budgets and alerts

The AWS account behind this blog was opened years ago, in a hurry, from the console. It has worked fine, but if I opened one today I'd do the first hour very differently. A new account is easy to set up well and annoying to fix later, once there are users, keys and resources hanging off it.

In this blog we will look at that first hour. Lock away the root user, give yourself a normal login through IAM Identity Center, set a budget that emails you, and turn on CloudTrail. It's a beginner post. You need an email address, a phone, a card and the AWS CLI v2 installed. I show the CLI for each step so you can see what's happening, but most of this is just as quick in the console. All IDs below are placeholders (account 111122223333, example.com).

Before you sign up

Use an email address that isn't your personal inbox. A shared or alias address like aws-root@example.com is better, because the root user's email is how AWS (and anyone resetting the password) reaches the account. If you leave a job or lose that inbox, you lose the account.

Since July 2025 you also pick a plan at sign up, Free or Paid. On the Free plan AWS gives you credits and won't charge you until you upgrade, for up to 6 months or until the credits run out. It's a good choice for learning. Read what happens at the end of it before you build anything you want to keep.

Lock away the root user

The root user can do everything, including closing the account and changing the payment card. You should use it almost never. First, add MFA. AWS has been making root MFA mandatory since 2024 and will likely ask you at first sign in, but do it on purpose and do it properly: a passkey or hardware key is better than an authenticator app, and you can register more than one device (I'd register two, so losing a phone isn't a crisis).

Console: account menu, Security credentials, Multi-factor authentication, Assign MFA device.

Second, make sure root has no access keys. There's no good reason for them. You can check both things from the CLI later, once you have a normal login.

aws iam get-account-summary \
  --query 'SummaryMap.{RootMFA:AccountMFAEnabled,RootAccessKeys:AccountAccessKeysPresent}'

You want RootMFA to be 1 and RootAccessKeys to be 0. Then sign out of root and write down where the password and MFA device live. That's it for root.

A normal login with IAM Identity Center

Here's the part I'd change most about my own account. Back then I made IAM users, and the Terraform for this blog still runs with an IAM user's access key loaded by a small wrapper script (it's in my import post). Access keys don't expire on their own, they sit in files, and they end up in places they shouldn't. IAM Identity Center gives you a user that signs in through a portal and gets short lived credentials for the CLI. No long lived key on your laptop.

One catch that trips people up. Identity Center can only hand out access to AWS accounts if it runs as an "organization instance", which means you need AWS Organizations turned on. For a single account that sounds like overkill, but an organization with one account costs nothing and it's two clicks.

aws organizations create-organization --feature-set ALL

Then enable IAM Identity Center in the console, in the region you'll use most (I use ap-south-1, Mumbai, because I'm in India). Pick the region carefully, the Identity Center instance lives there.

Now create yourself a user. In the console it's Users, Add user. From the CLI you need the identity store ID first, which aws sso-admin list-instances prints.

aws identitystore create-user \
  --identity-store-id d-1234567890 \
  --user-name me \
  --display-name "Me" \
  --name GivenName=Me,FamilyName=Example \
  --emails Value=me@example.com,Type=work,Primary=true

A permission set is a bundle of policies that becomes a role in each account you assign it to. Start with admin, since you're the only person, and keep sessions short.

aws sso-admin create-permission-set \
  --instance-arn arn:aws:sso:::instance/ssoins-1234567890abcdef \
  --name AdministratorAccess \
  --session-duration PT4H

aws sso-admin attach-managed-policy-to-permission-set \
  --instance-arn arn:aws:sso:::instance/ssoins-1234567890abcdef \
  --permission-set-arn arn:aws:sso:::permissionSet/ssoins-1234567890abcdef/ps-1234567890abcdef \
  --managed-policy-arn arn:aws:iam::aws:policy/AdministratorAccess

aws sso-admin create-account-assignment \
  --instance-arn arn:aws:sso:::instance/ssoins-1234567890abcdef \
  --target-id 111122223333 \
  --target-type AWS_ACCOUNT \
  --permission-set-arn arn:aws:sso:::permissionSet/ssoins-1234567890abcdef/ps-1234567890abcdef \
  --principal-type USER \
  --principal-id 11111111-2222-3333-4444-555555555555

I'd also make a second permission set with ReadOnlyAccess and use that day to day. Most of the time you're only looking at things.

Set up MFA for this user too (Identity Center, Settings, Authentication). Then point CLI at it.

aws configure sso
aws sso login --profile admin
aws sts get-caller-identity --profile admin

configure sso asks for the portal URL and region and writes a profile into ~/.aws/config. No secret goes into ~/.aws/credentials at all. When the session expires you run aws sso login again. Terraform and most SDKs pick the profile up through AWS_PROFILE, so you don't need a wrapper like mine. If you're starting with Terraform, your first EC2 instance with plan and apply works the same with an SSO profile.

A budget that emails you

Bills on AWS don't stop at a limit. They just keep going. A budget won't stop them either, but it tells you early. I set a small monthly cost budget with three emails: at 50% actual, at 100% actual and when the forecast goes over 100%. The forecast one is the most useful, it warns you mid month.

Here is budget.json.

{
  "BudgetName": "monthly-total",
  "BudgetLimit": {
    "Amount": "10",
    "Unit": "USD"
  },
  "TimeUnit": "MONTHLY",
  "BudgetType": "COST"
}

And notifications.json, shortened to the forecast one here (the full file has the two actual ones as well).

[
  {
    "Notification": {
      "NotificationType": "FORECASTED",
      "ComparisonOperator": "GREATER_THAN",
      "Threshold": 100,
      "ThresholdType": "PERCENTAGE"
    },
    "Subscribers": [
      { "SubscriptionType": "EMAIL", "Address": "billing@example.com" }
    ]
  }
]
aws budgets create-budget \
  --account-id 111122223333 \
  --budget file://budget.json \
  --notifications-with-subscribers file://notifications.json

Pick an amount close to what you expect to spend. My own bill is mostly one t3.small Reserved Instance (there's a post on fitting Ghost into that 2 GB box), so a budget a bit above that tells me the moment something new shows up. While you're in Billing, also turn on the billing alerts preference and have a look at Cost Anomaly Detection. Both are free.

Turn on CloudTrail

CloudTrail records API calls. Without a trail you still get 90 days of management events in Event history, for free. A trail keeps them in S3 for as long as you like, and the first copy of management events is free (you pay a little for S3). If anything ever goes wrong in the account, this is what you'll want to read.

The bucket needs a policy that lets CloudTrail write to it, limited to your trail with aws:SourceArn.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "CloudTrailAclCheck",
      "Effect": "Allow",
      "Principal": { "Service": "cloudtrail.amazonaws.com" },
      "Action": "s3:GetBucketAcl",
      "Resource": "arn:aws:s3:::example-trail-111122223333",
      "Condition": {
        "StringEquals": {
          "aws:SourceArn": "arn:aws:cloudtrail:ap-south-1:111122223333:trail/management-events"
        }
      }
    },
    {
      "Sid": "CloudTrailWrite",
      "Effect": "Allow",
      "Principal": { "Service": "cloudtrail.amazonaws.com" },
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::example-trail-111122223333/AWSLogs/111122223333/*",
      "Condition": {
        "StringEquals": {
          "s3:x-amz-acl": "bucket-owner-full-control",
          "aws:SourceArn": "arn:aws:cloudtrail:ap-south-1:111122223333:trail/management-events"
        }
      }
    }
  ]
}
aws s3api create-bucket \
  --bucket example-trail-111122223333 \
  --region ap-south-1 \
  --create-bucket-configuration LocationConstraint=ap-south-1

aws s3api put-bucket-policy \
  --bucket example-trail-111122223333 \
  --policy file://cloudtrail-bucket-policy.json

aws cloudtrail create-trail \
  --name management-events \
  --s3-bucket-name example-trail-111122223333 \
  --is-multi-region-trail \
  --enable-log-file-validation

aws cloudtrail start-logging --name management-events

Multi region matters, someone who gets into your account will happily start instances in a region you never look at. create-trail doesn't start logging by itself, that's what start-logging is for, and get-trail-status should then say IsLogging: true.

Three small defaults

These take a minute each and I'd do them on day one.

aws s3control put-public-access-block \
  --account-id 111122223333 \
  --public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true

aws ec2 enable-ebs-encryption-by-default --region ap-south-1

The first blocks public S3 buckets for the whole account. New buckets already block public access, but this also covers anything made later with different settings. The second encrypts every new EBS volume in that region, it's per region, so repeat it where you run things. And third, add a security contact under Account, Alternate contacts (or aws account put-alternate-contact), so AWS security notices don't only go to the root inbox.

What I didn't cover

GuardDuty, Security Hub, Config and Control Tower are all worth knowing. For one person's account they're more than you need on day one. When you want to check what you've got, the safe VAPT with AWS CLI post walks through read only checks of an account.

I didn't run these commands against a live account while writing this. I checked every command and the JSON files offline against the AWS CLI's service models, the budget and notification files against the exact input shapes, so the flags and fields are right. Your IDs will differ.

There we have it. One last tip: put a reminder in your calendar to sign in as root once a year, just to check the MFA device and the password still work.