The Hidden Dependencies in Your AWS Environment That Nobody Documented | PulseSoft
Skip to content

The Hidden Dependencies in Your AWS Environment That Nobody Documented

PulseSoft Team · · 12 min read

Introduction

The most dangerous thing about an inherited AWS environment isn't what you can see, it's what you can't. The Lambda function in the list doesn't tell you what calls it. The S3 bucket doesn't show you the six downstream processes that trigger on object creation. The SQS queue doesn't reveal that three different Lambda functions consume it and one of them runs a critical nightly reconciliation that nobody remembers building. These relationships exist in the form of IAM policies, event source mappings, EventBridge rules, and SNS subscriptions: none of which are visible in the AWS console resource view without actively looking for them.

AWS application dependency discovery in an existing cloud environment is a fundamentally different problem from pre-migration discovery. In a migration context, the dependency map tells you what order to move things. In an existing cloud estate, the dependency map tells you what's safe to change, what's safe to delete, and what's running code that nobody currently owns. The teams that skip this work operate in a permanent state of uncertainty: every change carries the risk of breaking something invisible, and every deletion carries the risk of removing infrastructure that something else depends on.

This post covers how to surface hidden dependencies in a live AWS environment using native AWS tooling.


The Specific Ways AWS Dependencies Hide

Cloud-native architectures create dependency relationships that are structurally different from on-premises server-to-server dependencies. On-premises, a dependency is usually a network connection, server A calls server B on a specific port. In AWS, dependencies take forms that don't show up in network traffic analysis at all:

Event-driven invocations. A Lambda function triggered by an S3 PutObject event doesn't make a network connection from S3 to Lambda, it's an asynchronous invocation managed by the AWS event system. The dependency exists as an S3 event notification configuration, not as a network flow. VPC Flow Logs won't show it. A network diagram won't show it. It only appears if you specifically query S3 event notification configurations.

IAM-mediated resource access. A Lambda function that reads from a DynamoDB table doesn't have a firewall rule or a network path that reveals the dependency: it has an IAM policy that allows the read. The dependency is encoded in identity, not in network topology. Mapping IAM policies to the resources they access is the only way to discover these relationships.

Scheduled and triggered invocations. EventBridge rules that invoke Lambda functions, Step Functions state machines, or ECS tasks on a schedule have no caller at rest: they only produce traffic when they fire. A rule that runs at 11pm on the last day of the month won't appear in X-Ray traces collected during business hours, won't appear in VPC Flow Logs unless the invoked function makes network calls, and won't appear in CloudWatch metrics until it fires.

Cross-account resource access. A Lambda function in account A that reads from an S3 bucket in account B via a cross-account IAM role has a dependency that doesn't appear in any single account's resource inventory. Each account sees its own side of the relationship but not the complete picture.

The concrete failure mode: a platform team at a SaaS company decided to migrate all Lambda functions from Node.js 14 (approaching end-of-life) to Node.js 20 as a batch update. They identified every Lambda function in the account, updated the runtime in a single Terraform apply, and deployed. Twenty-three of the 67 functions broke immediately, runtime compatibility issues with dependencies in their packages. But the more consequential failure was a single Lambda function whose runtime update broke its connection to an undocumented S3 event source that triggered a billing data export. The export ran nightly and had been running without issue for two years. The runtime update broke the function. The broken function produced no CloudWatch alarms because no alarm was configured for invocation errors on that specific function. The billing data gap was discovered eleven days later during a finance reconciliation. The dependency between the S3 bucket and the Lambda function had never been documented and didn't appear in any inventory the platform team was working from.


AWS Deep Dive: Native Tools for Dependency Discovery

AWS Config: The Resource Relationship Graph

AWS Config continuously records the configuration of AWS resources and maintains a resource relationship graph that maps how resources are connected to each other. This is the most underused dependency discovery tool in a live AWS environment.

Config's resource relationships capture connections that no other tool surfaces in a single place: which security groups are attached to which EC2 instances, which IAM roles are associated with which Lambda functions, which VPC subnets a resource is in, which KMS keys are encrypting which resources, which S3 buckets have event notifications configured.

The list-discovered-resources and get-resource-config-history APIs surface individual resource configuration, but the more powerful tool for dependency mapping is the Config advanced query interface, which allows SQL-like queries against the configuration snapshot:

