Building a Lightweight Cloud SOC on AWS – Part 2: Automated Security Alerting with Amazon SNS

Building a Lightweight Cloud SOC on AWS – Part 2: Automated Security Alerting with Amazon SNS

Extending a lightweight Cloud SOC from security visibility to actionable, event-driven CRITICAL security notifications using DynamoDB Streams, AWS Lambda, and Amazon SNS.

Series: Building a Lightweight Cloud SOC on AWS (2 articles)

  1. 1
    Building a Lightweight Cloud SOC on AWS – Part 2: Automated Security Alerting with Amazon SNS This article
Sr Consultant, Cloud&Network Security
In the first part of this series, I explored how AWS-native services could be combined to build a lightweight Cloud Security Operations Center (SOC) without deploying a traditional SIEM platform.
If you haven't read Part 1, you can find it here:
The initial implementation focused on security-event collection, custom detection logic, centralized findings storage, and visualization through a secure SOC dashboard.
However, one important operational capability was missing:
How do we notify security analysts about critical security events when they are not actively monitoring the dashboard?
In Part 2, I extend the existing architecture with automated, event-driven security notifications using DynamoDB Streams, AWS Lambda, and Amazon Simple Notification Service (SNS).

1. A Quick Recap of Part 1

The initial Cloud SOC proof of concept included:
  • Amazon GuardDuty for managed threat detection.
  • AWS CloudTrail Event history for monitoring security-sensitive management API activity.
  • Amazon EventBridge and AWS Lambda for event processing.
  • Custom detection rules for IAM and security configuration changes.
  • Amazon DynamoDB for centralized security findings.
  • Amazon Cognito and API Gateway for authenticated access.
  • A Flutter Web dashboard hosted on Amazon EC2 with Nginx and HTTPS.
Both GuardDuty and CloudTrail findings were normalized into a common data structure before being stored in DynamoDB.
The dashboard provided severity-based metrics, findings by detection source, affected resources, and detailed security-event information.
While this provided centralized security visibility, analysts still needed to access the dashboard to identify critical findings.
This became the starting point for the next enhancement.

2. Moving from Security Visibility to Proactive Alerting

A SOC platform should not simply collect and display security events. It should also help analysts identify and prioritize events that require immediate attention.
Consider the following scenarios:
  • An unexpected IAM access key is created.
  • The AWS root identity performs a sensitive administrative operation.
  • A critical GuardDuty finding is generated.
  • An unauthorized change is made to a security configuration.
Depending on the detection rules and severity classification, some of these activities may require immediate investigation.
Continuously monitoring a dashboard is not always practical, particularly for small security teams.
For this enhancement, I defined the following objectives:
  • Automatically notify analysts about newly detected CRITICAL findings.
  • Avoid unnecessary email notifications for lower-severity findings.
  • Support findings originating from both GuardDuty and CloudTrail.
  • Minimize changes to existing ingestion functions.
  • Reduce duplicate notification attempts.
  • Continue using AWS-native, usage-based services.

3. Updated Cloud SOC Architecture

Rather than integrating SNS independently with each security ingestion Lambda, I decided to implement a centralized notification layer using DynamoDB Streams.
The existing ingestion and dashboard components remain unchanged.
The new workflow begins after a normalized security finding is successfully inserted into DynamoDB.
New notification workflow:



The existing Cognito-based authentication and API Gateway JWT authorization continue to protect dashboard access.
The notification layer operates independently of the dashboard query workflow.
[Insert updated Cloud SOC architecture diagram here]

4. Why DynamoDB Streams?

One of the design decisions was determining where notification logic should be introduced.
Initially, publishing directly to SNS from each ingestion Lambda appeared to be a straightforward solution.
However, this would require notification logic to be implemented separately for GuardDuty, CloudTrail, and any additional security source introduced in the future.
Since all normalized security findings are already stored in a common DynamoDB table, I decided to use the database as the notification integration point.

DynamoDB Streams captures item-level changes in a DynamoDB table and makes them available for downstream processing.
This provides several advantages:
  • Decouples notification processing from ingestion.
  • Provides a common integration point for multiple detection sources.
  • Allows notification rules to be managed centrally.
  • Avoids introducing another polling mechanism.
  • Allows failed notification processing to be retried independently of ingestion.
