Set a budget alert first, then map the global infrastructure you can deploy to

short · 25 min · Task statement 1.1

Task

Before anything else, set an AWS Budgets alert that emails you the moment this account starts to cost money, and confirm AWS has stored it. Then use read-only calls to see the global infrastructure from lesson 1 for yourself: how many Regions your account can deploy to today, which further Regions it could opt in to, and how many Availability Zones sit inside your Region and inside one on the other side of the world. Finally, match six short scenarios to the benefit each one describes: elasticity, high availability, agility, going global, no longer running data centres, and economies of scale. The budget stays in place when you finish, because every later lab in this course relies on it.

Steps

  1. Create the budget alert with AWS Budgets, before you do anything else. Print your account ID, then write the budget and its two notifications, and create it. The budget has a monthly cost limit of 1.00 USD. The first notification emails you when actual spend passes 1 percent of that limit, which is the first cent; the second emails you when AWS forecasts that the month will pass the whole limit.
aws sts get-caller-identity --query Account --output text
cat > clf-lab01-budget.json << 'EOF'
{
  "BudgetName": "clf-zero-spend-budget",
  "BudgetLimit": {"Amount": "1.00", "Unit": "USD"},
  "TimeUnit": "MONTHLY",
  "BudgetType": "COST"
}
EOF
cat > clf-lab01-notify.json << 'EOF'
[
  {"Notification": {"NotificationType": "ACTUAL", "ComparisonOperator": "GREATER_THAN", "Threshold": 1, "ThresholdType": "PERCENTAGE"},
   "Subscribers": [{"SubscriptionType": "EMAIL", "Address": "you@example.com"}]},
  {"Notification": {"NotificationType": "FORECASTED", "ComparisonOperator": "GREATER_THAN", "Threshold": 100, "ThresholdType": "PERCENTAGE"},
   "Subscribers": [{"SubscriptionType": "EMAIL", "Address": "you@example.com"}]}
]
EOF
aws budgets create-budget --account-id 111122223333 --budget file://clf-lab01-budget.json --notifications-with-subscribers file://clf-lab01-notify.json

Put your own email address in place of you@example.com in both places, and your own account ID in place of 111122223333. A successful create prints nothing. 2. Read the budget back where you will see it later. Open the Billing and Cost Management console and choose Budgets. The list shows clf-zero-spend-budget with a budgeted amount of 1.00 USD. This alert is how the variable cost from lesson 1 stays visible: you pay only for what you use, so you need to know when you have started to use something. 3. See how far you can reach without buying hardware. Count the Regions your account can deploy to now, then list the Regions it could opt in to:

aws ec2 describe-regions --query 'length(Regions)' --output text
aws ec2 describe-regions --all-regions --query "Regions[?OptInStatus=='not-opted-in'].RegionName" --output text

Each Region in the first count is somewhere you could deploy in minutes. That is "go global in minutes": no contract, staff or building is needed there. 4. Look inside your own Region. List its Availability Zones:

aws ec2 describe-availability-zones --query 'AvailabilityZones[].[ZoneName,State]' --output table

Count the rows. A workload with servers in only one of these zones has a single point of failure; spreading it across two or more is what high availability means in lesson 1. 5. Look at a Region on the other side of the world. Asia Pacific (Sydney) is enabled for every account:

aws ec2 describe-availability-zones --region ap-southeast-2 --query 'AvailabilityZones[].ZoneName' --output text

In lesson 1, a European company whose Australian customers saw slow pages fixed it by deploying in a Region close to Australia. You have just read that Region's zones from the same browser tab, which is the whole point: the infrastructure is already there. 6. Match each scenario to the one benefit it describes, then check your answers in the Notes. (a) A ticketing site adds servers for the hour when tickets go on sale and releases them afterwards. (b) Web servers in two Availability Zones keep serving when one zone fails. (c) Test environments that took weeks to arrive now take minutes. (d) A company serves customers on a new continent within days. (e) Staff no longer replace failed disks or manage cooling. (f) A small firm pays the same low prices as a very large one because AWS combines the usage of many customers.

Verify

Read the budget back, and count its notifications. Put your own account ID in place of 111122223333.

aws budgets describe-budgets --account-id 111122223333 --query "length(Budgets[?BudgetName=='clf-zero-spend-budget'])" --output text

Expected output: 1.

aws budgets describe-notifications-for-budget --account-id 111122223333 --budget-name clf-zero-spend-budget --query 'length(Notifications)' --output text

Expected output: 2.

Cost and clean-up

AWS Budgets can charge for budgets beyond a small number per account; the AWS Budgets pricing page has the current terms. The Region and Availability Zone calls are read-only.

Created by this lab: the file clf-lab01-budget.json in your CloudShell home directory; the file clf-lab01-notify.json in your CloudShell home directory.

Kept on purpose: the AWS Budgets alert clf-zero-spend-budget, kept on purpose because every later lab in this course relies on it.

  1. Keep the budget clf-zero-spend-budget. Every later lab in this course relies on it, so it stays on purpose.
  2. Remove the two JSON files, which hold your email address:
rm clf-lab01-budget.json clf-lab01-notify.json

Check it is gone

The budget is still there, on purpose, and the two files are gone.

aws budgets describe-budgets --account-id 111122223333 --query "length(Budgets[?BudgetName=='clf-zero-spend-budget'])" --output text
ls clf-lab01-budget.json clf-lab01-notify.json

Expected output: 1 from the first command, then No such file or directory for each file from the second.

Notes

Answers to step 6: (a) elasticity, and stop guessing capacity; (b) high availability; (c) agility; (d) go global in minutes; (e) stop spending money running and maintaining data centres; (f) economies of scale.

AWS Budgets checks spending several times a day, not instantly, so an alert can arrive some hours after the spending that caused it. That is one more reason to clean up each lab the same day. Email notifications from a budget go straight to the address you gave; there is nothing to confirm.

This is an independent study companion for the AWS Certified Cloud Practitioner (CLF-C02) exam and is not produced by or endorsed by Amazon Web Services. AWS, Amazon Web Services and AWS Certified Cloud Practitioner are trademarks of Amazon.com, Inc. or its affiliates.

This is an independent study companion for AWS Certified Cloud Practitioner CLF-C02 and is not produced by or endorsed by CompTIA.