v2026.1 Open Portal ↗
On this page

AWS Cloud Integration

Prerequisites

RequirementDetails
AWS accountIAM permissions to create roles and trust policies
StackFlow AWS accountAccount ID: 373544523367
StackFlow rolesuper_admin or cloud_admin
Target AWS accountsOne or more accounts to monitor

Step 1: Create Cross-Account IAM Role

Create an IAM role in each target AWS account that trusts the StackFlow account (373544523367):

# Create the cross-account trust policy
cat > trust-policy.json << 'EOF'
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": {"AWS": "arn:aws:iam::373544523367:role/StackFlowCloudDiscoveryRole"},
    "Action": "sts:AssumeRole",
    "Condition": {
      "StringEquals": {"sts:ExternalId": "stackflow-YOUR_TENANT_ID"}
    }
  }]
}
EOF

# Create the role
aws iam create-role   --role-name StackFlowCrossAccountRole   --assume-role-policy-document file://trust-policy.json

# Attach the read-only discovery policy
aws iam attach-role-policy   --role-name StackFlowCrossAccountRole   --policy-arn arn:aws:iam::aws:policy/ReadOnlyAccess

# For remediation capabilities, use a custom policy instead of ReadOnlyAccess:
aws iam put-role-policy   --role-name StackFlowCrossAccountRole   --policy-name StackFlowRemediation   --policy-document file://stackflow-remediation-policy.json
External ID: The ExternalId condition prevents the confused deputy attack. Your tenant-specific external ID is shown in Admin → Integration Hub → AWS Cloud → Setup. Never share it publicly.

Step 2: Configure CloudWatch Alarm Routing

  1. In each monitored AWS account, create an SNS topic: stackflow-alerts
  2. Add an HTTPS subscription pointing to: https://your-instance.stackflow-tech.com/prod/api/webhooks/inbound/cloudwatch
  3. Update your CloudWatch Alarms to notify the stackflow-alerts SNS topic
# Create SNS topic and subscription
aws sns create-topic --name stackflow-alerts
aws sns subscribe   --topic-arn arn:aws:sns:us-east-1:YOUR_ACCOUNT:stackflow-alerts   --protocol https   --notification-endpoint https://your-instance.stackflow-tech.com/prod/api/webhooks/inbound/cloudwatch

# Update a CloudWatch alarm to notify StackFlow
aws cloudwatch put-metric-alarm   --alarm-name "HighCPUUtilization"   --alarm-actions arn:aws:sns:us-east-1:YOUR_ACCOUNT:stackflow-alerts   --ok-actions arn:aws:sns:us-east-1:YOUR_ACCOUNT:stackflow-alerts

Step 3: Enable EC2/RDS/Lambda CMDB Sync

StackFlow's cloud discovery uses the cross-account IAM role to enumerate EC2 instances, RDS clusters, Lambda functions, ECS services, and other resource types and creates/updates corresponding CMDB CIs.

{
  "discovery_config": {
    "account_id": "123456789012",
    "role_arn": "arn:aws:iam::123456789012:role/StackFlowCrossAccountRole",
    "regions": ["us-east-1", "us-west-2"],
    "resource_types": ["ec2", "rds", "lambda", "ecs", "eks", "elasticache", "cloudfront"],
    "tag_filters": [{"key": "Environment", "values": ["production"]}],
    "sync_schedule": "0 */2 * * *"
  }
}

Step 4: Connect in StackFlow

  1. Navigate to Admin → Integration Hub → AWS Cloud → Add Account
  2. Enter the AWS Account ID and the Cross-Account Role ARN
  3. Enter the External ID (shown in the setup wizard)
  4. Select regions to monitor and resource types to discover
  5. Configure CloudWatch alarm-to-incident rules
  6. Click Save & Discover to trigger an initial discovery

CloudWatch Alarm to Incident Mapping

CloudWatch StateStackFlow ActionDefault Priority
ALARM (with tag severity:critical)Create P1 IncidentP1
ALARM (no severity tag)Create P2 IncidentP2
OK (alarm was P1/P2)Resolve existing incident
INSUFFICIENT_DATACreate P3 IncidentP3

CMDB Auto-Discovery

Discovery runs on a configurable schedule (default every 2 hours) and syncs the following resource types to CMDB CIs:

AWS ResourceCMDB CI ClassKey Attributes Synced
EC2 Instanceaws_ec2_instanceinstance_id, type, AZ, VPC, private IP, public IP, tags
RDS Clusteraws_rds_clustercluster_id, engine, version, endpoint, AZs, multi-AZ
Lambda Functionaws_lambdafunction_name, runtime, memory, timeout, VPC config
EKS Clusteraws_eks_clustercluster_name, k8s_version, endpoint, node_groups
ElastiCacheaws_elasticachecluster_id, engine, node_type, endpoint

Field Reference

FieldRequiredDescription
Account IDYes12-digit AWS account ID
Role ARNYesCross-account IAM role ARN
External IDYesTenant-specific external ID for assume-role security
RegionsYesList of AWS regions to monitor
Resource TypesNoResource types to discover (default: all)
Tag FiltersNoOnly discover resources with matching tags
Sync ScheduleNoCron expression for discovery schedule (default: every 2 hours)

Testing the Integration

  1. Click Test IAM Role to verify StackFlow can assume the cross-account role
  2. Click Run Discovery Now to trigger an immediate discovery and verify CIs appear in CMDB
  3. Trigger a test CloudWatch alarm and verify the StackFlow incident is created
# Manually set a CloudWatch alarm to ALARM state for testing
aws cloudwatch set-alarm-state   --alarm-name "HighCPUUtilization"   --state-value ALARM   --state-reason "Manual test for StackFlow integration"   --region us-east-1

Troubleshooting

IssueCauseFix
AssumeRole failsTrust policy missing or wrong account IDVerify trust policy lists 373544523367 as principal and ExternalId matches
CIs not discoveredTag filters too restrictiveRemove tag filters for initial test, then add them back
SNS subscription not confirmedStackFlow endpoint didn't confirm subscriptionCheck Lambda logs for SNS subscription confirmation call; retry from SNS console
Alarms creating duplicate incidentsMultiple SNS subscriptionsCheck for duplicate SNS subscriptions on the stackflow-alerts topic