← Back to dashboard

AWS Integration Guide

What is AWS?

The real model

SDK v3 (@aws-sdk/* 3.1153) + CDK v2 (aws-cdk-lib 2.273), credentials via awsCredentialsProvider({ roleArn, audience }).

On Vercel, @vercel/oidc-aws-credentials-provider exchanges the Vercel OIDC token through sts:AssumeRoleWithWebIdentity. Pin AWS_REGION yourself, because Vercel sets it to the function's execution region. Target nodejs24.x on Lambda: nodejs20.x was deprecated 2026-04-30, nodejs26.x is preview only, and CDK's NODEJS_LATEST maps to 24. Lambda Web Functions (Oct 2026) run Express/Hono/Next directly with per-environment concurrency. Prices: S3 $0.023/GB-mo, Aurora SLv2 $0.12/ACU-hr, Lambda $0.0000166667/GB-s in us-east-1, about 20–35% more in af-south-1 (an opt-in region). New SES accounts start on the Essentials plan at $0.16 per 1k emails. PHI needs a signed BAA in AWS Artifact first.

Five AWS building blocks

Enterprise tier only: reach for these when a house default can't meet the contract.

Text
 █████╗ ██╗    ██╗███████╗
██╔══██╗██║    ██║██╔════╝
███████║██║ █╗ ██║███████╗
██╔══██║██║███╗██║╚════██║
██║  ██║╚███╔███╔╝███████║
╚═╝  ╚═╝ ╚══╝╚══╝ ╚══════╝

AWS Integration Guide

Focus: When and how codeAmani uses Amazon Web Services for Enterprise-tier client builds. Covers keyless auth (Vercel/GitHub OIDC, IAM Identity Center, aws login), S3 and presigned URLs, RDS and Aurora Serverless v2, Lambda (Event and Web Functions), API Gateway, ECS Fargate, CloudFront, SES, IaC with the AWS CDK in TypeScript, a HIPAA baseline for the Florida healthcare niche, and af-south-1 for Kenya-targeted data residency.

Overview

motionstackstudios.com lists AWS as infrastructure, and it hosts the agency's Enterprise segment: $50K+ engagements, including a HIPAA-compliant healthcare platform for an APD/AHCA/DCF-licensed provider. Of the house hosting guides (vercel, netlify, cloudflare, render, google-cloud), it's the heavyweight option. It complements them and doesn't replace them.

The house defaults stay the same for almost everything: Neon for Postgres, Cloudflare R2 for object storage, Resend for email, Vercel for app hosting. AWS earns a place only when an enterprise client's contract demands something a default can't give: a signed BAA, data residency in a specific Region, a private VPC, VPC-peered databases, or scale/SLA guarantees.

Check first. Before adding any AWS service, query the codeAmani-tech-stack MCP (search_guides / get_guide) and confirm a house default won't satisfy the requirement. AWS adds operational surface, cost, and compliance obligations. Prefer the default unless the client specifically requires AWS.

Current versions (verified 2026-10-20)

ComponentVersionNote
AWS SDK for JavaScriptv3: @aws-sdk/* 3.1153.0Modular per-service clients; Node ≥ 20 (engines)
@vercel/oidc-aws-credentials-provider3.3.13Vercel OIDC → STS credentials
AWS CDKv2: aws-cdk-lib 2.273.0, CLI aws-cdk 2.1146.0, constructs 10.8.1CLI and library version independently
AWS CLIv2: 2.38.xaws login needs ≥ 2.32.0
boto3 (Python)1.43.115Python ≥ 3.10
aws-actions/configure-aws-credentialsv6.3.0GitHub OIDC

Official Documentation

AWS MCP servers. AWS ships the open-source awslabs/mcp collection and AWS-managed remote endpoints. One is the read-only AWS Knowledge MCP Server (https://knowledge-mcp.global.api.aws, no auth), which serves live docs, regional availability, and API references. Others can drive an account, such as the AWS API MCP Server. None is in the house .mcp.json by default. The Knowledge server is a safe read-only companion. Anything that mutates a client account still goes through the AWS CLI v2, the v3 SDK, and CDK under the [CA] Cloud Architect gate. If you enable a write-capable AWS-managed server, it injects the aws:ViaAWSMCPService / aws:CalledViaAWSMCP IAM context keys. That lets least-privilege policies tell agent-driven calls apart from human ones.


Accounts & auth: no static keys

Every enterprise client gets an isolated AWS account, ideally under an AWS Organizations management account, so blast radius, billing, and the HIPAA BAA stay scoped per engagement.

Who is callingHow it authenticatesStatic keys?
A human, org accountIAM Identity Center (aws configure sso → aws sso login)No
A human, solo/new accountaws login (CLI ≥ 2.32.0): console sign-in → short-lived, auto-rotated CLI/SDK credsNo
Vercel function (Next.js)Vercel OIDC → sts:AssumeRoleWithWebIdentity via @vercel/oidc-aws-credentials-providerNo
GitHub ActionsGitHub OIDC via aws-actions/configure-aws-credentials@v6No
Lambda / ECS / EC2Execution role / task role / instance profileNo
A host with no OIDC (rare)Scoped IAM user key, one bucket/action, rotatedLast resort
  • No root access keys, ever. Give the root user MFA, then lock it away.
  • Least privilege: start from deny and grant specific actions on specific ARNs. Never "Action": "*" on "Resource": "*".
  • Trust policies: pin aud and sub exactly. Never wildcard the repo or project part of sub. Copy-paste policies are in reference/iam-trust-policies.md.

Vercel → AWS with OIDC (the default for Vercel-hosted apps)

This replaces the old "scoped AWS_ACCESS_KEY_ID in Vercel env vars" pattern. Enable OIDC on the Vercel project (Team issuer mode). Add an IAM OIDC identity provider with URL https://oidc.vercel.com/<team-slug> and audience https://vercel.com/<team-slug>, plus sts.amazonaws.com if you pass that audience. Then create a role whose trust policy pins sub to owner:<team>:project:<project>:environment:production.

TypeScript
// lib/aws.ts (server-only)
import "server-only";
import { S3Client } from "@aws-sdk/client-s3";
import { awsCredentialsProvider } from "@vercel/oidc-aws-credentials-provider";

export const s3 = new S3Client({
  region: process.env.AWS_REGION!, // PIN this in Vercel env vars (see below)
  credentials: awsCredentialsProvider({
    roleArn: process.env.AWS_ROLE_ARN!,
    audience: "sts.amazonaws.com", // must match the provider + trust policy `aud`
  }),
});

Gotcha: AWS_REGION on Vercel. Vercel sets AWS_REGION to the function's execution Region. With multi-region routing or failover, that value changes and your SDK calls go to a Region where your bucket doesn't exist. Always set AWS_REGION explicitly in the Vercel project.

Secrets Manager

App secrets such as DB credentials and third-party API keys live in AWS Secrets Manager when the build runs on AWS end-to-end. It integrates with RDS rotation and IAM. Secrets Manager is the AWS-native analogue of the house infisical / Hazina setup. When the app is Vercel-hosted, Vercel env vars or Infisical stay the default, and AWS holds only infrastructure secrets. Pricing is $0.40 per secret per month plus $0.05 per 10,000 API calls, so cache reads:

TypeScript
// lib/aws/secrets.ts
import { SecretsManagerClient, GetSecretValueCommand } from "@aws-sdk/client-secrets-manager";

const client = new SecretsManagerClient({ region: process.env.AWS_REGION });
const cache = new Map<string, { value: unknown; expires: number }>();

export async function getSecret<T>(secretId: string, parse: (raw: unknown) => T): Promise<T> {
  const hit = cache.get(secretId);
  if (hit && hit.expires > Date.now()) return parse(hit.value);
  const res = await client.send(new GetSecretValueCommand({ SecretId: secretId }));
  if (!res.SecretString) throw new Error(`Secret ${secretId} has no string value`);
  const value: unknown = JSON.parse(res.SecretString);
  cache.set(secretId, { value, expires: Date.now() + 5 * 60_000 });
  return parse(value); // validate the shape; don't cast
}

Full version with a typed parser: examples/secrets.ts.


S3 & presigned URLs

S3 is the AWS object store. Cloudflare R2 is the house default (zero egress fees, S3-compatible API), and most builds never leave R2. An enterprise or HIPAA client may still require S3 specifically: BAA coverage, Object Lock for WORM retention, SSE-KMS with a customer-managed key, or VPC-gated access. R2 speaks the S3 API, so the v3 @aws-sdk/client-s3 code below works against both. Only the endpoint and credentials change.

Client uploads use a presigned URL. The browser uploads directly to S3, the server never proxies the bytes, and the URL expires. For PHI, the bucket is private with SSE-KMS, and the presigned PUT carries the encryption header.

TypeScript
// lib/aws/s3-presign.ts
import { PutObjectCommand, GetObjectCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import { s3 } from "@/lib/aws";

const BUCKET = process.env.S3_BUCKET!;

/** Presigned PUT for a direct browser upload (PHI: SSE-KMS enforced). */
export async function presignUpload(key: string, contentType: string): Promise<string> {
  const cmd = new PutObjectCommand({
    Bucket: BUCKET,
    Key: key, // build the key server-side; never trust a client-supplied key
    ContentType: contentType,
    ServerSideEncryption: "aws:kms",
    SSEKMSKeyId: process.env.S3_KMS_KEY_ID, // customer-managed key for healthcare
  });
  return getSignedUrl(s3, cmd, { expiresIn: 300 }); // 5 minutes
}

/** Presigned GET for a time-boxed download (e.g. an intake PDF). */
export async function presignDownload(key: string): Promise<string> {
  return getSignedUrl(s3, new GetObjectCommand({ Bucket: BUCKET, Key: key }), { expiresIn: 60 });
}

Gotcha: a presigned PUT only succeeds if the request matches the signed parameters exactly. If you sign ServerSideEncryption: "aws:kms", the browser's PUT must send the x-amz-server-side-encryption: aws:kms header, or S3 returns 403 SignatureDoesNotMatch. Sign exactly the headers the client will send, no more. A runnable Next.js Route Handler is in examples/vercel-oidc/. The boto3 version is in examples/python/presign_boto3.py.

Price: S3 Standard is $0.023/GB-month in us-east-1 and $0.0274 in af-south-1 (first 50 TB).


Databases: RDS & Aurora Serverless v2

Neon is the house default Postgres. It's serverless, branches per PR, and is already wired into the neon guide and the app's Drizzle setup. Stay on Neon unless an enterprise client needs something Neon can't offer: a signed BAA, a private VPC with no public endpoint, VPC peering to other AWS resources, or a specific data-residency Region.

When AWS is required, prefer Aurora Serverless v2 (PostgreSQL-compatible) over plain RDS for most workloads. It autoscales ACUs with load and can scale down to 0 ACUs when idle, which mirrors Neon's serverless economics while living inside the client's VPC. Compute costs $0.12/ACU-hour in us-east-1 (Aurora Standard; $0.156 on I/O-Optimized) and $0.16/ACU-hour in af-south-1. Reach for provisioned RDS only when a steady instance class is cheaper or a feature requires it.

ConcernHouse default (Neon)AWS (Aurora Serverless v2 / RDS)
ProvisioningInstant, in-console/MCPCDK/Terraform into a VPC
ScalingServerless autoscaleAurora SLv2 ACUs / RDS instance class
BranchingPer-PR DB branchesSnapshots/clones (heavier)
ConnectionPooled HTTP/WebSocket driverStandard pg over VPC; RDS Proxy for Lambda; IAM auth tokens via @aws-sdk/rds-signer
HIPAA BAAVia Neon's termsCovered under the AWS BAA (Aurora/RDS are HIPAA-eligible)
EncryptionTLS + at-restTLS + KMS at-rest (required for PHI)

Drizzle still drives it. Point the connection string at the Aurora writer endpoint, sourced from Secrets Manager, or use short-lived IAM auth tokens from @aws-sdk/rds-signer, which also works from Vercel via OIDC. For Lambda, put RDS Proxy in front so cold-start storms don't exhaust connections.


Compute: Lambda, API Gateway & ECS Fargate

  • Lambda Event Functions (the docs' new name for classic Lambda functions) + API Gateway handle event-driven and bursty work: webhook receivers, scheduled jobs, S3-triggered processing, a thin API. Pair with RDS Proxy for database access. Cheapest at low or spiky volume: $0.20 per 1M requests plus $0.0000166667/GB-s on x86 in us-east-1, with a monthly free tier of 1M requests and 400,000 GB-s.
  • Lambda Web Functions (new, launched October 2026) run an HTTP server (Express, Hono, Fastify, Next.js standalone) directly, with no adapter. One warm environment serves many concurrent requests, and billing covers active CPU plus memory, not idle CPU. Only nodejs24.x is supported, in select Regions, and CloudFront can front it with OAC. It's worth evaluating for VPC-resident Node APIs. Confirm HIPAA eligibility and Region availability before using it for PHI.
  • ECS on Fargate runs long-running or containerized services that don't fit Lambda's limits (15-minute max, payload caps). This is where the docker guide pays off: the image you build for local dev runs on Fargate. Use it for steady traffic, WebSocket servers, or a healthcare platform that must run inside a VPC alongside Aurora.

Runtimes (Event Functions): nodejs24.x is the target (deprecation 2028-04-30) and is what CDK's Runtime.NODEJS_LATEST resolves to in aws-cdk-lib 2.273.0. nodejs22.x is supported until 2027-04-30. nodejs20.x was deprecated on 2026-04-30; migrate any function still on it. nodejs26.x is in public preview: no SLA, not for production, and no CDK constant yet. Amazon Linux 2 reached end of life on 2026-06-30. On Fargate, pin the base image to Node.js 24 LTS.

Every compute shape runs with a scoped task/execution role (no embedded keys) and reads secrets from Secrets Manager at start. A typical healthcare platform: CloudFront → ALB → Fargate service (private subnets) → Aurora Serverless v2 (isolated subnets) → S3 for documents.


CloudFront & SES

  • CloudFront is the CDN/edge layer in front of S3, the ALB, and Lambda Web Functions. It handles TLS termination and caching, and it's where WAF attaches. For PHI, keep the bucket private and serve through CloudFront with Origin Access Control (OAC) so objects are never publicly reachable. CloudFront has African edge locations in Nairobi, Lagos, Cairo, Johannesburg, and Cape Town. For Vercel-hosted marketing sites, Vercel's own edge stays the default.
  • SES is the AWS-native transactional email service. Resend is the house default and stays so for nearly everything. Use SES only when an enterprise client needs email to originate inside their AWS account, very high volume at AWS pricing, or BAA-covered email. Pricing changed: from 2026-07-21, new SES accounts (and account-Region pairs with no metered use since 2025-06-01) start on the Essentials plan at $0.16 per 1,000 emails (Pro $0.22, Enterprise $0.23, first 10M/month). Older accounts keep the à la carte $0.10 per 1,000. To launch, verify the domain (DKIM/SPF/DMARC), then request production access to leave the SES sandbox.

Regions: us-east-1 by default, af-south-1 for Kenya-resident data

codeAmani is US-first, so client accounts default to us-east-1. For a Kenya-targeted project whose contract or KDPA 2019 analysis calls for in-Africa data residency, use af-south-1 (Cape Town), the closest AWS Region to Nairobi:

  • It's an opt-in Region. Enable it on the account first (aws account enable-region --region-name af-south-1, or Account → AWS Regions). IAM roles only propagate to enabled Regions.
  • Available there (AWS regional-availability API, 2026-10-20): S3, Lambda, Fargate, Aurora, SES, Secrets Manager, IAM Identity Center, Bedrock. Bedrock model availability is narrower than in us-east-1, so check each model ID.
  • It costs about 20–35% more than us-east-1: S3 +19%, Lambda compute +33%, Aurora SLv2 +33%.
  • For Kenyan users on 2G/3G, put CloudFront (Nairobi edge) in front. Payments stay on M-Pesa for Kenya-targeted projects and Stripe otherwise. AWS doesn't change the payments rule.

Full price comparison: reference/cheatsheet.md.


Infrastructure as Code (AWS CDK in TypeScript)

All AWS infrastructure is defined as code and reviewed by the [CA] Cloud Architect agent before apply. No click-ops in the console for anything that touches client data. The house preference is AWS CDK v2 in TypeScript: same language as the app, with type-safe constructs. Terraform is the alternative when a client standardizes on it or needs multi-cloud.

Bash
npm install aws-cdk-lib@2.273.0 constructs@10.8.1
npm install -D aws-cdk@2.1146.0          # project-local CLI; run via npx cdk
npx cdk bootstrap aws://ACCOUNT_ID/us-east-1

A minimal HIPAA-leaning stack: a private, encrypted, versioned bucket and a scoped secret.

TypeScript
// lib/intake-stack.ts
import { Stack, type StackProps, Duration, RemovalPolicy } from "aws-cdk-lib";
import type { Construct } from "constructs";
import { Bucket, BucketEncryption, BlockPublicAccess } from "aws-cdk-lib/aws-s3";
import { Key } from "aws-cdk-lib/aws-kms";
import { Secret } from "aws-cdk-lib/aws-secretsmanager";

export class IntakeStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    // Customer-managed KMS key with rotation (required posture for PHI).
    const key = new Key(this, "IntakeKey", {
      enableKeyRotation: true,
      removalPolicy: RemovalPolicy.RETAIN,
    });

    // Private, encrypted, versioned bucket — no public access.
    new Bucket(this, "IntakeBucket", {
      bucketName: "acme-health-intake",
      encryption: BucketEncryption.KMS,
      encryptionKey: key,
      bucketKeyEnabled: true, // fewer KMS requests → lower cost
      enforceSSL: true,
      versioned: true,
      blockPublicAccess: BlockPublicAccess.BLOCK_ALL,
      lifecycleRules: [{ expiration: Duration.days(2555) }], // ~7yr retention
      removalPolicy: RemovalPolicy.RETAIN,
    });

    // DB credentials in Secrets Manager (consumed by Aurora + the app).
    new Secret(this, "DbCredentials", {
      secretName: "acme/aurora/credentials",
      encryptionKey: key,
      generateSecretString: {
        secretStringTemplate: JSON.stringify({ username: "app" }),
        generateStringKey: "password",
        excludePunctuation: true,
      },
    });
  }
}