# Find all Lambda functions and their associated IAM execution roles
aws configservice select-resource-config \
  --expression "
    SELECT
      resourceId,
      resourceName,
      configuration.functionName,
      configuration.role,
      configuration.runtime,
      configuration.lastModified
    WHERE
      resourceType = 'AWS::Lambda::Function'
    ORDER BY
      configuration.lastModified DESC
  "

# Find all S3 buckets with event notifications configured
aws configservice select-resource-config \
  --expression "
    SELECT
      resourceId,
      resourceName,
      configuration.notificationConfiguration
    WHERE
      resourceType = 'AWS::S3::Bucket'
      AND configuration.notificationConfiguration IS NOT NULL
  "

# Find all EventBridge rules and their targets
aws configservice select-resource-config \
  --expression "
    SELECT
      resourceId,
      resourceName,
      configuration.scheduleExpression,
      configuration.targets,
      configuration.state
    WHERE
      resourceType = 'AWS::Events::Rule'
  "

The non-obvious Config limitation that affects dependency discovery: Config only records resources that it supports. The supported resource list is extensive but not complete. Some newer resource types, some service-specific configuration objects (S3 event notification configurations are recorded on the bucket, not as separate resources), and some cross-account relationships don't appear in Config's resource graph. Config gives you the best starting point; supplementing with service-specific API calls fills the gaps.

Rendering diagram…

VPC Flow Logs and CloudTrail Lake for Traffic-Based Discovery

For dependencies that involve network traffic (EC2 instances calling RDS databases, Lambda functions in VPCs calling internal APIs, ECS tasks communicating with external services), VPC Flow Logs provide the empirical evidence of which resources actually communicate.

The flow log query approach for dependency discovery requires Athena or CloudWatch Logs Insights to query at scale. Querying CloudWatch Logs Insights for the most common source-destination pairs in a VPC:

# CloudWatch Logs Insights query for VPC Flow Logs
# Find the top communication pairs in the last 30 days
fields @timestamp, srcAddr, dstAddr, dstPort, action
| filter action = "ACCEPT"
| filter srcAddr not like /^10\.0\./  # Exclude internal-to-internal if focused on external
| stats count(*) as connectionCount by srcAddr, dstAddr, dstPort
| sort connectionCount desc
| limit 50

For CloudTrail-based dependency discovery, which surfaces IAM-mediated resource access rather than network access, CloudTrail Lake provides queryable event history that reveals which principals are accessing which resources:

-- Find all Lambda function ARNs that accessed a specific DynamoDB table
SELECT
  userIdentity.sessionContext.sessionIssuer.arn as lambda_role,
  eventName,
  COUNT(*) as call_count
FROM cloudtrail_lake_event_data_store
WHERE
  eventTime > '2025-01-01 00:00:00'
  AND eventSource = 'dynamodb.amazonaws.com'
  AND requestParameters LIKE '%payments-table%'
  AND userIdentity.type = 'AssumedRole'
GROUP BY
  userIdentity.sessionContext.sessionIssuer.arn,
  eventName
ORDER BY
  call_count DESC

This query reveals every IAM role (and by extension, every Lambda function or ECS task that assumes that role) that has accessed the DynamoDB table in the query period. It surfaces IAM-mediated dependencies that have no network expression, exactly the class of dependency that network analysis misses.

The non-obvious CloudTrail Lake behavior: CloudTrail Lake has a minimum retention of 90 days and maximum retention of 7 years, and it charges for data ingestion and query separately (verify current pricing at the AWS CloudTrail pricing page). For organizations that haven't enabled CloudTrail Lake, the standard CloudTrail S3 delivery can be queried via Athena with a similar approach, though the query setup is more complex.

AWS X-Ray Service Map for Active Traffic Dependencies

For applications with X-Ray instrumentation, the Service Map in the X-Ray console provides a real-time visualization of service-to-service call relationships, including external HTTP calls, DynamoDB reads and writes, SQS message produces and consumes, and Lambda-to-Lambda invocations. This is the closest thing to an automatically maintained dependency diagram that AWS provides.

The limitation: X-Ray only shows dependencies that have generated traced traffic during the observation window. Scheduled jobs that run infrequently, error handlers that only activate under specific conditions, and disaster recovery code paths that have never been exercised won't appear in the Service Map because they've never generated trace data.

For environments without X-Ray instrumentation, AWS Application Insights (part of CloudWatch) can be configured to automatically detect application dependencies from CloudWatch metrics and logs without requiring code instrumentation. It won't produce the same depth of trace-level data as X-Ray, but it surfaces resource relationships that are otherwise only visible through individual resource API calls.

