Migrating a Real-Time Security Analysis and Automated Device-Response Pipeline to AWS
System Design
Security devices, firewalls, network sensors, vulnerability scanners, and on-premises collectors send alerts and telemetry to AWS through AWS Direct Connect or AWS Site-to-Site VPN. Internet-connected sources can use mutually authenticated HTTPS endpoints exposed through Amazon API Gateway or load-balanced collectors.
Amazon Managed Streaming for Apache Kafka acts as the central event backbone. It receives raw security alerts, asset updates, vulnerability records, threat-intelligence indicators, response commands, and device acknowledgements.
Kafka topics are separated by business purpose and trust boundary. The main topic groups contain raw alerts, normalized events, asset observations, vulnerability changes, security findings, response proposals, response commands, response acknowledgements, and failed events.
Every event contains a unique event identifier, source identifier, event time, ingestion time, schema version, business-unit identifier, security classification, and trace identifier. The trace identifier connects the original alert to the final remediation action.
AWS Glue Schema Registry manages event schemas. Producers and consumers use controlled schema versions so that a source-system change does not silently break security processing.
Amazon Managed Service for Apache Flink performs continuous stream processing. It validates messages, removes duplicates, normalizes vendor-specific formats, correlates related events, calculates time-window statistics, enriches alerts with asset and vulnerability information, and evaluates deterministic security rules.
Amazon DynamoDB stores low-latency rule configuration, allowlists, maintenance windows, response limits, and temporary processing state. Amazon Aurora PostgreSQL-Compatible Edition stores relational business information such as assets, vulnerabilities, cases, approvals, rule metadata, remediation history, and audit records.
Amazon ElastiCache for Redis stores hot operational data, dashboard summaries, device status, top-risk lists, short-lived correlation results, and precomputed API responses. Spring Boot services use Redis as the first read tier to maintain core API response times below 50 milliseconds.
If a Redis key is unavailable, the application uses a controlled Aurora fallback. The fallback path applies query timeouts, concurrency limits, circuit breakers, and result limits so that a Redis failure does not overload the transactional database.
Amazon Timestream for InfluxDB stores recent high-resolution operational measurements that require InfluxDB-compatible clients, query behavior, or data models.
Amazon S3 stores immutable raw events, normalized records, historical security evidence, and analytical datasets. Data is stored in compressed columnar formats such as Apache Parquet for long-term investigation and cost-efficient analysis.
Amazon Security Lake provides a centralized security data plane. Security records are normalized to the Open Cybersecurity Schema Framework so that network, vulnerability, asset, identity, AWS, SaaS, and on-premises data can be investigated through a common structure.
Deterministic rules produce response proposals rather than directly changing production devices. A response proposal contains the target device, requested action, affected indicator, supporting evidence, severity, confidence, rule version, action duration, exception results, and idempotency key.
Amazon EventBridge routes each approved response proposal to the correct automation workflow. Routing is based on event type, target device class, severity, business unit, and required approval level.
AWS Step Functions manages the response lifecycle. The workflow validates policy, checks allowlists, requests approval when required, sends the command, waits for acknowledgement, verifies the device state, schedules expiration, and starts rollback when verification fails.
Amazon Simple Queue Service provides an isolated command queue for each device type or integration domain. Queue isolation prevents a slow or unavailable firewall from delaying endpoint, DNS, identity, or cloud-native response workflows.
AWS Lambda runs short-duration response adaptors. Long-running or specialized device connectors run as containerized Spring Boot services on Amazon Elastic Container Service with AWS Fargate.
AWS Secrets Manager stores firewall and security-product credentials. Each connector receives only the permissions required for its target system and operation.
Amazon CloudWatch collects service metrics, application logs, consumer lag, processing latency, failed-event counts, response duration, and device acknowledgement metrics. AWS CloudTrail records AWS API activity, while application audit records preserve business decisions and device actions.
The existing Vue 3 frontend is hosted in Amazon S3 and delivered through Amazon CloudFront. AWS WAF protects public web endpoints. Spring Boot 3.2.6 microservices run on Amazon ECS with AWS Fargate or Amazon EKS, depending on the enterprise container operating model.
The platform runs across multiple Availability Zones. Critical event data remains in Amazon MSK until consumers successfully process it, allowing downstream services to recover without losing accepted alerts.
AI Agents analyze attack paths, affected assets, vulnerabilities, identity activity, historical incidents, and network relationships. AI output remains advisory until deterministic policy checks and approval requirements are satisfied.
Data Flow
Ingestion and Streaming Layer
- Services: Security devices, Ingestion service, Amazon MSK, AWS Glue Schema Registry, Amazon Managed Service for Apache Flink, Amazon S3, Amazon Security Lake, Amazon Timestream for InfluxDB
- A firewall, sensor, scanner, or collector sends an event over Direct Connect, Site-to-Site VPN, or mutually authenticated HTTPS.
- The ingestion service authenticates the source, assigns event and trace identifiers, and publishes the raw payload to Amazon MSK.
- MSK stores the event across Availability Zones and serves independent consumer groups while analytics or response components recover.
- Flink reads the raw event and validates it against the schema in AWS Glue Schema Registry.
- Invalid records are sent to a failed-event topic with the error category, processing stage, and retry status.
- Valid records are normalized, deduplicated, enriched, and correlated by event time, including late and out-of-order events.
- Normalized events and rule inputs are written to Amazon S3 and mapped to Open Cybersecurity Schema Framework classes in Amazon Security Lake.
- High-resolution measurements are written to Amazon Timestream for InfluxDB when Influx-compatible storage is required.
Detection and Decision Layer
- Services: Amazon Managed Service for Apache Flink, Amazon DynamoDB, Amazon MSK, Decision service, Amazon Aurora PostgreSQL, Amazon ElastiCache, Spring Boot API, Vue 3
- Flink evaluates stateless single-event rules and stateful sequence, threshold, and rate rules.
- Allowlists, maintenance windows, and response limits are read from Amazon DynamoDB.
- Real-time counters, risk summaries, device status, and dashboard results are written to Amazon ElastiCache.
- Spring Boot APIs return those results to the Vue 3 console, using a bounded Aurora query only when the key is missing.
- An actionable condition publishes a response proposal to an MSK decision topic and does not call the device.
- The decision service checks rule status, allowlists, asset criticality, action volume, protected resources, and approval level.
- An approved proposal is retained with its evidence. A rejected proposal is stored with the policy reason.
- Scheduled reconciliation compares cached aggregates with the durable Aurora and S3 records.
Response Layer
- Services: Amazon EventBridge, AWS Step Functions, Amazon SQS, AWS Lambda, ECS connector, AWS Secrets Manager, Target device, Amazon CloudWatch
- EventBridge routes an approved proposal to the Step Functions workflow for that device class.
- Step Functions records the workflow, checks the idempotency key, and decides whether approval is required.
- After approval, the workflow sends the command to the dedicated Amazon SQS queue for that integration.
- A Lambda adaptor or ECS connector loads the credential from AWS Secrets Manager and calls the device API.
- The connector records the external transaction identifier and publishes an acknowledgement.
- Step Functions verifies the effective device state from an independent read or confirmation event.
- Success marks the action active and schedules expiration. Failure uses bounded retries, then rollback or an exception queue.
- CloudWatch and the audit trail join the event, rule, approval, command, verification, and rollback on the same trace identifier.
Security Layer
- Services: AWS Glue Schema Registry, AWS Secrets Manager, AWS IAM, AWS WAF, Amazon CloudFront, AWS Step Functions, AWS CloudTrail, Amazon MSK
- Producers and consumers use a registered schema version so a source change cannot silently break processing.
- Device credentials stay in AWS Secrets Manager and are never placed in Kafka, SQS, browser responses, or logs.
- Each connector receives an IAM role limited to its target system and operation.
- AWS WAF protects the Vue 3 console delivered by Amazon CloudFront.
- Step Functions keeps high-impact changes behind approval and allows only reversible, high-confidence actions to run automatically.
- AWS CloudTrail records AWS API activity separately from the business audit trail.
- AI output remains advisory until the deterministic policy checks in the decision path succeed.
- Amazon MSK retains accepted events until consumers succeed, so a response outage does not drop alerts.
Main Logic
Accept security events independently of downstream processing health. Once Amazon MSK acknowledges an event, temporary analytics or response failures must not require the source device to resend all data manually.
Preserve the original payload before transformation. Raw evidence is required for replay, parser correction, incident investigation, rule validation, and compliance review.
Validate every event against a controlled schema. Unsupported schema versions and missing mandatory fields are isolated instead of being silently ignored.
Use event time for security correlation and ingestion time for operational monitoring. Watermarks and allowed-lateness settings handle delayed and out-of-order device events.
Treat duplicate delivery as an expected condition. Event processing, rule generation, and response execution use stable identifiers and idempotency controls.
Separate normalization, detection, decision, and response. A parser cannot authorize a firewall block, and a detection rule cannot bypass enterprise response policy.
Use Flink state for high-throughput correlation and short-lived event context. Avoid a database lookup for every event by distributing frequently used enrichment and rule configuration into processing state.
Keep business-controlled values outside compiled stream-processing code. Thresholds, allowlists, maintenance windows, protected resources, and automation permissions are versioned configuration.
Evaluate rules in shadow mode before production activation. A new rule version publishes comparison findings without changing devices until its accuracy and operational impact are accepted.
Classify rules by execution model. Single-event filters use stateless processing, multi-event correlations use stateful streaming, historical analytics use S3-based analysis, and enforcement eligibility uses response policy.
Generate a structured response proposal for every actionable finding. The proposal includes evidence references, target scope, severity, confidence, rule version, requested duration, and a unique idempotency key.
Apply defense-in-depth response controls. The platform checks protected addresses, trusted domains, business-critical assets, maintenance windows, action-rate limits, maximum policy-change size, and emergency-stop state.
Require approval for high-impact actions. Short-duration and reversible actions with high-confidence evidence may be automated, while identity disablement, broad network blocking, and critical-service changes remain approval-gated.
Isolate device integrations with dedicated queues. Rate limits, outages, and retries for one device vendor cannot block unrelated response domains.
Verify observed state after every device call. An API success response does not prove that the required policy is active on the target device.
Use compensating actions for rollback. When a block causes unacceptable impact, verification fails, or the authorized duration expires, the workflow removes or reverses the control.
Store device credentials only in AWS Secrets Manager. Credentials are never placed in Kafka events, SQS messages, browser responses, or general application logs.
Maintain the sub-50-millisecond API path through precomputed Redis data. User requests do not synchronously scan raw time-series events or wait for multiple downstream services.
Prevent cache stampedes by allowing one controlled rebuild for an expired key. Other requests use a recent safe snapshot or a reduced-detail response when permitted.
Protect Aurora during Redis failure. Database fallback uses concurrency controls, cost-bounded queries, timeouts, circuit breakers, and read isolation.
Retain Kafka data for replay and recovery, not as the permanent archive. Long-term evidence is stored in Amazon S3 and normalized in Amazon Security Lake.
Record every decision and action. The audit chain contains input events, enrichment values, rule versions, AI output, approvals, commands, external transaction identifiers, verification results, expiry, and rollback.
Use AI to support investigation and remediation planning, not to bypass deterministic control. AI Agents can explain attack paths and recommend actions, but policy validation determines execution authority.
Monitor business outcomes in addition to infrastructure health. Important measures include event acceptance, consumer lag, p99 detection delay, cache hit ratio, API p95 and p99 latency, response completion time, verification success, rollback success, and false-positive impact.
Example Case: Automated Blocking of a Malicious Public IP Address
A perimeter firewall detects repeated connection attempts from public IP address 203.0.113.45 against several internet-facing application servers.
The firewall sends an alert containing the source IP address, destination addresses, ports, action, event time, device identifier, and vendor severity to the AWS ingestion endpoint.
The ingestion service authenticates the firewall, assigns event ID EVT-20261124-000184 and trace ID TRACE-IP-2030011345-01, then publishes the raw alert to the Amazon MSK raw-network-alert topic.
Amazon Managed Service for Apache Flink validates the event schema, normalizes the firewall fields, converts the timestamp to the platform standard, and confirms that the event has not already been processed.
Flink enriches the alert with asset data from the security domain. The destination servers are identified as internet-facing production systems with high business criticality.
Flink adds vulnerability context showing that one destination server has an unremediated critical vulnerability associated with the exposed service.
Threat-intelligence enrichment identifies the source address as an active malicious scanner observed by an approved intelligence source.
A stateful rule counts 120 connection attempts from the same source address against four production assets within two minutes. The rule threshold is 50 attempts against at least two assets within five minutes.
The rule generates finding FIND-20261124-00982 with critical severity. The finding references the original events, affected assets, vulnerability context, threat-intelligence record, rule ID, and rule version.
The normalized events and finding are written to Amazon S3. The security records are mapped into the appropriate Open Cybersecurity Schema Framework structure and made available through Amazon Security Lake.
Flink updates the Redis risk summary. The Vue 3 operations dashboard immediately shows the source address, affected systems, event count, risk score, and recommended response.
The rules service creates a response proposal requesting a two-hour block of 203.0.113.45 on the affected perimeter firewalls.
The response proposal includes the evidence references, critical severity, approved threat-intelligence match, requested duration, target firewall group, and idempotency key BLOCK-2030011345-RULE-NET-17-V4-20261124T0700.
The policy service checks the enterprise allowlist and confirms that the address is not a trusted partner, monitoring service, customer gateway, or protected administrative source.
The policy service checks the circuit breakers. The requested action changes less than the permitted percentage of the firewall policy, the hourly automation limit has not been reached, and the global emergency stop is inactive.
Because the action affects a single malicious IP address, has a two-hour expiration, is reversible, and meets the high-confidence threshold, the policy permits automatic execution without manual approval.
Amazon EventBridge routes the proposal to the firewall-response Step Functions workflow.
Step Functions checks the idempotency store and confirms that the same block has not already been executed for the active action period.
The workflow sends a firewall block command to the dedicated Amazon SQS firewall-command queue.
The firewall connector running on Amazon ECS with AWS Fargate retrieves the command and reads the target-specific API credential from AWS Secrets Manager.
The connector calls the firewall management API and adds 203.0.113.45 to a temporary deny policy with a two-hour expiration time.
The firewall returns transaction ID FW-TXN-774921. The connector publishes a successful acknowledgement containing the transaction ID, policy version, execution timestamp, and target devices.
Step Functions performs an independent verification call. It confirms that the temporary deny policy is active on all intended firewalls.
The workflow records the action as enforced. The dashboard changes the finding status from detected to contained and displays the verified firewall transaction.
New connection attempts from 203.0.113.45 are denied. Firewall deny events return through Amazon MSK and are linked to the original trace ID, proving that the control is operating.
The AI Agent produces an analyst summary explaining the attack path, affected assets, supporting evidence, executed control, and recommended vulnerability remediation. The AI summary does not alter the device policy.
The remediation workflow creates a task for the application owner to patch the critical vulnerability and review why the exposed service was reachable.
Two hours later, Step Functions reevaluates the action. If no approved extension exists, it sends a removal command to the firewall connector.
The connector removes the temporary deny entry and publishes the resulting firewall policy version.
Step Functions verifies that the temporary rule has been removed and closes the response action while retaining the alert, finding, approvals, commands, device acknowledgements, verification records, and AI summary in the audit history.
If the original block or later removal had failed, the workflow would have performed bounded retries, sent the failure to the firewall exception queue, alerted the security operations team, and preserved the complete execution state for manual recovery.