The full app, with a Node.js 24 Lambda on upload and least-privilege grants, is in examples/cdk/. Note that NodejsFunction's logRetention prop is deprecated; pass a logGroup instead.

Bash
npx cdk synth      # emit the CloudFormation template (review this in the [CA] gate)
npx cdk diff       # show the delta against the deployed stack
npx cdk deploy     # apply (only after Cloud Architect review)

HIPAA on AWS (Florida healthcare niche)

This is the reason AWS exists in the stack. Any build handling PHI for an APD/AHCA/DCF provider has a non-negotiable baseline:

  1. Sign the BAA. Accept the AWS Business Associate Addendum via AWS Artifact (Console → Artifact → Agreements) before any PHI lands in the account. No BAA, no PHI. Designating an account as HIPAA also upgrades a Free-plan account to a paid plan.
  2. HIPAA-eligible services only. PHI may only flow through services on the HIPAA-eligible services reference. S3, RDS/Aurora, Lambda, ECS/Fargate, API Gateway, CloudFront, SES, Secrets Manager, and KMS are eligible. Check each service anyway, and especially new features like Lambda Web Functions, before use.
  3. Encryption at rest: KMS on S3 (SSE-KMS), Aurora/RDS storage encryption, EBS volumes. Customer-managed keys with rotation give the strongest posture.
  4. Encryption in transit: TLS everywhere, with enforceSSL on buckets, rds.force_ssl, and HTTPS-only CloudFront. See the encryption guide.
  5. Audit + access: CloudTrail on (immutable log bucket), least-privilege IAM, no public endpoints for PHI stores, VPC isolation for databases. Keep PHI out of CloudWatch logs.
  6. Retention: lifecycle rules or Object Lock to meet record-retention rules. Florida healthcare retention can run about 7 years.