A practical dependency discovery workflow that combines all three sources:

Phase 1: Config sweep (1-2 days)
├── Export all resource configurations via advanced query
├── Build initial resource inventory with relationships
└── Identify gaps: resource types Config doesn't cover

Phase 2: IAM analysis (2-3 days)
├── Query CloudTrail Lake for cross-resource access patterns
├── Map IAM roles to the resources they access
└── Surface cross-account relationships

Phase 3: Traffic analysis (ongoing, 2-4 weeks)
├── Enable VPC Flow Logs if not already active
├── Query CloudWatch Logs Insights for communication patterns
└── Enable X-Ray on Lambda and ECS workloads for trace data

Phase 4: Schedule and event analysis (1-2 days)
├── Export all EventBridge rules and targets
├── Export all Lambda event source mappings
├── Export all SNS subscriptions and SQS trigger configurations
└── Correlate with resource inventory from Phase 1

Enjoying this so far?

Join thousands of engineers receiving practical engineering, Cloud, Distributed Systems, Infrastructure and AI engineering insights.

No spam. Unsubscribe anytime.

Tradeoffs & Decision Framework

The depth of application discovery appropriate for a given AWS environment depends on the risk profile of changes being planned and the complexity of the environment.

Lightweight discovery (small environment, single account, low change risk): Config advanced queries for resource inventory, manual review of Lambda event source mappings and EventBridge rules. One to two days of work. Sufficient when the environment has fewer than 50 resources and the team has reasonable institutional knowledge of what was built. The gap this leaves: cross-account relationships and infrequently-triggered dependencies.

Structured discovery (multi-account, moderate complexity, planned architectural changes): Full Config sweep across accounts via Config Aggregator, CloudTrail Lake query for IAM-mediated access patterns, VPC Flow Logs analysis for network-based dependencies, manual EventBridge and SNS subscription export. One to two weeks of work. Required before any significant architectural change (Lambda runtime batch updates, VPC restructuring, IAM policy consolidation) in an environment with accumulated undocumented complexity.

Deep discovery (regulated environment, complex event-driven architecture, acquisition integration): All structured discovery methods plus X-Ray instrumentation deployment for active traffic mapping, application team interviews to surface institutional knowledge, and a formal dependency map reviewed and signed off by application owners. Three to six weeks of work. Required when the cost of an undiscovered dependency causing a production incident exceeds the cost of thorough discovery.

When to skip formal discovery and rely on impact management instead: For environments with fewer than 10 resources and a team that built them all within the last 12 months, formal discovery is overhead without proportionate value. Use change management practices (staging environment testing, gradual rollouts, monitoring for error rate changes after deployments) to catch undiscovered dependencies through impact rather than through pre-change discovery. This approach accepts that you'll discover some dependencies by breaking them, in an environment where the blast radius of a discovery-by-breaking is small.


Lessons From the Field

1. Lambda event source mappings are the most commonly undocumented dependency category. At every inherited AWS environment I've audited, Lambda event source mappings (SQS queues, Kinesis streams, DynamoDB streams, MSK topics configured as Lambda triggers), are the dependencies that documentation misses most consistently. They're configured at the Lambda function level, not at the event source level, which means looking at the queue doesn't tell you who's consuming it. Run aws lambda list-event-source-mappings with no filters against every account before touching any Lambda function or queue in an inherited environment.

2. EventBridge rules with no description field are the most dangerous infrastructure to modify. Inherited an AWS account at a fintech company with 47 EventBridge rules, 31 of which had empty description fields and names like rule-1, rule-prod-2, and scheduled-rule-legacy. Some were active. Some were disabled. Nobody could explain what the active ones did without tracing each rule's target Lambda function and reading its code. A rule with a description field that says "Triggers nightly reconciliation of payment records, contact payments-team@company.com before modifying" can be assessed in thirty seconds. A rule named rule-prod-2 with no description requires an hour of investigation. Tag and describe every EventBridge rule at creation time.

3. Cross-account dependencies are invisible to single-account discovery tools. Ran a discovery engagement for a logistics company with a 12-account AWS organization. Config Aggregator gave us a complete picture of resource relationships within each account. It did not surface the cross-account relationships: an IAM role in the shared services account assumed by Lambda functions in five product accounts, an S3 bucket in the data account accessed by resources in three other accounts, a Transit Gateway attachment that had a route to the management account's network that nobody had documented. Cross-account dependency discovery requires querying CloudTrail across accounts (via CloudTrail Lake with organization-level data collection) and reviewing IAM trust policies and resource policies for cross-account principals.

