AWS Certified CloudOps Engineer – AssociateModule 1: Getting started

Lab: a sandbox account that cannot surprise you

Protect the root user with MFA, sign in through IAM Identity Center instead of root, connect the AWS CLI with temporary credentials under a sandbox profile, check your identity in CloudShell, and set a verified budget alert before any other lab costs you money.

This lesson
QuestionsPass 7/10
Course55 items

In this lab you will

  • Protect the root user with MFA and confirm that it has no access keys
  • Connect the AWS CLI to an IAM Identity Center role session with a sandbox profile and confirm the identity with aws sts get-caller-identity
  • Create a monthly budget with an actual and a forecasted email alert, and confirm the recipient's address
  • Check the same identity in AWS CloudShell, and explain why the CLI and CloudShell must agree

Before you start

Cost: The steps in this lab create no resource that AWS bills by the hour or by use. AWS states that budget notifications are free of charge. Two things can still cost money:

  • Creating an organization can end your free credits. Step 2 enables IAM Identity Center, and if your account is not already in an organization, AWS creates one. AWS says: “If you use a free tier account, creating an AWS organization automatically upgrades your account to a paid plan with pay-as-you-go pricing. Your free tier credits expire immediately.” If your sandbox account is on the free plan and you still hold credits, decide before Step 2 whether you accept that. Nothing in this lab bills by the hour, but later labs do bill if you forget to clean up.
  • IAM Identity Center itself is not charged. AWS’s FAQ says “IAM Identity Center is offered at no extra charge.” The one exception in Step 2 is the Multi-Region instance option, which creates a customer managed KMS key that carries AWS KMS charges. Choose Single-Region and you avoid it.
  • CloudShell is free to use, but you pay for any resources you create with it.

What you need:

  • A separate AWS account used only for this course, never a work or production account.
  • AWS CLI version 2 on your computer, or AWS CloudShell in the browser, which already has the CLI installed.
  • An email address that you can open, for the budget alert.
  • An authenticator app, a passkey or a security key for MFA.

No-account path: Read the steps and the screens they describe, but run no commands. You can still check the cost rules in the root user and Budgets pages of the AWS documentation.

What you will build

The finished account has a root user with MFA and no access keys, an Identity Center user whose CLI commands run in a temporary role session under the sandbox profile, and a monthly budget that alerts you before the course’s labs can cost much. The diagram shows that result.

Your sandbox account after this labYou sign in to IAM Identity Center and the CLI uses a temporary role session in the sandbox account. The account has a monthly budget that sends alerts. The root user has MFA and no access keys, and is used only for account tasks.1 sign in2 role sessionaccount tasks only3 spend trackedYouConsole or CLIIAM IdentityCenterPermission setRoot userMFA, no keysSandboxaccountIdentity and callsMonthly budgetEmail alerts
Your sandbox account after this lab

Step 1: protect the root user with MFA

The root user is the sign-in you created with the account’s email address. It has full access to the account. AWS requires MFA for the root user in every account type, and you must register MFA within 35 days of your first sign-in if it is not already set up.

  1. Sign in to the console as the root user.
  2. Choose your account name at the top right, then choose Security credentials.
  3. In the Multi-factor authentication (MFA) section, choose Assign MFA device. Give the device a name. AWS recommends a passkey or security key, because they resist phishing better. An authenticator app works too.
  4. On the same page, look at the Access keys section. If the root user has any access keys, delete them.
  5. Sign out.

What you will see: the MFA section lists one device, and the root user’s access keys section is empty.

Watch out: Access keys for the root user can do anything in the account, and the course does not need them. If you find one you did not create, delete it at once.

Step 2: enable IAM Identity Center and create an everyday identity

Use the root user only for this step, then sign in with your Identity Center user from now on.

  1. Open the IAM Identity Center console and choose Enable. Choose the organization instance, which is the recommended option. If the account is not in an organization, AWS creates one with this account as its management account (see the cost note above). If the console asks for an instance configuration, choose Single-Region instance. An organization instance is what lets you create permission sets: AWS’s comparison of the two instance types lists multi-account permissions for it and not for an account instance.
  2. Under Users, add a user for yourself. Accept the invitation email, and set up MFA for this user when prompted.
  3. Create a permission set from the predefined AdministratorAccess policy. In a sandbox, broad rights let you build the labs. In a real account you would scope the permission set down to what each job needs.
  4. Assign your user to this account with that permission set.
  5. Copy the AWS access portal URL from the Identity Center dashboard. You need it in the next step.

What you will see: the sandbox account listed under AWS accounts with your permission set assigned.

Step 3: connect the CLI with the sandbox profile

Tip: The Solutions Architect – Associate course has a sandbox lab that also creates a profile named sandbox. If you did that lab in this same account, you already have the profile: check it with aws sts get-caller-identity --profile sandbox and skip the wizard. If this course uses a different account, give this profile another name, such as cloudops, and use that name wherever the labs say sandbox.

Run the wizard, and answer each prompt as shown:

aws configure sso
# SSO session name (Recommended): sandbox
# SSO start URL: <the AWS access portal URL from Step 2>
# SSO region: <the Region where you enabled Identity Center>
# SSO registration scopes: sso:account:access
# Then sign in in the browser, choose this account and AdministratorAccess,
# Default client Region: us-east-1
# CLI default output format: json
# Profile name: sandbox

Sign in and check who you are:

aws sso login --profile sandbox
export AWS_PROFILE=sandbox
export AWS_REGION=${AWS_REGION:-us-east-1}
aws sts get-caller-identity