Compliance gate: PHI work involves the [COMPLIANCE] and [PRIVACY] agents. The BAA, the encryption posture, and the HIPAA-eligible-services check are human approval gates. Surface them; don't assume them.


Environment Variables

Non-secret settings. Set them as plain env vars; they don't belong in a secrets vault:

VariableExampleNotes
AWS_REGIONus-east-1 / af-south-1Required by every v3 client. Pin it on Vercel.
AWS_ROLE_ARNarn:aws:iam::123456789012:role/vercel-s3-intakeVercel OIDC role to assume
AWS_PROFILEacme-enterpriseLocal dev/CLI only (aws login or SSO profile)
S3_BUCKETacme-health-intake
S3_KMS_KEY_IDarn:aws:kms:us-east-1:123456789012:key/...Key ARN, not secret material

Static credentials are a last resort, used only on a host that can't do OIDC and can't attach a role. Scope them to one bucket and action, and rotate them:

Bash
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...           # server-side only — NEVER ship to the client bundle

Add these to ENV_MASTER.md and each project's .env.example. In production, prefer OIDC (Vercel, GitHub), IAM roles (Lambda/ECS/EC2), and Secrets Manager over static keys. Never expose credentials to the browser; presign on the server.


CLI Integration (AWS CLI v2)

Install the AWS CLI v2 (2.38.x). Authenticate with aws login or an IAM Identity Center profile, and never paste root keys.