4. The dependency that breaks you is always the one that was added informally. In every application discovery engagement, the most dangerous undocumented dependencies share a common history: they were added by a developer who needed a quick integration, they worked, and nobody updated the architecture documentation. A Lambda function that started calling an S3 bucket in a different account "just to test something" that turned out to be load-bearing. An EventBridge rule that was created for a one-time data migration that became the mechanism for a permanent data sync. These informal additions are exactly what Config, CloudTrail, and VPC Flow Logs surface, network analysis shows the connection, even when documentation doesn't.

5. Running aws lambda list-event-source-mappings and aws events list-rules across all accounts takes 30 minutes and surfaces more hidden dependencies than a week of interviews. The tooling for application discovery in AWS is available and fast. The friction isn't in running the commands, it's in deciding to do the work before a change causes a problem. At a media company, running a full event source mapping export took forty-five minutes and identified a Lambda function consuming a Kinesis stream that the platform team was planning to delete as "unused." The function was running a critical real-time content moderation pipeline. It had no description, no tags, and hadn't been mentioned in any inventory. Forty-five minutes of tooling work prevented a content moderation outage.


Final Thoughts

The tooling for AWS application dependency discovery is significantly better than it was three years ago. AWS Config's advanced query interface, CloudTrail Lake's SQL-based event history, and the Service Map in X-Ray provide a level of visibility into resource relationships that previously required expensive third-party tools or significant manual effort. Organizations with Config Aggregator, organization-level CloudTrail, and X-Ray instrumentation on their Lambda and ECS workloads have access to a near-complete picture of their dependency graph through native AWS tooling.

What the tooling doesn't solve is the practice problem: most teams don't run discovery until something breaks, when the discovery is no longer proactive. The organizations that treat application dependency discovery as a routine practice (running Config queries before significant changes, reviewing CloudTrail access patterns quarterly, maintaining X-Ray instrumentation on active workloads), are the organizations that don't get surprised by hidden dependencies.

The shift is from discovery as a migration activity to discovery as an ongoing operational practice. In an environment that's continuously evolving (new Lambda functions, new EventBridge rules, new cross-service integrations), the dependency map that's accurate today is incomplete next quarter. Treating discovery as a one-time event rather than a continuous practice means the map is always a few changes behind reality.


Key Takeaways

  • AWS cloud dependencies hide in event-driven invocations, IAM policies, and scheduled triggers: not in network connections. VPC Flow Logs miss Lambda event source mappings, EventBridge rules, and IAM-mediated resource access entirely. Use service-specific API calls and CloudTrail alongside network analysis.
  • AWS Config's advanced query interface is the most efficient starting point for dependency mapping in an existing AWS environment. SQL-like queries against the resource configuration snapshot surface IAM role associations, event notification configurations, and resource relationships across the full account inventory in minutes.
  • CloudTrail Lake SQL queries reveal IAM-mediated dependencies that have no network expression. Querying for which roles accessed a specific DynamoDB table or S3 bucket in the past 90 days surfaces every Lambda function or ECS task that depends on that resource, regardless of whether they're in the same VPC.
  • Lambda event source mappings are the most consistently undocumented dependency category in inherited AWS environments. Run aws lambda list-event-source-mappings with no filters before touching any Lambda function or queue. The trigger configuration lives on the function, not on the event source, looking at the queue doesn't show who's consuming it.
  • X-Ray Service Map shows active traffic dependencies but misses infrequently-triggered code paths. Scheduled jobs, error handlers, and DR code paths that haven't fired during the observation window won't appear. Supplement X-Ray with EventBridge rule exports and explicit schedule documentation.
  • Cross-account dependencies are invisible to single-account discovery tools. Config Aggregator surfaces within-account relationships. Cross-account relationships require CloudTrail Lake with organization-level collection and IAM trust policy review to surface which principals in other accounts are accessing your resources.
  • Run discovery before changes, not after incidents. The 45-minute investment of running Config queries, event source mapping exports, and CloudTrail analysis before a significant architectural change consistently prevents the production incident that would have made the discovery mandatory.

Get insights like this in your inbox

Join thousands of engineers receiving practical engineering, Cloud, Distributed Systems, Infrastructure and AI engineering insights.

No spam. Unsubscribe anytime.