Overview
Macro uses Pulumi with TypeScript for infrastructure as code (IaC). All infrastructure is deployed to AWSus-east-1 region.
Infrastructure Structure
The infrastructure is organized as a monorepo with individual stacks for each service:Environments
Macro has two deployment environments:- dev - Development environment
- prod - Production environment
Pulumi.dev.yaml- Dev environment configPulumi.prod.yaml- Prod environment config
Deploying a Stack
Prerequisites
- Install Pulumi CLI
- Configure AWS credentials and access to the AWS org
- Set up Pulumi with AWS
- Install dependencies with
bun install
Deployment Commands
Pulumi commands must be run from within the specific stack directory:Common Stack Components
Most service stacks include:ECS Services
- Docker container deployments on AWS ECS
- Load balancers and auto-scaling
- Health checks and monitoring
Lambda Functions
- Event-driven serverless functions
- S3 triggers for document processing
- SQS queue consumers
Databases
- RDS PostgreSQL instances
- Connection pooling with RDS Proxy
- Secrets management via AWS Secrets Manager
Message Queues
- SQS queues for async processing
- Dead letter queues (DLQ) for failed messages
- CloudWatch alarms on DLQ depth
Stack References
Stacks reference outputs from other stacks usingpulumi.StackReference:
- Database URLs
- Queue ARNs
- Bucket names
- API endpoints
Environment Variables
Services receive configuration through:- Secrets Manager - Sensitive values like API keys, database passwords
- Stack Config - Environment-specific settings in
Pulumi.{env}.yaml - Container Environment Variables - Service configuration passed to ECS/Lambda
Monitoring and Logging
All infrastructure includes:- CloudWatch Logs - Service logs and application output
- Datadog - Centralized logging and metrics (us-central-1)
- CloudWatch Alarms - Alerts for DLQs, service health, and resource usage
- Container Insights - ECS cluster monitoring
Resource Tagging
All resources are tagged with:environment- dev or prodtech_lead- Responsible team leadproject- Service/component name
Best Practices
- Always preview before deploying - Use
pulumi previewto review changes - Test in dev first - Deploy to dev and validate before prod
- Use stack references - Avoid hardcoding ARNs or URLs
- Enable point-in-time recovery - Automatically enabled for prod DynamoDB tables
- Set up proper alarms - Monitor DLQs and critical metrics