Bash
# Humans: short-lived creds from console sign-in (CLI >= 2.32.0) …
aws login --profile acme-enterprise
# … or IAM Identity Center for org accounts
aws configure sso
aws sso login --profile acme-enterprise

# Verify which identity you're operating as before anything destructive
aws sts get-caller-identity --profile acme-enterprise

# Kenya-resident data: enable the opt-in Region once per account
aws account enable-region --region-name af-south-1 --profile acme-enterprise

# Read a secret (JSON) from Secrets Manager
aws secretsmanager get-secret-value --secret-id acme/aurora/credentials \
  --query SecretString --output text --profile acme-enterprise

# Tail a Lambda's logs live
aws logs tail /aws/lambda/intake-handler --follow --profile acme-enterprise

Automation Workflows

Claude Code slash command: AWS resource audit

.claude/commands/aws-audit.md:

Markdown
Audit the AWS account for the profile: $ARGUMENTS

1. Run `aws sts get-caller-identity --profile $ARGUMENTS` and confirm the account.
2. List S3 buckets and check each for: public-access block ON, default encryption,
   and versioning (`aws s3api get-bucket-encryption|get-public-access-block|get-bucket-versioning`).
3. List IAM users and flag any with active access keys (OIDC/roles should replace them).
4. List IAM OIDC providers and review every role trusting them: `aud` pinned, no `repo:*` / project `*` in `sub`.
5. List Lambda functions on deprecated runtimes (`nodejs20.x` and older, any AL2 runtime).
6. Confirm CloudTrail is enabled in all regions.
7. Cross-check every service touching PHI against the HIPAA-eligible services list.
8. Output a findings table: resource, issue, severity, remediation. Flag anything
   that breaks the HIPAA baseline for the [COMPLIANCE] / [PRIVACY] gate.