As a result, new detection modules can potentially use the same notification workflow without implementing their own SNS publishing logic.

5. Implementing the Notification Workflow

The new integration uses the following components:
Component
Configuration
DynamoDB table
soc-security-findings
DynamoDB Streams
NEW_IMAGE
Notification Lambda
soc-critical-notifier
Lambda runtime
Python 3.12
SNS topic
cloud-soc-critical-alerts
Notification protocol
Email
Notification criteria
INSERT and CRITICAL
Deployment Region
us-west-2

Step 1: Enable DynamoDB Streams

I enabled DynamoDB Streams on the existing security findings table using the NEW_IMAGE stream view type.
DynamoDB Streams supports multiple view types, including key attributes, new images, old images, and both new and old images.
For this use case, NEW_IMAGE was sufficient because the Lambda requires the attributes of the newly inserted security finding.
The stream record includes the finding information required to evaluate its severity and prepare the notification.
[Insert DynamoDB Streams configuration screenshot]

Step 2: Create an Amazon SNS Topic

I created a dedicated SNS topic for critical security notifications.
aws sns create-topic \
--name cloud-soc-critical-alerts \
--region us-west-2
An email subscription was then configured and confirmed.
Amazon SNS provides the notification delivery mechanism without requiring a dedicated email server or SMTP integration.
In the future, the notification workflow could be extended to support additional destinations and escalation mechanisms.

Step 3: Create the Notification Lambda

I created a dedicated Lambda function, soc-critical-notifier, responsible for processing DynamoDB Stream records.
The function performs the following operations:
  1. Receives a DynamoDB Stream record.
  1. Checks whether the event type is INSERT.
  1. Extracts and deserializes the new finding.
  1. Evaluates the finding severity.
  1. Skips non-CRITICAL findings.
  1. Conditionally claims the notification.
  1. Publishes the security alert to Amazon SNS.
The simplified notification logic is:
for record in event.get("Records", []):

This is an abbreviated illustration of the processing logic rather than the complete deployable Lambda function.
The notification contains relevant investigation information, including severity, detection source, AWS Region, affected resource, event timestamp, and finding description.

Step 4: Configure IAM Permissions

The notification Lambda requires permissions to:
  • Read records from the configured DynamoDB Stream.
  • Publish messages to the designated SNS topic.
  • Update notification-tracking attributes in DynamoDB.
  • Write execution logs to Amazon CloudWatch.
The notification Lambda uses a separate execution role from the existing ingestion and query functions.
This helps maintain separation of responsibilities and supports least-privilege access.

Step 5: Configure the DynamoDB Stream Trigger

I connected the DynamoDB Stream to the notification Lambda using a Lambda event source mapping.
STREAM_ARN=$(aws dynamodb describe-table \
--table-name soc-security-findings \
--region us-west-2 \
--query 'Table.LatestStreamArn' \
--output text)

aws lambda create-event-source-mapping \
--function-name soc-critical-notifier \
--event-source-arn "$STREAM_ARN" \
--starting-position LATEST \
--batch-size 1 \
--region us-west-2
For the initial PoC, I selected a batch size of one to simplify testing and troubleshooting.
The LATEST starting position was selected to focus notification processing on new stream records rather than intentionally replaying historical records.
After creating the mapping, I verified that its state changed to Enabled.

6. Avoiding Alert Fatigue and Duplicate Notifications

One of the challenges in security operations is managing unnecessary alerts.
Sending an email for every IAM change or security finding could quickly overwhelm analysts.
For this initial implementation, I restricted notifications to CRITICAL findings.
Finding severity
Email notification
CRITICAL
Yes
HIGH
No
MEDIUM
No
LOW
No
INFORMATIONAL
No
Lower-severity findings remain available through the existing SOC dashboard.
The PoC also implements duplicate prevention at two different layers.

Finding-level deduplication

As discussed in Part 1, the CloudTrail poller uses conditional DynamoDB writes to prevent the same management API event from being stored multiple times.
This is particularly useful when scheduled polling windows overlap.

Notification-level deduplication

