Runbook: deploy on your AWS and run Matsiems as client #1
Everything runs in eu-west-2 (London): API, sandboxes, Postgres, S3, KMS, SES and Bedrock. Expect about £45–60 a month idle (ALB ~£16, RDS t4g.micro ~£13, one 0.5 vCPU Fargate task ~£12, KMS/Secrets/logs a few pounds), plus about 4p per sandbox-hour and Bedrock tokens.
0. One-off AWS setup (console, 15 minutes)
- Bedrock model access, eu-west-2: request access to Claude Opus 5.5 (and Claude Sonnet 5). Check the model card says in-Region for London; never enable
eu.orglobal.profiles for this account. - Domain and certificate: pick the host, for example
agents.matsiems.com. In ACM (eu-west-2) request a certificate for it and validate by DNS. - SES, eu-west-2: the stack creates the domain identity. Add the DKIM records it shows. Ask AWS to move SES out of the sandbox (Account dashboard → Request production access); until then you can only email verified addresses, which is fine for the first run to yourself.
- Optional, recommended later: an SCP on the account that denies
bedrock:*outside eu-west-2 and oninference-profile/*. The stack already denies both on the task role.
1. Deploy (your laptop, needs Docker and AWS credentials)
cd infra && npm ci
npx cdk bootstrap aws://<ACCOUNT_ID>/eu-west-2
npx cdk deploy \
-c domain=agents.matsiems.com \
-c certificateArn=arn:aws:acm:eu-west-2:<ACCOUNT_ID>:certificate/<ID> \
-c mailFrom=agents@matsiems.com \
-c operatorEmails=mat@matsiems.com \
-c apiInstances=2
operatorEmails opens the operator console at /admin for those sign-ins. apiInstances=2 (about £12 a month more) lets deploys roll without interrupting live sessions.
EU region (when a client needs it): the same code, a second stack. For example Dublin: npx cdk bootstrap aws://<ACCOUNT_ID>/eu-west-1, then npx cdk deploy -c homeRegion=eu-dublin -c domain=eu.agents.matsiems.com -c certificateArn=<eu-west-1 cert> -c mailFrom=agents@matsiems.com. It creates MaaEuDublin with its own database, keys and bucket in eu-west-1; nothing is shared with London. Enable Bedrock model access in that region first.
Then:
- Point
agents.matsiems.com(CNAME) at theAlbDnsoutput. - Open the
AppSecretsArnsecret in Secrets Manager and fill inSTRIPE_SECRET_KEY,STRIPE_WEBHOOK_SECRETand (optional)BRAVE_API_KEY. LeaveSESSION_SECRETas generated. Restart the service (aws ecs update-service --force-new-deployment ...). - In Stripe: add a webhook to
https://agents.matsiems.com/webhooks/stripeforcheckout.session.completed. Use test mode keys first.
With no Stripe key set, the portal takes test payments with a "Pay (test)" button. Don't leave it like that in production.
2. Run Matsiems as client #1
- Open
https://agents.matsiems.com, sign in with your email (magic link). - New company analysis: Matsiems Ltd, https://matsiems.com, 1 hour. Pay (£25: £5 runtime + £20 token allowance).
- Watch it live on the order page. It researches, keeps notes, writes
report.md, a grader checks it against the rubric (up to 2 rounds), then:- email 1: the report (markdown + HTML attached);
- everything is deleted: sandbox task stopped and wiped, events, transcript and outputs deleted, session key destroyed;
- email 2: the signed certificate of deletion (HTML + JSON). Anyone can check it at
/v1/certificates/<id>/verify.
3. Local development
npm ci
npm run dev # http://localhost:8787, mock model, local sandbox, emails to .data/outbox
npm test # unit tests: cron, leases, invoices, webhook signatures, egress proxy
npm run e2e # 22 + 40 checks: SDK compatibility, first-client flow, webhooks,
# multi-agent, MCP OAuth, Cloud billing, Managed engagements
npm run check # typecheck + tests + e2e (what CI runs)
MODEL_PROVIDER=bedrock with AWS credentials uses real Bedrock in eu-west-2 from your laptop (sandbox stays local).
4. Operations
- Several instances can run. Each live session is owned by one instance through a database lease (renewed every 10 s, expires after 30 s). If an instance stops, another adopts its sessions within about 30 s: it reloads the transcript, reconnects to the sandbox and handles queued events. A tool call that was half-way through when the instance died is lost; the agent sees the next event.
- Scheduled jobs (deployments, webhook retries, housekeeping) take a short lease per tick, so they fire once however many instances run.
- Egress proxy (port 3128 on every API instance,
api.maa.internalinside the VPC): sandboxes send all HTTP(S) through it. It enforces the environment's host policy and swaps vault placeholders for secrets only for each credential'sallowed_hosts. Grants live in the database, so any instance can serve any sandbox. - Webhooks: failed deliveries retry 8 times with backoff (30 s doubling, max 6 h).
GET /v1/webhooks/{id}/deliveriesand the console's Trust page show the state. - Logs hold errors and ids only, never session content. App logs are kept for 30 days and sandbox logs for 1 day.
- Postgres backups (7 days) hold only ciphertext for session data, and destroying a session's key makes those backup copies unreadable too.
- Certificates and the transparency log are kept indefinitely, and contain no session content.
5. Selling both solutions
- Cloud clients sign up themselves (magic link), create an API key, then top up credit or buy a dedicated plan on
/portal/billing. SetBILLING_ENFORCE=onin the task environment once Stripe is live: sessions then need credit or a plan, and the plan's concurrency limit applies. Every payment issues a VAT invoice (VAT_RATE, default 0.2; setCOMPANY_VAT_NUMBER). - Managed clients: in
/admin/engagementscreate a Diagnostic, Sprint, Co-build or Run for the client's email and tick "email the client". They accept and pay on their portal; payment provisions a workspace (lead agent + limited-network environment) in their own account. Log your days on the engagement: the console shows the effective day rate against the £1,000 a day founder cost. - In Stripe, the same webhook (
checkout.session.completed) covers hourly runs, credit, plans and engagements.
6. Before taking money from other clients
- A data-protection lawyer should review the certificate wording, the DPA and the sub-processor list (AWS for hosting and Bedrock, Stripe for payments, Brave or DuckDuckGo for web search).
- Professional indemnity cover that includes the deletion certificate.
- Move Stripe to live keys and SES to production.