GitHub Actions: CDK deploy via OIDC (no static keys)

YAML
# .github/workflows/cdk-deploy.yml
name: CDK Deploy
on:
  push:
    branches: [main]

permissions:
  id-token: write   # required for OIDC role assumption
  contents: read

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: production
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with: { node-version: '24', cache: npm }
      - uses: aws-actions/configure-aws-credentials@v6
        with:
          role-to-assume: arn:aws:iam::123456789012:role/github-cdk-deploy
          aws-region: us-east-1
      - run: npm ci
      - run: npx cdk diff
      - run: npx cdk deploy --all --require-approval never

GitHub OIDC assumes a deploy role, so CI holds no long-lived AWS keys. Scope the trust policy's sub to the repo plus a branch or environment. GitHub repos created or renamed on or after 2026-07-15 emit an immutable sub that uses numeric IDs, so check the claim before you write the condition. Pin actions to commit SHAs per the supply-chain policy.


Common Use Cases

Use CaseApproach
Default object storageCloudflare R2 (house default); use S3 only if a client requires it
Default PostgresNeon (house default); use Aurora Serverless v2 only for VPC/BAA/residency needs
Default transactional emailResend (house default); use SES only for in-account, high-volume, or BAA email
Default app hostingVercel (house default); use ECS Fargate or Lambda for VPC-resident services
Vercel app → S3/RDSVercel OIDC role via @vercel/oidc-aws-credentials-provider (no keys)
CI deploysGitHub OIDC + configure-aws-credentials@v6
Direct browser uploadS3 presigned PUT (@aws-sdk/s3-request-presigner), 5-min expiry
Python service → S3boto3 generate_presigned_url with SigV4
Infrastructure provisioningAWS CDK v2 (TypeScript), reviewed by [CA]
App/infra secretsAWS Secrets Manager + IAM role, cached (ties to infisical/encryption)
HIPAA PHI storePrivate S3 + SSE-KMS + Aurora-in-VPC, BAA via AWS Artifact
Kenya-resident dataaf-south-1 (opt-in) + CloudFront Nairobi edge
Bursty / event-driven computeLambda Event Functions + API Gateway (+ RDS Proxy for DB)
HTTP Node API, VPC-residentLambda Web Functions (evaluate) or ECS Fargate
Long-running / containerizedECS Fargate (ties to docker guide)

