|
4 | 4 |
|
5 | 5 | * **AWS Region**: `us-east-1` |
6 | 6 | * **Environments**: `dev`, `staging`, `prod` |
7 | | -* **Domain**: `sf-website-<env>.prettyclear.com` |
| 7 | +* **Domain**: `sf-website-<env>.sandbox-prettyclear.com` |
8 | 8 | * **Structure**: Modular Terraform setup for multi-environment support |
9 | 9 | * **Resource Tags** (applied to all resources): |
10 | 10 |
|
|
158 | 158 | * ECR (container image repository) |
159 | 159 | * ALB (for ingress) |
160 | 160 | * CloudWatch (for logs & metrics) |
161 | | - * MongoDB EC2 instance (database) |
| 161 | + * DocumentDB Cluster (database) |
| 162 | + * ElastiCache Redis (caching) |
162 | 163 | * S3 Attachments Bucket |
163 | 164 | * **Service Name**: `sf-website` |
164 | 165 | * **Container Image**: Built from project Dockerfile and stored in ECR |
|
167 | 168 | * **Auto-scaling**: Based on CPU usage (target: 70%) |
168 | 169 | * **Environment Variables**: |
169 | 170 | * `NODE_ENV=production` |
170 | | - * `APOS_MONGODB_URI=mongodb://<mongodb-hostname>:27017/apostrophe` |
| 171 | + * `APOS_MONGODB_URI=mongodb://<documentdb-cluster-endpoint>:27017/apostrophe` |
| 172 | + * `REDIS_URI=redis://<elasticache-cluster-endpoint>:6379` |
171 | 173 | * `SESSION_SECRET=<from parameter store>` |
172 | 174 | * `APOS_S3_BUCKET=sf-website-s3-attachments-<env>` |
173 | 175 | * `APOS_S3_REGION=us-east-1` |
|
198 | 200 | * ACM (for SSL certificates) |
199 | 201 | * **Type**: HTTPS-only |
200 | 202 | * **SSL**: Via AWS ACM |
201 | | - * **Domain**: `sf-website-<env>.prettyclear.com` |
| 203 | + * **Domain**: `sf-website-<env>.sandbox-prettyclear.com` |
202 | 204 |
|
203 | 205 | --- |
204 | 206 |
|
|
219 | 221 | * ECS Cluster (via APOS_CDN_URL environment variable) |
220 | 222 | * **Origin**: S3 bucket `sf-website-s3-attachments-<env>` |
221 | 223 | * **Access**: Origin access identity (OAI) to restrict direct S3 access |
222 | | - * **Custom domain**: `sf-website-media-<env>.prettyclear.com` |
| 224 | + * **Custom domain**: `sf-website-media-<env>.sandbox-prettyclear.com` |
223 | 225 | * **SSL Certificate**: Managed through AWS ACM |
224 | 226 | * **Cache Behavior**: |
225 | 227 | * Default TTL: 86400 seconds (1 day) |
|
247 | 249 | * **Resource Integration**: |
248 | 250 | * ECS Apostrophe Cluster |
249 | 251 | * ALB |
| 252 | + * DocumentDB Cluster |
| 253 | + * ElastiCache Redis |
250 | 254 | * Slack (for alerts) |
251 | 255 | * **Features**: |
252 | 256 | * ECS logs and detailed metrics |
253 | 257 | * ALB metrics (e.g., 5xx, latency) |
| 258 | + * DocumentDB cluster and instance metrics |
| 259 | + * ElastiCache Redis performance metrics |
254 | 260 | * CloudWatch alarms for key metrics |
255 | 261 | * **Alerts**: Sent to Slack |
256 | 262 | * **Log retention**: 90 days |
257 | 263 |
|
258 | 264 | --- |
259 | 265 |
|
260 | | -### 📄 MongoDB on EC2 |
| 266 | +### 🔴 Amazon ElastiCache (Redis) |
261 | 267 |
|
262 | | -* **MongoDB**: |
263 | | - * **Instance Name**: `sf-website-mongodb-<env>` |
264 | | - * **Purpose**: Primary data store for ApostropheCMS |
| 268 | +* **ElastiCache Redis Cluster**: |
| 269 | + * **Cluster Name**: `sf-website-redis-<env>` |
| 270 | + * **Purpose**: Managed Redis service for session storage and application caching |
265 | 271 | * **Resource Tags**: |
266 | | - * `Name: sf-website-mongodb-<env>` |
| 272 | + * `Name: sf-website-redis-<env>` |
267 | 273 | * `Project: Website` |
268 | 274 | * `CostCenter: Website` |
269 | 275 | * `Environment: <environment>` |
270 | 276 | * `Owner: peter.ovchyn` |
271 | 277 | * **Resource Integration**: |
272 | 278 | * ECS Apostrophe Cluster |
273 | | - * AWS Backup service |
274 | 279 | * CloudWatch (for monitoring) |
275 | | - * Parameter Store (for credentials) |
276 | | - * **Instance Type**: t3.medium (2 vCPU, 4GB RAM) |
277 | | - * **Storage**: 100GB gp3 EBS volume with 3000 IOPS |
278 | | - * **AMI**: Amazon Linux 2 |
279 | | - * **Deployment**: Single EC2 instance in private subnet |
| 280 | + * Cache Subnet Group (for networking) |
| 281 | + * **Engine Version**: Redis 7.0 (latest stable) |
| 282 | + * **Node Configuration**: |
| 283 | + * **Node Type**: `cache.t3.micro` (1 vCPU, 0.5GB RAM) for dev/staging |
| 284 | + * **Node Type**: `cache.t3.small` (2 vCPU, 1.5GB RAM) for production |
| 285 | + * **Number of Nodes**: 1 (single node for simplicity) |
| 286 | + * **Port**: 6379 (Redis standard) |
| 287 | + * **Deployment**: |
| 288 | + * Deployed in private subnets |
| 289 | + * Cache Subnet Group spans both availability zones |
280 | 290 | * **Security**: |
281 | | - * No public IP assigned |
282 | | - * Security group allows ingress only from ECS service security group on port 27017 |
283 | | - * SSH access via Session Manager (no direct SSH allowed) |
284 | | - * **Authentication**: Username/password authentication enabled |
285 | | - * Credentials stored in AWS Parameter Store |
| 291 | + * VPC security group restricting access to ECS service only |
| 292 | + * No public access |
| 293 | + * Transit encryption enabled |
| 294 | + * Auth token enabled for authentication |
| 295 | + * **Authentication**: |
| 296 | + * Auth token stored in AWS Parameter Store |
286 | 297 | * Referenced in ECS task environment variables |
287 | 298 | * **Backup Strategy**: |
288 | | - * Daily automated snapshots of EBS volume |
289 | | - * Retention period: 7 daily, 4 weekly |
290 | | - * Snapshot automation via AWS Backup service |
| 299 | + * **Automatic Backups**: |
| 300 | + * Daily snapshots enabled |
| 301 | + * Retention period: 5 days |
| 302 | + * Backup window: 02:00-03:00 UTC |
| 303 | + * **Monitoring**: |
| 304 | + * CloudWatch metrics for cluster performance |
| 305 | + * CloudWatch alarms for: |
| 306 | + * CPU utilization > 80% |
| 307 | + * Memory usage > 80% |
| 308 | + * Connection count thresholds |
| 309 | + * Cache hit ratio < 80% |
| 310 | + * **High Availability**: |
| 311 | + * Automatic failover enabled |
| 312 | + * Multi-AZ deployment for production environment |
| 313 | + * Automatic minor version updates during maintenance window |
| 314 | + * **Network Configuration**: |
| 315 | + * **Cache Subnet Group**: `sf-website-redis-subnet-group-<env>` |
| 316 | + * **Security Group**: `sf-website-redis-sg-<env>` |
| 317 | + * **Endpoint**: Primary endpoint for read/write operations |
| 318 | + |
| 319 | +--- |
| 320 | + |
| 321 | +### 📄 Amazon DocumentDB |
| 322 | + |
| 323 | +* **DocumentDB Cluster**: |
| 324 | + * **Cluster Name**: `sf-website-documentdb-<env>` |
| 325 | + * **Purpose**: Managed MongoDB-compatible database service for ApostropheCMS |
| 326 | + * **Resource Tags**: |
| 327 | + * `Name: sf-website-documentdb-<env>` |
| 328 | + * `Project: Website` |
| 329 | + * `CostCenter: Website` |
| 330 | + * `Environment: <environment>` |
| 331 | + * `Owner: peter.ovchyn` |
| 332 | + * **Resource Integration**: |
| 333 | + * ECS Apostrophe Cluster |
| 334 | + * CloudWatch (for monitoring) |
| 335 | + * Parameter Store (for credentials) |
| 336 | + * DB Subnet Group (for networking) |
| 337 | + * **Engine Version**: 4.0.0 (MongoDB compatible) |
| 338 | + * **Cluster Configuration**: |
| 339 | + * **Primary Instance**: `db.t3.medium` (2 vCPU, 4GB RAM) |
| 340 | + * **Replica Instances**: 1 replica for high availability |
| 341 | + * **Storage**: Encrypted with AWS managed keys |
| 342 | + * **Port**: 27017 (MongoDB standard) |
| 343 | + * **Deployment**: |
| 344 | + * Multi-AZ deployment across private subnets |
| 345 | + * DB Subnet Group spans both availability zones |
| 346 | + * **Security**: |
| 347 | + * VPC security group restricting access to ECS service only |
| 348 | + * TLS encryption in transit required |
| 349 | + * No public access |
| 350 | + * Authentication required |
| 351 | + * **Authentication**: |
| 352 | + * Master username/password stored in AWS Parameter Store |
| 353 | + * Referenced in ECS task environment variables via Parameter Store |
| 354 | + * Database: `apostrophe` |
| 355 | + * **Backup Strategy**: |
| 356 | + * **Automated Backups**: |
| 357 | + * Backup retention period: 7 days |
| 358 | + * Backup window: 03:00-04:00 UTC |
| 359 | + * Point-in-time recovery enabled |
| 360 | + * **Manual Snapshots**: Available for major releases |
291 | 361 | * **Monitoring**: |
292 | | - * CloudWatch agent for system metrics |
293 | | - * Custom MongoDB metrics published to CloudWatch |
294 | | - * Alerts for disk usage, connections, and query performance |
| 362 | + * CloudWatch metrics for cluster and instance performance |
| 363 | + * Enhanced monitoring enabled (60-second granularity) |
| 364 | + * CloudWatch alarms for: |
| 365 | + * CPU utilization > 80% |
| 366 | + * Database connections > 80% of max |
| 367 | + * Free storage < 20% |
| 368 | + * Read/Write latency thresholds |
| 369 | + * **Parameter Group**: |
| 370 | + * Custom parameter group for performance optimization |
| 371 | + * TLS enforcement enabled |
| 372 | + * Audit logging enabled for security compliance |
295 | 373 | * **High Availability**: |
296 | | - * Configured for future upgrade to a replica set |
297 | | - * Placeholder DNS record for future replica nodes |
| 374 | + * Multi-AZ replica instance for automatic failover |
| 375 | + * Cross-AZ backup replication |
| 376 | + * Automatic minor version updates during maintenance window |
| 377 | + * **Network Configuration**: |
| 378 | + * **DB Subnet Group**: `sf-website-documentdb-subnet-group-<env>` |
| 379 | + * **Security Group**: `sf-website-documentdb-sg-<env>` |
| 380 | + * **Endpoint**: Cluster endpoint for write operations |
| 381 | + * **Reader Endpoint**: Available for read-only operations |
0 commit comments