In this lab you will
- Protect the root user with MFA and remove any root access keys
- Enable IAM Identity Center and sign in to the AWS CLI through the sandbox profile with temporary credentials
- Create a monthly cost budget with actual and forecasted email alerts from the CLI
- Find your own management events in CloudTrail event history
Before you start
Use a separate AWS account for this course, never a work or production
account. Every later lab uses the sandbox profile you create here, in
Region us-east-1 (N. Virginia) unless you choose otherwise.
What bills: nothing in this lab. IAM, IAM Identity Center, AWS Organizations, CloudTrail event history and AWS Budgets used only for notifications have no charge.
You need:
- AWS CLI version 2:
aws --versionshould printaws-cli/2.x - Python 3.11 or newer with boto3:
pip install boto3 - An email address for budget alerts
- An authenticator app, passkey or security key for MFA
Step 1: protect the root user
The root user is the email address you signed up with. It can do anything, including closing the account, and no policy in the account can restrict it.
- Sign in to the console as the root user.
- Open the account menu (top right) and choose Security credentials.
- Under Multi-factor authentication (MFA), choose Assign MFA device. A passkey or security key is strongest; an authenticator app is fine. Since June 2025 AWS requires MFA for root users in every account type, so you may already have registered one at first sign-in.
- On the same page, check Access keys. If any exist for the root user, delete them.
- Sign out. From now on use the root user only for the few tasks that require it, such as closing the account.
Step 2: an everyday identity with IAM Identity Center
IAM Identity Center gives you single sign-on to the console and temporary credentials for the CLI.
- In the console, open IAM Identity Center and choose Enable. Choose the option that enables it with AWS Organizations (an organization instance). If the account is not yet in an organization, AWS creates one with this account as the management account. That is fine for a sandbox. An account instance cannot give access to AWS accounts, so it will not work for this course.
- Under Users, add a user for yourself and accept the email invitation. Set up MFA for this user when prompted.
- Under Permission sets, create one from the predefined AdministratorAccess policy. In a sandbox you need broad rights to build things; in real accounts you would scope this down.
- Under AWS accounts, select this account, choose Assign users or groups, and assign your user with that permission set.
- Copy the AWS access portal URL from the Identity Center dashboard.
Now connect the CLI:
aws configure sso
# SSO session name: sandbox
# SSO start URL: <your AWS access portal URL>
# SSO region: <the Region where you enabled Identity Center>
# SSO registration scopes: sso:account:access (the default)
# Then pick the account and the AdministratorAccess role,
# default client Region: us-east-1, output format: json,
# and profile name: sandbox
Sign in and check who you are:
aws sso login --profile sandbox
export AWS_PROFILE=sandbox
aws sts get-caller-identity
The Arn ends in assumed-role/AWSReservedSSO_AdministratorAccess_.../you.
That is a role session, not an IAM user, and its credentials expire. When
they do, run aws sso login --profile sandbox again.
Fallback: if you cannot use Identity Center, create an IAM user with
console access and MFA, give it access keys, and run
aws configure --profile sandbox. Delete those keys when the course ends.
Step 3: a budget alert
Set the variables the rest of the lab uses:
export AWS_PROFILE=sandbox
export AWS_REGION=${AWS_REGION:-us-east-1}
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
ALERT_EMAIL="you@example.com" # your address
Write the budget. Pick a monthly limit you are comfortable with; 10 here
is only an example:
cat > budget.json <<'EOF'
{
"BudgetName": "sandbox-monthly",
"BudgetLimit": { "Amount": "10", "Unit": "USD" },
"TimeUnit": "MONTHLY",
"BudgetType": "COST"
}
EOF
cat > notifications.json <<EOF
[
{
"Notification": {
"NotificationType": "ACTUAL",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 80,
"ThresholdType": "PERCENTAGE"
},
"Subscribers": [{ "SubscriptionType": "EMAIL", "Address": "${ALERT_EMAIL}" }]
},
{
"Notification": {
"NotificationType": "FORECASTED",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 100,
"ThresholdType": "PERCENTAGE"
},
"Subscribers": [{ "SubscriptionType": "EMAIL", "Address": "${ALERT_EMAIL}" }]
}
]
EOF
aws budgets create-budget \
--account-id "$ACCOUNT_ID" \
--budget file://budget.json \
--notifications-with-subscribers file://notifications.json
aws budgets describe-budgets --account-id "$ACCOUNT_ID" \
--query 'Budgets[].[BudgetName,BudgetLimit.Amount,TimeUnit]' --output table
The first alert fires when actual spend passes 80% of the limit; the second when AWS forecasts the month will end above it. Keep this budget for the whole course.
Step 4: find yourself in CloudTrail
CloudTrail event history records management events for 90 days with no
setup. Global services such as IAM and AWS Budgets record their events in
us-east-1:
aws cloudtrail lookup-events --region us-east-1 \
--lookup-attributes AttributeKey=EventName,AttributeValue=CreateBudget \
--max-results 5 \
--query 'Events[].[EventTime,Username,EventName]' --output table
New events can take several minutes to appear. You should see your own
CreateBudget call, with your Identity Center user as the username. If the
table is empty after ten minutes, list the most recent events of any kind:
aws cloudtrail lookup-events --region us-east-1 --max-results 10 \
--query 'Events[].[EventTime,EventSource,EventName,Username]' --output table
Every API call you make in this course, from the console or the CLI, ends up here. That is what “audit who did what” means in an exam question.
Check your work
- The root user has MFA and no access keys.
-
aws sts get-caller-identity --profile sandboxshows anAWSReservedSSO_...role session (or your fallback IAM user). -
aws budgets describe-budgets --account-id "$ACCOUNT_ID"listssandbox-monthly. - CloudTrail event history shows your
CreateBudgetcall.
Clean up
Keep the root MFA, Identity Center, the sandbox profile and the budget for
the rest of the course. Remove only the local files:
rm -f budget.json notifications.jsonKey takeaways
- The root user gets MFA and no access keys, and is used only for the few tasks that need it.
- IAM Identity Center gives the CLI short-lived role credentials; nothing permanent is written to your laptop.
- An assumed-role ARN containing AWSReservedSSO_ proves you are using Identity Center, not an IAM user.
- A FORECASTED budget alert warns before the month ends over the limit; an ACTUAL alert warns once it is already spent.
- CloudTrail event history keeps 90 days of management events with no setup, and global-service events land in us-east-1.
Lesson questions
Answer all 10, then check them. You need 7 right to pass this lab and unlock the next one. Try as often as you like; after three tries the answers and explanations are shown. These are our own questions, written for this course.
You book and take the exam yourself with AWS. We do not run exams or sell exam vouchers. Pontelon is not affiliated with, endorsed by, or an authorized training partner of AWS. Practice questions are our own, written against the published exam guide, never leaked exam content. Certification names are trademarks of their owners.