Troubleshooting

IssueFix
SignatureDoesNotMatch on presigned PUTThe client must send exactly the signed headers (e.g. x-amz-server-side-encryption); sign only what the client will send
403 AccessDenied on S3 GETCheck that the IAM policy ARN matches the bucket and that the bucket policy / OAC isn't blocking; confirm AWS_REGION is correct
Vercel: Not authorized to perform sts:AssumeRoleWithWebIdentityThe trust policy's aud/sub doesn't match the token. Check the team slug, project name, and environment, and that the audience is registered on the IAM OIDC provider
Vercel: calls hit the wrong Region / NoSuchBucketAWS_REGION was auto-set to the function's Region; set it explicitly in project env vars
GitHub: OIDC assume-role denied on a new repoNew or renamed repos (since 2026-07-15) emit an immutable numeric sub; update the condition
ExpiredToken from the SDKSession expired; re-run aws login / aws sso login --profile ...
CLI uses the wrong accountPass --profile (or set AWS_PROFILE); verify with aws sts get-caller-identity
af-south-1 calls fail with auth errorsThe Region isn't enabled on the account; run aws account enable-region --region-name af-south-1
Lambda DB connection exhaustionFront the database with RDS Proxy; don't open a raw pool per invocation
Lambda on nodejs20.xDeprecated 2026-04-30; move to nodejs24.x (Runtime.NODEJS_24_X)
cdk deploy fails on bootstrapRun cdk bootstrap aws://ACCOUNT/REGION once per account+Region (af-south-1 too)
SES emails go to spam / stuck in sandboxVerify domain DKIM/SPF/DMARC and request production access
PHI on a non-eligible serviceStop. Move PHI only onto services on the HIPAA-eligible list, and confirm the BAA is signed in AWS Artifact
KMS AccessDeniedExceptionThe IAM role needs kms:GenerateDataKey/kms:Decrypt on the key, and the key policy must allow the role

codeAmani notes

  • Enterprise tier only. AWS is for $50K+ builds with a compliance, residency, VPC, or scale requirement that the house defaults (Neon, R2, Resend, Vercel) can't meet. Check the tech-stack MCP first.
  • Secrets stay server-side. No AWS credential ever reaches a client bundle. Prefer OIDC and roles over keys everywhere, and run gitleaks before every push.
  • AI routing is unchanged. Claude stays primary through the Anthropic API. Bedrock is an option only when a client contract requires model calls to stay inside their AWS account (and BAA). Follow the anthropic guide's model IDs and verify Bedrock model availability per Region, especially in af-south-1.
  • Payments are unchanged. Stripe is the default and M-Pesa is used only for Kenya-targeted projects. Hosting on AWS doesn't change the payment rail. M-Pesa callbacks still need public HTTPS (API Gateway or a Lambda Web Function URL behind CloudFront both work).
  • African market. Use af-south-1 for in-Africa residency, CloudFront's Nairobi edge for latency, and budget about 20–35% more than us-east-1.
  • HIPAA is a human gate. BAA first, eligible services only, KMS plus TLS, CloudTrail on.

See PATTERNS.md, RESOURCES.md, NOTES.md, examples/, and reference/.