The notifier uses a conditional DynamoDB update to claim a finding before publishing the alert to SNS.
A notification-tracking attribute, notification_claimed_at, helps reduce repeated publishing attempts for the same finding.
Since updating the finding generates another DynamoDB Stream record, the Lambda processes only INSERT events and skips MODIFY events.
This prevents the notification-state update from creating a recursive notification loop.
However, this approach is not an exactly-once delivery guarantee.
A function failure after claiming a notification but before successfully publishing it could result in a missed notification. A more resilient notification state-management mechanism would be required for production environments.

7. Testing with a Synthetic Security Finding

Before generating a real security event, I wanted to validate the notification infrastructure independently.
I inserted a synthetic CRITICAL finding into the DynamoDB table.
The test finding included:
{
"title": "TEST - Critical SNS Notification",
"severity": "CRITICAL",
"source": "cloudtrail",
"region": "us-west-2",
"resource_id": "sns-test-resource",
"test": true
}
The synthetic finding was used only to validate the notification pipeline.
The insertion triggered DynamoDB Streams, which invoked the notification Lambda and subsequently published the message to Amazon SNS.
The test email was successfully received.
[Insert screenshot of synthetic SNS email notification]
This confirmed that the following components were working together:
DynamoDB → DynamoDB Streams → Lambda → SNS → Email
The next objective was to validate the entire architecture using a real AWS security-sensitive API event.

8. Testing with a Real IAM CreateAccessKey Event

For the second test, I generated an IAM CreateAccessKey event for a dedicated test IAM user.
The operation was performed using the AWS root identity in the controlled PoC environment.
CloudTrail captured the following event characteristics:
{
"eventTime": "2026-11-23T11:32:21Z",
"eventName": "CreateAccessKey",
"identityType": "Root",
"principalArn": "arn:aws:iam::<account-id>:root",
"targetUser": "soc-test"
}
The existing CloudTrail poller retrieved the event from us-east-1, evaluated the custom detection rules, and classified the activity as CRITICAL.
It then stored the normalized finding in DynamoDB.
The notification Lambda processed the new finding and successfully delivered an SNS email.



The received notification contained the following information:
{
"alert": "CRITICAL Cloud SOC Finding",
"title": "Root access key created: CreateAccessKey",
"severity": "CRITICAL",
"source": "cloudtrail",
"region": "us-east-1",
"resource": "soc-test",
"event_time": "2026-11-23T11:32:21Z"
}
This was an important milestone because the complete notification workflow was validated using an actual AWS management API event rather than only synthetic data.

An important IAM detection lesson

During this test, I also identified an opportunity to improve the existing detection terminology.
Although the current alert title says "Root access key created", CloudTrail indicates that the root identity created an access key for the IAM user soc-test.
These are two different security scenarios.
The credential belongs to the target IAM user, not the root identity.
A more accurate detection title would be:
"Root identity created an IAM access key for soc-test."
Distinguishing the actor from the target identity is important for accurate security investigations and remediation recommendations.
The activity was classified as CRITICAL according to the custom PoC detection policy. It does not independently establish malicious intent.
Root identity usage was limited to the controlled testing scenario and is not recommended for routine administration.

9. Validating Duplicate Finding Prevention

I also tested the behavior of overlapping CloudTrail polling windows by manually invoking the existing poller twice.
The results were:
Metric
First invocation
Second invocation
Events examined
133
143
Matching security events
2
2
New findings saved
2
0
Duplicate findings
0
2
Processing errors
0
0
Both matching events were retrieved from us-east-1.
During the second invocation, the poller identified the same events but did not insert additional findings.
This demonstrated that the existing conditional-write mechanism continued to work correctly after introducing the notification layer.
Because duplicate findings were not inserted, they did not generate additional INSERT records for notification processing.
[Insert CloudTrail poller execution screenshot]

10. Implementation Challenges and Troubleshooting

As with the initial Cloud SOC implementation, this enhancement involved a few practical troubleshooting steps.

Duplicate DynamoDB test records

During the initial synthetic test, DynamoDB returned a ConditionalCheckFailedException.
The conditional-write mechanism prevented an existing finding from being overwritten.
Using a Python test script that generated a unique UUID allowed the synthetic finding to be inserted successfully.
This was also a useful validation of the existing conditional-write protection.

