Sub topic 3
Applying Least Privilege and Cost Controls
Assume you understand basic cloud concepts and can use a browser, the AWS CLI, and JSON files. Use a separate administrative identity for daily work. Reserve the root user for tasks that explicitly require it.
Applying least privilege from the start
Least privilege means giving an identity only the permissions it needs. An administrator identity may be necessary while creating an account, but do not use the root user for routine administration. Later, replace broad administrator permissions with smaller, task-specific policies and roles.
Confirm which identity your CLI uses:
aws sts get-caller-identityThis command returns the account and principal. Check that it is not the root user. In the console, enable billing access for the administrative identity if needed. Billing visibility is separate from ordinary service permissions, so grant only the billing and cost permissions required by your workflow.
Creating a monthly budget with alerts
Create budget.json:
{
"BudgetName": "monthly-cost-budget",
"BudgetLimit": { "Amount": "20", "Unit": "USD" },
"TimeUnit": "MONTHLY",
"BudgetType": "COST"
}Create notifications.json:
[
{
"Notification": {
"NotificationType": "ACTUAL",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 80,
"ThresholdType": "PERCENTAGE"
},
"Subscribers": [
{ "SubscriptionType": "EMAIL", "Address": "[email protected]" }
]
}
]Create the budget with your account ID:
aws budgets create-budget \
--account-id 111122223333 \
--budget file://budget.json \
--notifications-with-subscribers file://notifications.jsonConfirm the email subscription if AWS requests it.
A budget is an alert, not a spending cap
AWS Budgets reports or forecasts costs and sends notifications. It does not automatically prevent resource creation or terminate running resources. Use billing dashboards, service quotas, permissions, and cleanup routines alongside the budget.
Checking the baseline
The console should show root MFA enabled, no root access keys, billing visibility for the intended identity, and an active budget. The CLI can check the first two items:
aws iam get-account-summary \
--query 'SummaryMap.{RootMFA:AccountMFAEnabled,RootAccessKeys:AccountAccessKeysPresent}'Next step: multiple accounts
AWS Organizations groups accounts under centralized management. Separate production, development, and security workloads when isolation, billing, or access control requires it.
Exercise
What does an 80 percent budget alert guarantee?
Show answer
It guarantees only that AWS sends a notification when the configured condition is met; it does not cap spending.