Account and region
After this you can answer: What are an AWS account and a region, and why does MiniTickets use one of each?
Picture it
Section titled “Picture it”flowchart TB ACC["AWS account<br/>IAM, quotas, bill, budget"] --> REG["Region us-east-1"] REG --> AZ1["Availability zone 1"] REG --> AZ2["Availability zone 2"] REG -.-> G["Global: IAM, CloudFront"]A region holds several availability zones: separate data centres close to each other.
How it works
Section titled “How it works”- The account is the boundary. IAM users and roles, service quotas and billing all belong to one account. Nothing in another account can touch ours unless a policy says so.
- The region decides where things live. A VPC, a database or a queue exists in exactly one region. The console and the CLI show one region at a time.
- Some services are global. IAM and CloudFront are not tied to a region. CloudFront can only use certificates from us-east-1.
- Names come from the stack. Pulumi calls one environment a stack. The stack
devgivesminitickets-dev-*names,/minitickets/dev/*log groups andminitickets/dev/*secrets.
In MiniTickets
Section titled “In MiniTickets”The region is aws:region: us-east-1 in the committed infra/Pulumi.dev.yaml. Credentials never
live in that file: each terminal runs export AWS_PROFILE=ticketlite first. All names come from
infra/src/names.ts → namesFor.
A monthly budget, minitickets-dev-monthly-cost, has a 20 USD limit and emails at 25%, 50% and
100% of real spending, plus when AWS forecasts the month will pass 100%
(infra/src/budget.ts → createBudget).
| From → to | What happens | What allows it |
|---|---|---|
| Monthly cost budget → AWS account and region | watches the whole account's monthly cost |
|
See it in AWS
Section titled “See it in AWS”Top right: the account menu shows the account id; the region picker must say N. Virginia (us-east-1).
aws sts get-caller-identity prints the account id and the role you are using.
infra/src/names.ts → namesFor and the region in infra/Pulumi.dev.yaml.
Break it
Section titled “Break it”| Symptom | Cause | Where to look |
|---|---|---|
The console shows no minitickets-dev resources | The region picker is on another region | The region picker |
| The CLI shows another account or AccessDenied | AWS_PROFILE is not set in this terminal | aws sts get-caller-identity |
| The 50% budget email comes in week one | Everything stayed switched on | infra/Pulumi.dev.yaml switches |
Say it in an interview
Section titled “Say it in an interview”Follow-ups
Section titled “Follow-ups”Why not separate accounts for dev and prod?
Separate accounts give the strongest isolation: a mistake in dev cannot touch prod, and each has its own quotas and bill. MiniTickets has only dev today. Because every name comes from the stack, a second stack in a second account needs no code change.
What breaks if someone runs a command in the wrong region?
Nothing is found, so it looks as if everything was deleted. A create command would make a resource in the wrong region that nothing uses. Always check the region first.
Why us-east-1?
It has every service, and CloudFront’s certificates must come from us-east-1 anyway. The trade-off is distance: users far from the US east coast get a little more latency.
Advanced: Quotas and the budget
Service quotas are per account and per region, for example how many Lambda functions may run at
the same time. A brand-new account can start with lower quotas than the documented defaults;
MiniTickets met this with Lambda concurrency (see the casebook). The budget only warns: it never
stops anything. Turning resources off is done with the switches in infra/Pulumi.dev.yaml.
Checkpoint
Section titled “Checkpoint”Answer these without scrolling up. If one feels hard, reread that section.
- What three things belong to an AWS account?
- Which two services in this chapter are global?
- Where is the region of MiniTickets written down?
- How does a second stack avoid name collisions?
- What does the budget do, and what does it not do?
Redraw it from memory: the account, the region us-east-1 with two availability zones, and the global services beside it
Try this: run aws sts get-caller-identity with and without AWS_PROFILE=ticketlite and compare the Account field
Read this book online: https://book.theversehub.in/