Executive Summary: Resilient Database Fallback When the Cache Is Unavailable on AWS
System Design
The platform runs Spring Boot 3.2.6 microservices on Amazon ECS with AWS Fargate. Amazon EKS can be used instead when the enterprise already has a Kubernetes operating model.
The Vue 3 frontend is built as static content and delivered through Amazon S3 and Amazon CloudFront. AWS WAF protects external access against common web attacks and unwanted traffic.
An Application Load Balancer distributes API requests across Spring Boot service instances deployed in private subnets across multiple Availability Zones.
Amazon ElastiCache for Valkey or Redis OSS provides the primary cache layer. It stores monitoring summaries, asset information, vulnerability statistics, blacklist metadata, and other frequently requested data.
ElastiCache uses Multi-AZ replication and automatic failover. If the primary cache node fails, ElastiCache promotes a replica and updates the primary endpoint.
Amazon Aurora PostgreSQL-Compatible Edition is the authoritative relational database. It stores incidents, assets, vulnerabilities, remediation records, security policies, aggregation results, and workflow states.
Amazon RDS Proxy is placed between the Spring Boot services and Aurora. It pools database connections and prevents application scaling or cache failure from creating an uncontrolled database connection storm.
Aurora writer instances process transactional operations such as incident acknowledgement, vulnerability status updates, and remediation actions.
Aurora reader instances process eligible read-only fallback requests. Requests that require strongly consistent information continue to use the writer.
Amazon Managed Streaming for Apache Kafka receives raw alerts and distributes them to detection, correlation, aggregation, notification, and automated-response services.
Amazon Timestream for InfluxDB can replace the on-premises InfluxDB deployment when compatibility with the existing time-series data model is required.
Amazon S3 stores versioned security artifacts, including signed IP blacklist snapshots, historical exports, backup files, and last-known-good datasets.
Amazon CloudWatch collects application logs, infrastructure metrics, fallback counters, database performance data, and cache health information.
AWS X-Ray or OpenTelemetry records distributed traces across the load balancer, application services, cache, database, and messaging components.
AWS Secrets Manager stores database and service credentials. AWS Key Management Service encrypts Aurora, ElastiCache, Amazon S3, Amazon MSK, logs, snapshots, and backups.
The production environment spans at least two Availability Zones. Application services, ElastiCache replicas, and Aurora instances are distributed across those zones to reduce the effect of a single-zone failure.
Data Flow
Ingestion and Data Layer
- Services: Security devices, Ingestion service, Amazon MSK, Consumer services, Amazon Timestream for InfluxDB, Amazon Aurora PostgreSQL, Aggregation service, Amazon ElastiCache
- Network security devices send raw alerts through authenticated ingestion interfaces.
- The ingestion service validates each alert, assigns an event identifier, and adds device, time, schema, and domain metadata.
- The validated alert is published to Amazon MSK.
- Consumers normalize, deduplicate, enrich, classify, and correlate the alert.
- Time-series measurements are written to Amazon Timestream for InfluxDB.
- Incidents, assets, vulnerabilities, and remediation state are written to Aurora.
- Aggregation builds compact summaries from stream processing and the five-minute schedule, and stores each summary with a generation time and watermark.
- Frequently requested summaries are written to ElastiCache with jittered expiry.
Application Read Layer
- Services: API client, Application Load Balancer, Spring Boot service, Amazon ElastiCache, Fallback controller, Amazon RDS Proxy, Amazon Aurora PostgreSQL, Amazon CloudWatch
- A user, firewall, or internal service calls the API through the Application Load Balancer.
- Spring Boot checks identity, authorization, tenant, security domain, and requested operation.
- The service reads ElastiCache and checks schema version, generation time, watermark, and permitted data age.
- A valid cached value is returned.
- A missing key with an acceptable last-known-good value is returned while an asynchronous refresh runs.
- If no acceptable value exists, the fallback controller checks criticality, circuit-breaker state, and concurrency capacity.
- An admitted request queries Aurora through RDS Proxy, using a reader or the writer according to the consistency requirement.
- CloudWatch records whether the response came from cache, stale storage, an Aurora reader, the Aurora writer, or Amazon S3.
Recovery Layer
- Services: Spring Boot service, Amazon ElastiCache, Cache-warming controller, Amazon Aurora PostgreSQL, Amazon RDS Proxy, Amazon S3, Amazon MSK, Amazon CloudWatch
- The caller still receives the Aurora result when a cache write cannot complete.
- After ElastiCache recovers, backfill is rate-limited so recovery does not stampede Aurora.
- The warming controller restores active incidents, blacklist data, and high-risk summaries before low-value historical keys.
- Warming concurrency drops when Aurora CPU, latency, or RDS Proxy wait time nears a safety threshold.
- Firewall clients can read the signed last-known-good blacklist artifact from Amazon S3.
- Amazon MSK continues to accept raw alerts while the read path is degraded.
- After the cache stays stable for the recovery period, the circuit closes and cache-first reads resume.
- CloudWatch confirms cache latency and Aurora utilization before the platform reports normal mode.
Security Layer
- Services: AWS WAF, Amazon CloudFront, AWS IAM, AWS Secrets Manager, AWS KMS, Amazon RDS Proxy, Amazon S3, Governed domain API
- The Vue 3 frontend is delivered through Amazon CloudFront and protected by AWS WAF.
- Application tasks run in private subnets and use IAM roles scoped to their own data.
- Database and service credentials are read from AWS Secrets Manager.
- AWS KMS encrypts Aurora, ElastiCache, Amazon S3, Amazon MSK, logs, and backups.
- RDS Proxy is the only database connection path used by application fallback.
- Fallback permits are reserved for critical reads and writes. Broad dashboards cannot consume that capacity.
- Each blacklist artifact in Amazon S3 carries a version, expiry, checksum, and signature.
- AI agents call the governed domain API and cannot issue unrestricted database queries.
Main Logic
The application uses cache-aside processing. ElastiCache improves performance, but Aurora remains the authoritative source of relational business data.
A cache failure never automatically allows all requests to query Aurora.
Every API is assigned a business criticality level, consistency requirement, maximum acceptable data age, expected query cost, fallback source, and fallback concurrency limit.
Critical operations include incident acknowledgement, remediation status changes, protection-response records, and retrieval of active firewall protection data.
Noncritical operations include broad historical dashboards, low-priority reporting, and expensive analytical queries that do not directly affect an active security response.
Critical write operations continue through Aurora even when ElastiCache is unavailable.
Eligible read operations can fall back to an Aurora reader when replica freshness is sufficient.
Queries requiring current transactional data use the Aurora writer.
Expensive dashboard queries do not perform full aggregation across more than 150 tables during a cache outage.
Scheduled jobs and streaming consumers maintain compact summary tables that can be queried efficiently during fallback.
The service applies a short cache timeout. It does not wait several seconds for a failed cache operation before trying another approved source.
A circuit breaker observes cache latency and failure rates.
The circuit remains closed while ElastiCache is healthy.
The circuit opens when cache errors or latency exceed the configured threshold.
While the circuit is open, the service stops repeatedly calling the unhealthy cache.
The circuit enters a half-open recovery state after a configured waiting period.
Only a limited number of cache health probes are allowed during the half-open state.
The circuit closes only after ElastiCache remains stable for the required recovery window.
A fallback bulkhead limits the number of simultaneous database fallback queries.
Requests that exceed the bulkhead limit do not wait indefinitely.
Eligible requests receive a bounded-stale response when fallback capacity is exhausted.
Noncritical requests can receive a controlled degraded-service response instead of consuming database capacity reserved for critical operations.
RDS Proxy pools and reuses Aurora connections.
Spring Boot connection-pool sizes are calculated together with the RDS Proxy and Aurora connection limits.
Application scaling does not automatically increase permitted fallback concurrency.
Request coalescing prevents multiple application threads from executing the same database query for the same missing cache key.
One request loads the value while other matching requests wait briefly, use an acceptable stale value, or receive a controlled response.
Cache entries include a generation time, source watermark, schema version, business scope, and maximum usable age.
Time-to-live values include randomized jitter to prevent thousands of keys from expiring at the same time.
The platform distinguishes soft expiration from hard expiration.
A soft-expired value can be served temporarily while an asynchronous refresh runs.
A hard-expired value cannot be used when it exceeds the business operation’s permitted data age.
Database fallback queries use indexes, bounded result sets, and statement timeouts.
Each statement timeout is shorter than the remaining API response-time budget.
Aurora reader lag is checked before a reader is selected for a freshness-sensitive request.
A reader is rejected when its replication delay exceeds the operation’s permitted data age.
Cache backfilling is best effort. A successful Aurora query is not changed into a failed user response merely because the cache write fails.
Cache warming is prioritized. Current incidents, active blacklist data, critical asset projections, and high-risk vulnerability summaries are restored before low-value historical data.
The warming rate is reduced automatically when Aurora CPU utilization, database latency, RDS Proxy wait time, or connection usage approaches a safety threshold.
Firewall blacklist information is published as a versioned and durable artifact in Amazon S3.
Each blacklist artifact contains a version, generation time, expiry time, checksum, and, where required, a digital signature.
Firewall devices can continue retrieving the last valid blacklist artifact during a cache incident without sending every request to Aurora.
Raw alert ingestion continues through Amazon MSK even when read-side services are degraded.
Kafka consumers use event identifiers and idempotent processing to prevent replayed alerts from creating duplicate incidents or duplicate firewall actions.
AI agents obtain security context through governed domain APIs.
AI agents cannot bypass fallback controls and issue unrestricted database queries.
If required asset, vulnerability, or network data is incomplete, the AI output is marked as incomplete or postponed.
CloudWatch alarms monitor cache error rates, cache latency, cache hit ratio, fallback attempts, fallback admissions, rejected fallback requests, stale responses, Aurora CPU, Aurora connections, reader lag, RDS Proxy wait time, and cache-warming activity.
The platform reports its operating mode as normal, cache degraded, cache unavailable, database constrained, recovery, or normal after recovery.
Example Case
Security analysts are reviewing a high-risk vulnerability affecting several internet-facing business systems.
Firewall devices are retrieving the latest public IP blacklist, while the platform is processing a temporary spike in raw security alerts.
Under normal conditions, dashboard requests and blacklist metadata are retrieved from ElastiCache in less than 50 milliseconds.
Amazon MSK continues receiving raw alerts from network security devices.
Consumer services enrich the alerts with asset, vulnerability, and domain information.
An ElastiCache primary node becomes unavailable.
ElastiCache starts promoting a replica in another Availability Zone.
Spring Boot services receive temporary cache timeouts while the promotion is in progress.
The cache circuit breaker detects that the error rate has exceeded the configured threshold.
The circuit opens and stops most application threads from repeatedly calling the unavailable cache endpoint.
A firewall sends a request for the current malicious IP blacklist.
The blacklist service checks the versioned artifact in Amazon S3.
The current artifact is still within its approved validity period.
The service returns the signed last-known-good blacklist without querying Aurora.
A security analyst requests the details of a critical incident.
The request is classified as a high-priority operational read.
The fallback bulkhead confirms that database fallback capacity is available.
The service sends an indexed query through RDS Proxy.
RDS Proxy reuses an existing connection and routes the request to an Aurora reader.
The application checks that reader lag is within the incident API’s permitted freshness limit.
Aurora returns the current incident, affected assets, related vulnerabilities, and remediation status.
The service returns the incident information to the analyst with the data-generation timestamp.
Another analyst opens a broad historical dashboard that would normally require several expensive aggregations.
The dashboard request is classified as noncritical during cache degradation.
Instead of executing full aggregation across the business tables, the service returns the last acceptable summary from a local last-known-good copy or queries a compact summary table.
The response indicates the time at which the summary was generated.
Transactional operations, including incident acknowledgement and remediation updates, continue through the Aurora writer.
Application-level fallback limits prevent dashboard traffic from consuming the database capacity reserved for critical writes.
Amazon MSK continues accepting incoming alerts throughout the cache incident.
ElastiCache completes replica promotion and updates the primary endpoint.
Limited health probes begin succeeding.
The circuit breaker enters the half-open state.
The cache-warming controller restores the active blacklist metadata, critical incidents, high-risk asset information, and current vulnerability summaries.
Cache warming uses controlled concurrency and does not exceed the approved Aurora database load.
CloudWatch confirms that cache latency has returned to normal and that Aurora utilization remains below the safety threshold.
After the required stability period, the circuit breaker closes.
Normal cache-first processing resumes.
The platform reconciles cache generation watermarks with Aurora summary-table watermarks.
The system confirms that no incident update, alert event, remediation action, or firewall response was duplicated or lost.
The cache outage ends without overwhelming Aurora, interrupting raw alert ingestion, or preventing firewall devices from retrieving valid protection data.