What you will see: three fields, UserId, Account and Arn. The Arn names an assumed role whose name starts with AWSReservedSSO_, followed by the permission set name. IAM Identity Center creates those roles in each account when you assign a permission set. The credentials are temporary, so when a later command fails with an expired-credentials error, run aws sso login --profile sandbox again.

Step 4: check your identity in CloudShell

  1. Sign in to the console for the sandbox account, and choose the CloudShell icon on the navigation bar.
  2. Wait for the shell prompt, then run:
aws sts get-caller-identity

What you will see: the same Account and the same Arn as in Step 3. CloudShell uses the credentials of the console sign-in, so you do not configure a profile there. It is available at no additional charge, and it keeps up to 1 GB of files in your home folder for each Region.

Tip: If CloudShell shows a root user ARN, you signed in as the root user. Sign out, then sign in through the AWS access portal as your Identity Center user, and check again.

Step 5: create a budget with alerts

Set the variables for this step. Replace the placeholder address with your own:

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"   # replace with your address

Write the budget. The limit of 10 USD is an example; choose a monthly limit you are comfortable with:

cat > budget.json <<'EOF'
{
  "BudgetName": "cloudops-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 is more than 80% of the limit. The second fires when AWS forecasts that month-end spend will be more than 100% of it.

Confirm the email address. AWS sends a verification email to each new recipient, and it sends no budget notification to an address until that address is verified. Open the email from AWS and choose the link while you are signed in to this account. The link expires after 12 hours, and you can send a new one from the budget’s page. In the console, open Budgets in the Billing and Cost Management console, open your budget, and check that the recipient shows Active rather than Pending.

Watch out: If the Budgets page tells your role it has no access, the root user must activate IAM access to the Billing and Cost Management console. AWS lists that as one of the few tasks that require root. Sign in as root once to do it, then return to your Identity Center user.

Step 6: check the root user from the CLI

aws iam get-account-summary \
  --query 'SummaryMap.[AccountMFAEnabled,AccountAccessKeysPresent]' --output text

What you will see: two numbers separated by a tab. The first is AccountMFAEnabled, which should be 1, and the second is AccountAccessKeysPresent, which should be 0. If the second number is 1, return to Step 1 and delete the root access keys.

AWS’s GetAccountSummary reference lists both keys but does not define them. The AWS Security Blog describes AccountAccessKeysPresent as showing whether the root user has an access key (1 means one exists, even if it is inactive). For AccountMFAEnabled, the AWS Config managed rule root-account-mfa-enabled is the documented check that the root user has MFA, so treat this number as a quick confirmation and trust the Multi-factor authentication (MFA) section of the Security credentials page from Step 1 as the record.

Check your work

  • The root user has an MFA device registered and no access keys.
  • aws sts get-caller-identity with --profile sandbox shows an Arn with AWSReservedSSO_ in it.
  • The same account and Arn appear in CloudShell.
  • describe-budgets lists cloudops-sandbox-monthly with a limit of 10 USD (or the limit you chose).
  • The recipient address shows Active in the console, and you confirmed the verification email.
  • get-account-summary printed 1 and 0.

Clean up

This lab creates the account settings the rest of the course relies on, so keep them: the root MFA, the Identity Center user, the sandbox profile and the budget. Remove only the files you wrote on your computer:

rm -f budget.json notifications.json

If you are stopping the course here and want to remove the budget, run the command below. It deletes only the budget this lab created. Leave the root user’s MFA device in place.

aws budgets delete-budget --account-id "$ACCOUNT_ID" --budget-name cloudops-sandbox-monthly
aws sso logout

In CloudShell, you can also choose Actions and then Delete to remove its home folder. That is permanent, so do it only when you no longer need the files.

Exam tips

  • “Temporary credentials” or “no long-lived keys” point to IAM Identity Center or an IAM role session, not to access keys in a profile.
  • “Alert before the month’s spend exceeds the limit” points to a FORECASTED budget notification. “Alert once spend has happened” points to ACTUAL.
  • “Root user access keys” should be deleted, and the root user is used only for tasks that need it, such as closing the account.
  • “Alert email not arriving” can be a verification problem, not a budget problem. Check the recipient’s status first.
  • “Permission sets across accounts” require an organization instance of IAM Identity Center.
  • “Several accounts, one identity” points to Identity Center rather than a separate IAM user in each account.

Key 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 temporary role credentials, so nothing permanent is stored on your computer.
  • An assumed-role ARN with AWSReservedSSO_ in it is a role session from an Identity Center permission set, not an IAM user.
  • A budget sends no alert to an email address until that address has confirmed it, so check the verification status.
  • A FORECASTED alert warns about spend that is on course to exceed the limit, while an ACTUAL alert fires once spend has happened.

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.

  1. After you enable IAM Identity Center, a learner's aws sts get-caller-identity returns an assumed-role ARN with AWSReservedSSO_ in it. What does that tell you?
  2. The lab assigns a permission set to the sandbox account. Which kind of IAM Identity Center instance does that require?
  3. A learner wants an alert about spend that is on course to exceed the monthly limit, before the money has actually been spent. Which budget notification type does this?
  4. A learner creates the budget, and describe-budgets lists it, but no alert email arrives. What is the most likely cause?
  5. The learner runs aws iam get-account-summary and sees AccountAccessKeysPresent set to 1. What should they do?
  6. The learner opens CloudShell in the console. Which statement about its sign-in is correct?
  7. A learner's sandbox credentials expire overnight, and CLI commands start failing. What is the first step?
  8. The budget JSON sets Threshold to 80 with ThresholdType PERCENTAGE and ComparisonOperator GREATER_THAN. When does this notification fire?
  9. Why does the lab check the identity in CloudShell as well as with the CLI on your computer?
  10. The verification email for a budget recipient has expired. What should you do?

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.