AWS Security Incident Response Slack Integration - Troubleshooting Guide
December 16, 2025 ยท View on GitHub
This document provides detailed information on validation, troubleshooting, diagnostics, and security considerations for the AWS Security Incident Response Slack integration.
Table of Contents
- Outputs and Validation
- Common Issues and Solutions
- Diagnostic Steps
- Checklist in case of any errors
- Security Considerations
- Performance Optimization
Outputs and Validation
After deploying the stack, you'll receive CloudFormation outputs that can be used to validate and troubleshoot the integration.
CloudFormation Outputs
SlackEventsApiEndpoint
This output provides the API Gateway endpoint URL for Slack webhooks.
Format: https://<api-id>.execute-api.<region>.amazonaws.com/prod/slack/events
How to use it:
-
Configure Slack Event Subscriptions:
- Copy this URL
- Go to your Slack app settings > Event Subscriptions
- Paste the URL in the "Request URL" field
- Slack will verify the endpoint (you should see a green checkmark)
-
Configure Slack Slash Commands:
- Go to your Slack app settings > Slash Commands
- Use the same URL for the
/security-ircommand Request URL
-
Test the Endpoint:
curl -X POST <SlackEventsApiEndpoint> \ -H "Content-Type: application/json" \ -d '{"type":"url_verification","challenge":"test123"}'
SlackClientLambdaArn
This output provides the ARN of the Slack Client Lambda function.
How to use it for validation:
-
Verify Lambda Function:
aws lambda get-function --function-name <SlackClientLambdaArn> -
Check Lambda Logs:
FUNCTION_NAME=$(echo <SlackClientLambdaArn> | cut -d':' -f7) aws logs tail "/aws/lambda/$FUNCTION_NAME" --follow -
Monitor Invocations:
- Navigate to AWS Console > Lambda
- Search for the function using the ARN
- Check the "Monitor" tab for invocation metrics
SlackEventsBoltHandlerLambdaLogGroup
This output provides the CloudWatch Logs group name for the Slack Events Bolt Handler Lambda.
How to use it:
-
View Recent Logs:
aws logs tail <SlackEventsBoltHandlerLambdaLogGroup> --follow -
Search for Errors:
aws logs filter-log-events \ --log-group-name <SlackEventsBoltHandlerLambdaLogGroup> \ --filter-pattern "ERROR" \ --limit 20 -
Create Metric Filter:
aws logs put-metric-filter \ --log-group-name <SlackEventsBoltHandlerLambdaLogGroup> \ --filter-name "SlackEventErrors" \ --filter-pattern "ERROR" \ --metric-transformations \ metricName=ErrorCount,metricNamespace=SlackIntegration,metricValue=1
SlackCommandHandlerLambdaLogGroup
This output provides the CloudWatch Logs group name for the Slack Command Handler Lambda.
How to use it:
-
Monitor Command Execution:
aws logs tail <SlackCommandHandlerLambdaLogGroup> --follow -
Track Command Usage:
aws logs filter-log-events \ --log-group-name <SlackCommandHandlerLambdaLogGroup> \ --filter-pattern "command" \ --limit 50
Validating Slack Configuration
Verify Slack App Installation
-
Check App Status:
- Go to https://api.slack.com/apps
- Select your app
- Verify "Install App" shows "Installed to Workspace"
-
Verify Bot Token:
- Go to "OAuth & Permissions"
- Ensure "Bot User OAuth Token" is displayed
- Token should start with
xoxb-
-
Verify Permissions:
- In "OAuth & Permissions", check "Scopes"
- Ensure all required bot token scopes are present
Verify Event Subscriptions
-
Check URL Verification:
- Go to "Event Subscriptions"
- Verify Request URL shows a green checkmark
- If not verified, check API Gateway and Lambda logs
-
Verify Subscribed Events:
- Ensure the following events are subscribed:
message.channelsmessage.groupsmember_joined_channelmember_left_channelfile_shared
- Ensure the following events are subscribed:
Verify Slash Commands
-
Check Command Configuration:
- Go to "Slash Commands"
- Verify
/security-ircommand exists - Verify Request URL matches API Gateway endpoint
-
Test Command in Slack:
- In any channel, type
/security-ir - Command should autocomplete
- Even without a case, it should be recognized
- In any channel, type
Validating AWS Resources
Check DynamoDB Table
-
Verify Table Exists:
aws dynamodb describe-table \ --table-name <IncidentsTableName> -
Check Mapping Records:
aws dynamodb scan \ --table-name <IncidentsTableName> \ --filter-expression "attribute_exists(slackChannelId)"
Check SSM Parameters
-
Verify Parameters Exist:
aws ssm get-parameter \ --name /SecurityIncidentResponse/slackBotToken \ --with-decryption aws ssm get-parameter \ --name /SecurityIncidentResponse/slackSigningSecret \ --with-decryption aws ssm get-parameter \ --name /SecurityIncidentResponse/slackWorkspaceId -
Validate Parameter Formats:
python scripts/slack_parameter_setup.py validate
Check EventBridge Rules
-
Verify Rules Exist:
aws events list-rules \ --event-bus-name security-incident-event-bus -
Check Rule Targets:
aws events list-targets-by-rule \ --rule slack-client-rule \ --event-bus-name security-incident-event-bus
Common Issues and Solutions
Deployment Issues
Issue: CloudFormation Stack Fails to Deploy
Symptoms:
- CloudFormation stack creation fails
- Error message about parameter validation
Possible Causes:
- Invalid parameter format
- Missing required parameters
- Insufficient IAM permissions
Solutions:
-
Verify Parameter Formats:
# Bot token should start with xoxb- echo "xoxb-YOUR-BOT-TOKEN" | grep -E '^xoxb-[0-9]+-[0-9]+-[a-zA-Z0-9]+$' # Signing secret should be 32 hex characters echo "a1b2c3d4..." | grep -E '^[a-f0-9]{32}$' # Workspace ID should be 9-11 uppercase alphanumeric echo "T1234567890" | grep -E '^[A-Z0-9]{9,11}$' -
Check IAM Permissions:
- Ensure you have permissions to create CloudFormation stacks
- Verify permissions for Lambda, API Gateway, EventBridge, DynamoDB, SSM
-
Review CloudFormation Events:
aws cloudformation describe-stack-events \ --stack-name AwsSecurityIncidentResponseSlackIntegrationStack \ --max-items 20
Issue: Lambda Layer Deployment Fails
Symptoms:
- Stack deployment fails at Lambda layer creation
- Error about layer size or dependencies
Solutions:
-
Check Layer Size:
- Lambda layers have a 250 MB unzipped size limit
- Verify Slack Bolt dependencies are within limits
-
Rebuild Layers:
cd assets/slack_bolt_layer pip install -r requirements.txt -t python/
Slack Configuration Issues
Issue: Event Subscriptions URL Verification Fails
Symptoms:
- Slack shows "Your URL didn't respond with the value of the challenge parameter"
- Red X next to Request URL in Slack app settings
Possible Causes:
- API Gateway endpoint not accessible
- Lambda function not responding correctly
- Incorrect endpoint URL
Solutions:
-
Test API Gateway Endpoint:
curl -X POST <SlackEventsApiEndpoint> \ -H "Content-Type: application/json" \ -d '{"type":"url_verification","challenge":"test123"}'Expected response:
{"challenge":"test123"} -
Check Lambda Logs:
aws logs tail /aws/lambda/SlackEventsBoltHandler --follow -
Verify API Gateway Configuration:
- Go to AWS Console > API Gateway
- Check that
/slack/eventsroute exists - Verify Lambda integration is configured
-
Check Lambda Permissions:
- Ensure API Gateway has permission to invoke Lambda
- Verify Lambda execution role has necessary permissions
Issue: Slash Commands Not Working
Symptoms:
/security-ircommand not recognized in Slack- Command returns error or no response
Possible Causes:
- Command not configured in Slack app
- Incorrect Request URL
- Lambda function error
Solutions:
-
Verify Command Configuration:
- Go to Slack app settings > Slash Commands
- Ensure
/security-irexists - Verify Request URL matches API Gateway endpoint
-
Test Command Manually:
- Use command in an incident channel
- Check Slack Command Handler Lambda logs
-
Check Lambda Timeout:
- Slash commands must respond within 3 seconds
- Verify Lambda timeout is set appropriately
Integration Issues
Issue: Slack Channel Not Created for New Case
Symptoms:
- AWS Security IR case created
- No corresponding Slack channel appears
Possible Causes:
- Slack Client Lambda not triggered
- Bot lacks channel creation permissions
- Invalid bot token
Solutions:
-
Check EventBridge Rule:
aws events list-targets-by-rule \ --rule slack-client-rule \ --event-bus-name security-incident-event-bus -
Check Slack Client Lambda Logs:
aws logs tail /aws/lambda/SecurityIncidentResponseSlackClient --follow -
Verify Bot Permissions:
- Ensure bot has
channels:managescope - Check bot token is valid
- Ensure bot has
-
Test Bot Token:
curl -X POST https://slack.com/api/auth.test \ -H "Authorization: Bearer <bot-token>"
Issue: Messages Not Syncing from Slack to AWS SIR
Symptoms:
- Messages posted in Slack channel
- Comments not appearing in AWS Security IR case
Possible Causes:
- Bot not member of channel
- Event Subscriptions not configured
- Lambda function error
Solutions:
-
Verify Bot is Channel Member:
- Check channel members list
- Invite bot if not present:
/invite @AWS Security IR Integration
-
Check Event Subscriptions:
- Verify
message.channelsevent is subscribed - Check Request URL is verified
- Verify
-
Check Lambda Logs:
aws logs tail /aws/lambda/SlackEventsBoltHandler --follow -
Verify DynamoDB Mapping:
aws dynamodb get-item \ --table-name <IncidentsTableName> \ --key '{"PK":{"S":"Case#<caseId>"},"SK":{"S":"latest"}}'
Issue: Comments Not Syncing from AWS SIR to Slack
Symptoms:
- Comments added to AWS Security IR case
- Messages not appearing in Slack channel
Possible Causes:
- Missing
slackChannelIdin DynamoDB - Slack Client Lambda not triggered
- Bot lacks message posting permissions
Solutions:
-
Check DynamoDB Record:
aws dynamodb get-item \ --table-name <IncidentsTableName> \ --key '{"PK":{"S":"Case#<caseId>"},"SK":{"S":"latest"}}' \ --query 'Item.slackChannelId' -
Verify EventBridge Events:
aws logs filter-log-events \ --log-group-name /aws/events/security-incident-event-bus \ --filter-pattern "Comment Added" -
Check Slack Client Lambda:
aws logs tail /aws/lambda/SecurityIncidentResponseSlackClient --follow
Issue: Attachments Not Syncing
Symptoms:
- Files uploaded to Slack or AWS SIR
- Attachments not appearing in the other system
Possible Causes:
- File size exceeds limits
- Bot lacks file permissions
- Lambda function error
Solutions:
-
Check File Size:
- Slack free tier: 5 GB per file
- AWS Security IR: Check service limits
-
Verify Bot Permissions:
- Ensure bot has
files:readandfiles:writescopes
- Ensure bot has
-
Check Lambda Logs:
aws logs filter-log-events \ --log-group-name /aws/lambda/SlackEventsBoltHandler \ --filter-pattern "file_shared"
Authentication Issues
Issue: Slack API Returns "invalid_auth" Error
Symptoms:
- Lambda logs show "invalid_auth" error
- Slack operations fail
Possible Causes:
- Bot token expired or revoked
- Bot token not properly stored in SSM
- Bot not installed to workspace
Solutions:
-
Verify Bot Token in SSM:
aws ssm get-parameter \ --name /SecurityIncidentResponse/slackBotToken \ --with-decryption \ --query 'Parameter.Value' -
Test Bot Token:
curl -X POST https://slack.com/api/auth.test \ -H "Authorization: Bearer <bot-token>" -
Regenerate and Rotate Token:
- Go to Slack app settings > OAuth & Permissions
- Click "Regenerate" under Bot User OAuth Token
- Update SSM parameter:
python scripts/slack_parameter_setup.py rotate \ --bot-token "<new-token>" \ --signing-secret "<signing-secret>" \ --workspace-id "<workspace-id>"
Issue: Webhook Signature Verification Fails
Symptoms:
- Lambda logs show signature verification errors
- Slack events not processed
Possible Causes:
- Incorrect signing secret in SSM
- Clock skew between systems
- Request replay attack prevention
Solutions:
-
Verify Signing Secret:
aws ssm get-parameter \ --name /SecurityIncidentResponse/slackSigningSecret \ --with-decryption -
Check Signing Secret in Slack:
- Go to Slack app settings > Basic Information
- Compare with SSM parameter value
-
Update Signing Secret:
python scripts/slack_parameter_setup.py rotate \ --bot-token "<bot-token>" \ --signing-secret "<new-secret>" \ --workspace-id "<workspace-id>"
Diagnostic Steps
End-to-End Testing
Test 1: AWS SIR to Slack Flow
-
Create Test Case:
aws security-ir create-case \ --title "Test Case for Slack Integration" \ --description "Testing bidirectional sync" \ --severity "Medium" -
Verify Channel Creation:
- Check Slack for new channel:
aws-security-incident-response-case-<caseId> - Verify initial notification posted
- Check Slack for new channel:
-
Check Logs:
aws logs tail /aws/lambda/SecurityIncidentResponseSlackClient --follow -
Verify DynamoDB:
aws dynamodb scan \ --table-name <IncidentsTableName> \ --filter-expression "attribute_exists(slackChannelId)"
Test 2: Slack to AWS SIR Flow
-
Post Message in Channel:
- Go to incident channel in Slack
- Post a test message
-
Verify Comment in AWS SIR:
aws security-ir list-comments --case-id <caseId> -
Check Logs:
aws logs tail /aws/lambda/SlackEventsBoltHandler --follow
Test 3: Slash Commands
-
Test Status Command:
- In incident channel, type:
/security-ir status - Verify response with case details
- In incident channel, type:
-
Test Update Command:
- Type:
/security-ir update-status Investigating - Verify case status updated in AWS SIR
- Type:
-
Check Logs:
aws logs tail /aws/lambda/SlackCommandHandler --follow
Performance Testing
Monitor Lambda Performance
-
Check Execution Duration:
aws cloudwatch get-metric-statistics \ --namespace AWS/Lambda \ --metric-name Duration \ --dimensions Name=FunctionName,Value=SecurityIncidentResponseSlackClient \ --start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) \ --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \ --period 300 \ --statistics Average,Maximum -
Check Error Rate:
aws cloudwatch get-metric-statistics \ --namespace AWS/Lambda \ --metric-name Errors \ --dimensions Name=FunctionName,Value=SecurityIncidentResponseSlackClient \ --start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) \ --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \ --period 300 \ --statistics Sum
Monitor API Gateway Performance
-
Check API Latency:
aws cloudwatch get-metric-statistics \ --namespace AWS/ApiGateway \ --metric-name Latency \ --dimensions Name=ApiName,Value=SlackEventsApi \ --start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) \ --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \ --period 300 \ --statistics Average,Maximum -
Check API Errors:
aws cloudwatch get-metric-statistics \ --namespace AWS/ApiGateway \ --metric-name 5XXError \ --dimensions Name=ApiName,Value=SlackEventsApi \ --start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) \ --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \ --period 300 \ --statistics Sum
Checklist in case of any errors
- Check Lambda error rates in CloudWatch
- Review CloudWatch Logs for pattern
- Review CloudWatch alarms
Security Considerations
Credential Management
-
Regular Rotation:
- Rotate bot token every 90 days
- Rotate signing secret every 90 days
- Use parameter rotation script
-
Access Control:
- Limit SSM parameter access to specific IAM roles
- Use resource-specific IAM policies
- Enable CloudTrail logging for parameter access
-
Monitoring:
- Set up CloudWatch alarms for unauthorized access
- Review CloudTrail logs regularly
- Monitor for unusual API activity
Network Security
-
API Gateway:
- Enable request validation
- Configure rate limiting
- Use AWS WAF for additional protection
-
Lambda Functions:
- Deploy in VPC if required
- Use security groups and NACLs
- Enable VPC Flow Logs
Data Protection
-
Encryption:
- All SSM parameters use SecureString with KMS
- DynamoDB encryption at rest enabled
- TLS for all API communications
-
Data Handling:
- Never log sensitive data (tokens, passwords, PII)
- Sanitize user input
- Implement proper error handling
Compliance
-
Audit Trail:
- CloudTrail logs all API calls
- CloudWatch Logs retain for compliance period
- DynamoDB point-in-time recovery enabled
-
Access Logging:
- API Gateway access logs enabled
- Lambda execution logs enabled
- EventBridge event logging enabled
Performance Optimization
Lambda Optimization
-
Memory Allocation:
- Slack Client: 512 MB (recommended)
- Events Handler: 512 MB (recommended)
- Command Handler: 256 MB (recommended)
-
Timeout Configuration:
- Slack Client: 15 minutes (for large attachments)
- Events Handler: 30 seconds (Slack requirement)
- Command Handler: 30 seconds (Slack requirement)
-
Cold Start Mitigation:
- Use provisioned concurrency for critical functions
- Optimize package size
- Use Lambda layers for shared dependencies
DynamoDB Optimization
-
Capacity Planning:
- Use on-demand billing for variable workloads
- Monitor consumed capacity
- Set up auto-scaling if using provisioned capacity
-
Query Optimization:
- Use efficient key design (PK/SK pattern)
- Create GSIs for common query patterns
- Use consistent reads only when necessary
API Gateway Optimization
-
Caching:
- Enable caching for GET requests if applicable
- Set appropriate TTL values
-
Throttling:
- Configure appropriate throttle limits
- Use usage plans for different consumers
Advanced Troubleshooting
Enable Debug Logging
-
Redeploy with Debug Logging:
./deploy-integrations-solution.py slack \ --bot-token "<bot-token>" \ --signing-secret "<signing-secret>" \ --workspace-id "<workspace-id>" \ --log-level debug -
View Debug Logs:
aws logs tail /aws/lambda/SecurityIncidentResponseSlackClient \ --follow \ --filter-pattern "DEBUG"
Trace Requests with Correlation IDs
-
Find Correlation ID in Logs:
aws logs filter-log-events \ --log-group-name /aws/lambda/SlackEventsBoltHandler \ --filter-pattern "correlation_id" -
Trace Across Services:
- Use correlation ID to trace request through Lambda, EventBridge, DynamoDB
Analyze Dead Letter Queues
-
Check DLQ Messages:
aws sqs receive-message \ --queue-url <DLQ-URL> \ --max-number-of-messages 10 -
Reprocess Failed Events:
- Analyze failure reason
- Fix underlying issue
- Manually reprocess or redrive messages
Getting Help
Support Resources
-
AWS Support:
- Open a support case in AWS Console
- Include CloudFormation stack name and error details
-
Slack API Support:
- Visit https://api.slack.com/support
- Check Slack API status page
-
Community Resources:
- AWS Security Incident Response documentation
- Slack Bolt framework documentation
- GitHub issues and discussions
Collecting Diagnostic Information
When requesting support, collect:
-
CloudFormation Stack Details:
aws cloudformation describe-stacks \ --stack-name AwsSecurityIncidentResponseSlackIntegrationStack -
Lambda Function Logs:
aws logs tail /aws/lambda/SecurityIncidentResponseSlackClient \ --since 1h > slack-client-logs.txt -
EventBridge Metrics:
aws cloudwatch get-metric-statistics \ --namespace AWS/Events \ --metric-name FailedInvocations \ --dimensions Name=RuleName,Value=slack-client-rule \ --start-time $(date -u -d '1 hour ago' +%Y-%m-%dT%H:%M:%S) \ --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \ --period 300 \ --statistics Sum -
DynamoDB Table Status:
aws dynamodb describe-table \ --table-name <IncidentsTableName>