Lambda environment configuration

During notification testing, the event source mapping was enabled, but Lambda execution repeatedly failed.
CloudWatch Logs identified the following error:
KeyError: 'SNS_TOPIC_ARN'
The required SNS topic ARN had not been configured as a Lambda environment variable.
After correcting the configuration, the Lambda was able to process the stream records and deliver the notification.
The event source mapping subsequently reported:
{
"State": "Enabled",
"LastProcessingResult": "OK"
}
This reinforced the importance of using CloudWatch Logs and event source mapping status together when troubleshooting event-driven architectures.

11. Cost and Scalability Considerations

Cost awareness continues to be an important objective of this project.
The notification enhancement does not require a new EC2 instance, dedicated messaging server, or additional database.
Potential incremental costs include:
  • Notification Lambda invocations and execution duration.
  • DynamoDB notification-state updates.
  • Applicable DynamoDB Streams processing charges.
  • Amazon SNS publishing and notification delivery.
  • CloudWatch logging.
Restricting email notifications to CRITICAL findings helps reduce unnecessary notification traffic.
The actual cost will depend on finding volume, Lambda execution behavior, retry activity, and notification frequency.
Another potential optimization is to use event source filtering so that only newly inserted CRITICAL stream records are forwarded to the notification Lambda.
In the current implementation, the severity filtering is performed inside the Lambda function.

12. Current Limitations and Production Considerations

The current solution remains a proof of concept rather than a complete enterprise SOC platform.
Before using this architecture in a production environment, I would consider implementing:
  • Bounded retries and failed-record destinations.
  • More resilient notification-state management.
  • SNS publishing and delivery monitoring.
  • Alert escalation policies.
  • Configurable severity thresholds.
  • Account-specific notification routing.
  • Improved detection correlation and alert suppression.
  • CloudWatch alarms for Lambda processing errors and stream iterator age.
DynamoDB Streams and standard SNS delivery can involve duplicate processing and delivery attempts. The current implementation should not be interpreted as providing exactly-once email delivery.
It is also important to distinguish detection latency from notification latency.
Once a CRITICAL finding is inserted into DynamoDB, notification processing is event-driven.
However, CloudTrail-based detection still depends on CloudTrail event availability and the scheduled polling interval. Therefore, the overall workflow should be described as near-real-time or event-driven alerting rather than guaranteed instantaneous detection.

13. What Comes Next?

With both centralized security visibility and automated CRITICAL notifications now implemented, the next question is:
Can we help SOC analysts understand and investigate security findings more efficiently using generative AI?
In the next part of this series, I plan to explore Amazon Bedrock for AI-assisted security operations.
Potential capabilities include:
  • AI-generated security finding explanations.
  • Contextual risk and impact assessment.
  • Investigation recommendations.
  • MITRE ATT&CK technique mapping.
  • Suggested remediation actions.
  • Analyst-friendly security summaries.
The objective is not to replace SOC analysts or allow AI to automatically modify security resources.
Instead, I want to explore how AI can assist analysts in turning security findings into meaningful investigation steps.

Conclusion

Part 1 established the foundation of a lightweight Cloud SOC using AWS-native services, custom detection rules, centralized findings storage, and an authenticated dashboard.
Part 2 extends that foundation with an automated notification layer using DynamoDB Streams, AWS Lambda, and Amazon SNS.
The integration was successfully validated using both synthetic security findings and a real IAM CreateAccessKey event.
The most valuable aspect of this enhancement was the ability to introduce a centralized notification mechanism without redesigning the existing security ingestion pipelines.
A practical Cloud SOC is not only about collecting security events or displaying them in a dashboard.
It is also about delivering the right security information to the right people at the right time.
This is another step towards building a lightweight, customizable, and intelligent cloud security operations platform using AWS-native services.


Previous article:
Next article:
Part 3 – AI-Powered Cloud SOC Investigation Using Amazon Bedrock

Series: Building a Lightweight Cloud SOC on AWS (2 articles)

  1. 1
    Building a Lightweight Cloud SOC on AWS – Part 2: Automated Security Alerting with Amazon SNS This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article