All articles

AWS Province Primer

A working primer on the AWS stack behind a governed AI-agent deployment — IAM as inverted Unix permissions, Bedrock AgentCore, Lambda, S3, and a verified cost model — mapped to Linux and systemd concepts.

Topics: Data, Cloud & Platforms · AI Agents & Orchestration

1 · The mental model

An AWS account is a machine you don't own

Think of your AWS account as one big remote box: it has a filesystem (S3), a way to run code on demand (Lambda), a process supervisor (the managed runtimes), logs (CloudWatch), and a permission system (IAM). Two differences from your Linux box change everything downstream:

  • Everything is an API call. There is no shell at the bottom — creating a bucket, invoking a function, reading a log are all authenticated HTTPS calls. The console website and the aws CLI are both just clients for the same API.
  • Everything has a name (ARN) and a bill. Every resource gets an Amazon Resource Name like arn:aws:s3:::leebase-evidence/runs/*, and every action is either free-tier or metered. The province design's rule — nothing bills while idle — is enforced by only using services that scale to zero.

Regions: you pick one (us-east-1) and everything lives there. Resources in different regions can't see each other by default — for the province this is a feature: one region, one stack, no accidental sprawl.

2 · IAM — the part worth 40% of your attention

Identity is Unix permissions, inverted

On Linux, a process inherits the permissions of the user who started it. In AWS, nothing has permissions until a policy grants them — deny by default, everywhere. Four words carry the whole system:

  • Principal — who is acting: you (an IAM user/identity), or a service (a Lambda function, an AgentCore runtime).
  • Policy — a JSON document of allow statements: this action, on this resource. Like a sudoers file, but per-API-call and per-ARN.
  • Role — a wearable identity: a bundle of policies that a principal assumes. Your closest analog is a service account. Services don't have passwords; they wear roles.
  • Trust policy — the half people miss: each role also declares who is allowed to wear it. A role is two documents: who may assume it, and what it may do.
Lee (IAM identity) Lambda: run-employee wears the role below Execution role trust: only lambda.amazonaws.com may assume this role S3 evidence prefix s3:PutObject on runs/* only AgentCore runtime bedrock-agentcore:Invoke… Everything else implicitly denied HTTPS, SigV4-signed assumes allowed allowed no statement = denied
The province's whole security model: one role, two allow statements, everything else denied by omission. There is no root to escalate to.

SigV4 is how a human or program proves identity on a raw HTTPS call: every request is cryptographically signed with your access key. You'll never implement it — the aws CLI and SDKs do it — but "IAM-authenticated function URL" means "only correctly signed requests get in," which is how the gate's approve endpoint knows it's you.

Debugging rule: the AWS error you will see most is AccessDenied. It is almost never a bug — it is the deny-by-default doing its job. Read it as: which principal, attempting which action, on which ARN? Then find the missing allow statement. This replaces an entire genre of Linux permission archaeology.
3 · The building blocks

Six services, each mapped to something you run

AWSYour analogWhat the province uses it for
S3A remote filesystem-shaped object storeThe evidence tree, runs/-shaped, exactly like local. Objects are immutable-by-replacement; later, Object Lock makes them immutable outright (Phase 3). Read it with aws s3 sync + cat.
LambdaA socket-activated systemd unit, billed per 100msThe three gate functions. Zero processes when idle, cold-starts in ~100–300ms on demand. The always-free tier (1M requests/mo) swallows portfolio volume ~7,000× over.
ECRA private Docker registryHolds the one container image the AgentCore runtime runs. Build locally, docker push, done — script it as one make target.
AgentCore RuntimeYour bwrap sandbox, upgradedRuns the agent loop in a Firecracker microVM per session — hardware-level isolation, destroyed and memory-sanitized after each session. Notably: it has the network isolation your bwrap setup documents as not-built. This is an honest security upgrade over the Factory local tier.
CloudWatchjournald + a metrics daemonEvery Lambda print statement lands here automatically. Free tier covers the province; you'll mostly read it via aws logs tail --follow.
SSM Parameter StoreA config directory with IAM on itThe few config values (bucket name, runtime ARN, model rates). Free at standard tier. Secrets Manager exists for real secrets but the province barely needs one.
The AgentCore family, one line each — Runtime (the microVM executor — what we use), Gateway (managed MCP tool proxy — later, if tools multiply), Memory (managed agent memory — skip; evidence is canonical), Identity (OAuth for tools — later), Browser / Code Interpreter (managed sandboxes — not needed), Harness (managed agent loop — public preview at review time; use Runtime + your own loop for anything client-facing). Every component bills per use, none while idle — verified against AWS pricing pages, 2026-08-26.
4 · How a governed run flows

The run lifecycle, end to end

Owner / cron start a run run-employee λ ticket.authorizes() rung · bounds · $ budget AgentCore Runtime agent loop in a microVM destroyed after session S3 evidence tree chain.jsonl + artifacts genesis → … → seal approve λ (paused) packet bound to run_id refused if ticket doesn't authorize invoke (SigV4) artifacts, hashed usage → USD; hard stop on budget breach; every stop is a chain entry requires_approval → halt for Lee
Same governance semantics as a local Factory run — only the executor changed. The seal step runs the hire ticket's deterministic verifiability test before the chain closes.

The invariant you'll demo: employee-contract verify s3://… passes on the same tree layout as local — and corrupting one artifact byte fails at the right entry. Evidence semantics survive the substrate change; that's the whole thesis in one command.

5 · What it costs

Why AWS went first

AWS (AgentCore + Nova Micro) Azure (Foundry + GPT-4o-mini) GCP (Agent Engine + Gemini Flash)
$0$5$10$15$20 AWSAzureGCP ~$0.42 ~$1.98 ~$17.14 Verified monthly cost at portfolio volume (5 runs/day, 50k tokens/run) — the $50 ceiling sits far off-chart right
Live-verified 2026-08-26 against vendor pricing pages. Model tokens dominate every province; the platforms themselves are effectively free at this volume.

Where the AWS cents actually go

Nova Micro tokens AgentCore Runtime (active s) Lambda · S3 · CloudWatch SSM Parameter Store $0.42 — the dominant cost ~$0.0x, active seconds only $0 — inside always-free tiers $0 — free at standard tier Design rule made visible: nothing in the province has an hourly meter. Cost scales with use, floor is ~zero.
The foot-guns the design avoids never appear on this chart: no NAT Gateway (~$32/mo), no ALB (~$16/mo), no always-on endpoints — the classic "why is my hobby account $50/mo" items.
6 · Sharp edges

The five things that actually bite newcomers

  1. Idle-billing services. The province uses none, but the moment anyone suggests a NAT Gateway, an Application Load Balancer, or a provisioned database, the $0-idle property dies. The design's answer to "should we add X?" starts with "does X have an hourly meter?"
  2. IAM wildcards. "Resource": "*" works and is how tutorials go fast. The province's roles name exact ARNs and prefixes — slower once, safe forever. Hold any AI-generated infrastructure to that standard in review.
  3. Region drift. A resource created in the wrong region "disappears" (it's just in the other region). One region, set in the deploy script, checked in the make target.
  4. Credential hygiene. Long-lived access keys in dotfiles are the AWS equivalent of passwords in shell history. Use aws configure sso or short-lived keys; the Lambda and Runtime never hold keys at all — they wear roles.
  5. The bill lags. Cost Explorer runs ~24h behind. Check it the day after the first governed runs — make the day-after check part of your definition of done — and set a $10 billing alarm on day one — it's free and turns surprise into email.
7 · Your working vocabulary

Enough terms to supervise any AWS conversation

TermMeaning in one line
ARNThe absolute path of any resource: arn:aws:service:region:account:name.
PrincipalWhoever is making the API call — a person or a service wearing a role.
Execution roleThe role a Lambda/Runtime wears while running; its only source of permissions.
Trust policyThe half of a role that says who may wear it.
SigV4The request-signing scheme; "IAM-authenticated" means "SigV4-signed by an allowed principal."
Function URLA plain HTTPS endpoint on a Lambda — the gate's front door, IAM-auth mode, no API Gateway needed.
Firecracker microVMThe lightweight VM AgentCore boots per session — stronger isolation than a container, destroyed after use.
Object LockS3's write-once mode; Phase 3 turns the evidence bucket into storage the operator cannot rewrite.
Cost ExplorerThe billing dashboard; check it the day after any new deployment.
CloudFormation / TerraformInfrastructure-as-code; the province ships as one small stack so a client can audit and delete it wholesale.