Prerequisites
Before deploying B4M, complete these AWS infrastructure prerequisites.
If you're deploying B4M to your own AWS account, make sure your AWS_PROFILE and environment are configured correctly before running commands.
Local Tooling Prerequisites
Before running deployment commands (pnpm sst), ensure these tools are installed:
| Tool | Verification | Installation |
|---|---|---|
| Node.js 20.x | node -v | nodejs.org or nvm install 20 |
| pnpm | pnpm -v | npm install -g pnpm |
| AWS CLI v2 | aws --version | brew install awscli (macOS) or AWS docs |
AWS CLI Configuration
Configure AWS profiles in ~/.aws/config to match your deployment accounts:
The values below are examples. Replace with your actual AWS account IDs and SSO URLs.
[sso-session your-org]
sso_start_url = https://your-org.awsapps.com/start
sso_region = us-east-1
[profile your-dev-profile]
sso_session = your-org
sso_account_id = 123456789012
sso_role_name = AdministratorAccess
region = us-east-1
Then authenticate:
aws sso login --profile your-dev-profile
AWS Account Setup
Create AWS Account
- Follow SST's AWS setup guide (skip the "Configure SST" section)
- Create organization sub-accounts for dev and prod environments (recommended)
- Log in under the proper sub-account for resource creation
Enable Required Services
Navigate to each service in AWS Console and ensure they're enabled:
- Bedrock: Enable relevant models in us-east-1 (not your local region)
- Go to Bedrock Console → Model access → Enable Anthropic Claude models
Configure Service Quotas
| Quota | Minimum Value | How to Check |
|---|---|---|
| Lambda Concurrent Executions | 1000 (default) | Service Quotas → Lambda |
| AWS Roles Per Account | 3000 | Service Quotas → IAM (us-east-1 only) |
Route53 Setup
Create Hosted Zone
- Navigate to Route53 → Hosted zones → Create hosted zone
- Enter your domain (e.g.,
yourcompany.com) - Type: Public hosted zone
- Click: Create hosted zone
Verify the Hosted Zone
After creation, your Hosted Zone ID is displayed (e.g., Z0123456789ABCDEFGHIJ) - AWS manages this internally.
For GitHub variables, use the domain name (e.g., HOSTED_ZONE=yourdomain.com), not the zone ID.
SST automatically resolves the Route53 zone ID during deployment.
Update Domain Nameservers
Nameserver changes can take 24-48 hours to fully propagate. Do this step first.
- In Route53, view the NS (Name Server) record for your zone
- Copy all 4 nameserver values (e.g.,
ns-123.awsdns-45.com,ns-456.awsdns-78.net, etc.) - Go to your domain registrar (GoDaddy, Namecheap, Google Domains, etc.)
- Find DNS/Nameserver settings for your domain
- Replace existing nameservers with the 4 Route53 NS values
Verify DNS Delegation
After waiting for propagation (usually 1-24 hours):
dig NS yourdomain.com +short
# Should return your 4 Route53 nameservers
VPC Configuration
Create VPC
- Navigate to VPC Console → Your VPCs → Create VPC
- Select: "VPC and more" (creates subnets, route tables, etc.)
- Configure:
- Name:
b4m-vpc(or your preference) - IP range: Ensure no conflict with corporate networks
- NAT gateway: 1 per AZ (minimum) or per corporate standards
- Name:
- Note the VPC ID (e.g.,
vpc-1234abcd)
You cannot use the default public VPCs. B4M requires a VPC with NAT gateway for Lambda outbound access.
Database Setup
Choose one of these options:
Option A: MongoDB Atlas (Recommended)
- Create MongoDB Atlas account at mongodb.com/cloud/atlas
- Create a cluster (M10 or higher for production)
- Configure network access (IP allowlist or VPC peering)
- Get connection string:
mongodb+srv://...
Option B: AWS DocumentDB
- Navigate to DocumentDB Console → Clusters → Create
- Configure:
- Cluster type: Instance-based
- Size: Per organization needs
- Password: Specify manually (don't use Secrets Manager)
- Note: Set
MAIN_DB_TYPE=DocumentDBin SST secrets
See DocumentDB Setup for detailed configuration.
SES Setup (Optional)
If using platform email (one-time login codes, notifications):
Verify Domain
- Navigate to SES Console → Verified identities → Create identity
- Select: Domain
- Enter: Your domain (e.g.,
yourcompany.com) - Add DNS records as provided by SES (DKIM, verification)
Request Production Access
New SES accounts are in sandbox mode. To send to any email address:
- SES Console → Account dashboard → Request production access
- Provide use case description (transactional emails for user notifications)
- Wait for approval (typically 24-48 hours)
Create SMTP Credentials
- SES Console → SMTP settings → Create SMTP credentials
- Save the username and password for
MAIL_USERNAMEandMAIL_PASSWORD
ECR Repository
Create a repository for the subscriber-fanout Docker image:
- Navigate to ECR Console → Repositories → Create repository
- Name:
bike4mind/subscriber-fanout - Note the repository URI for environment variables
SST Bootstrap
After AWS account is configured:
pnpm sst bootstrap --profile your-aws-profile
This creates the necessary CloudFormation stacks for SST to manage your deployment.
Next Steps
Once prerequisites are complete:
- Configure Secrets - Set up SST secrets
- Set Up CI/CD - GitHub Actions or Seed
- Deploy - Initial deployment