DynamoDB returns GlobalTableNotFoundException when you attempt to perform operations on a global table that doesn't exist or isn't properly configured. This error occurs when referencing a global table name that hasn't been created, is still being replicated across regions, or has been deleted from the global tables configuration.
The GlobalTableNotFoundException error in DynamoDB indicates that your application is trying to access a global table that cannot be found in your AWS account's global tables configuration. This error occurs in several scenarios: 1. **Global table doesn't exist**: You're referencing a global table name that hasn't been created yet or was deleted from the global tables configuration 2. **Table exists but isn't a global table**: The underlying DynamoDB table exists as a regular table but hasn't been enabled for global tables 3. **Replication still in progress**: The global table is being created or modified and replication across regions hasn't completed 4. **Region mismatch**: You're accessing a region where the global table hasn't been replicated yet 5. **Configuration drift**: The global table configuration in one region differs from other regions DynamoDB global tables provide multi-region replication for high availability and disaster recovery. When you enable global tables on a DynamoDB table, it becomes a multi-region resource with automatic data synchronization. The GlobalTableNotFoundException specifically relates to the global tables feature, not regular table operations.
First, check if the global table exists and confirm its replication status:
# List all global tables in the region
aws dynamodb list-global-tables
# Describe a specific global table to check its status
aws dynamodb describe-global-table --global-table-name YourGlobalTableName
# Check global table regions and replication status
aws dynamodb describe-global-table --global-table-name YourGlobalTableName \
--query 'GlobalTableDescription.ReplicationGroup[*].{Region:RegionName,Status:ReplicationStatus}'
# Check if underlying table exists as regular table
aws dynamodb describe-table --table-name YourGlobalTableNameCommon checks:
- Verify the table name matches exactly (case-sensitive)
- Check if table exists as a regular table first
- Confirm global tables are enabled on the table
- Verify replication status shows "ACTIVE" in all regions
If the global table is being created or modified, wait for replication to complete:
# Wait for global table to become active
while true; do
status=$(aws dynamodb describe-global-table --global-table-name YourGlobalTableName \
--query 'GlobalTableDescription.GlobalTableStatus' \
--output text)
if [ "$status" = "ACTIVE" ]; then
echo "Global table is ACTIVE"
break
fi
echo "Global table status: $status - waiting..."
sleep 30
done
# Check replication status in all regions
aws dynamodb describe-global-table --global-table-name YourGlobalTableName \
--query 'GlobalTableDescription.ReplicationGroup[*].{Region:RegionName,Status:ReplicationStatus}' \
--output table
# Monitor creation progress
aws dynamodb describe-global-table-settings --global-table-name YourGlobalTableNameReplication timing:
- Initial global table creation can take several minutes
- Adding new regions to existing global table takes time
- Large tables require more time for initial data sync
- Replication status shows: CREATING → ACTIVE → UPDATING → DELETING
Verify your application's AWS configuration for global table operations:
// AWS SDK v3 for JavaScript - global table operations
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { DescribeGlobalTableCommand } from '@aws-sdk/client-dynamodb';
const client = new DynamoDBClient({
region: 'us-east-1', // Region where global table was created
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
}
});
// Check global table existence
try {
const command = new DescribeGlobalTableCommand({
GlobalTableName: 'YourGlobalTableName'
});
const response = await client.send(command);
console.log('Global table exists:', response.GlobalTableDescription);
} catch (error) {
if (error.name === 'GlobalTableNotFoundException') {
console.error('Global table not found');
// Check if regular table exists first
const regularTableExists = await checkRegularTable('YourGlobalTableName');
if (regularTableExists) {
console.log('Table exists but global tables not enabled');
}
}
}
// IAM permissions check for global table operations
// Required permissions: dynamodb:DescribeGlobalTable, dynamodb:UpdateGlobalTable, etc.Configuration checks:
- Verify AWS_REGION environment variable matches global table creation region
- Check IAM permissions include global table operations
- For cross-region access, use appropriate regional endpoints
- Verify SDK version supports global table APIs
If the global table doesn't exist, create it correctly:
# First, ensure the base table exists
aws dynamodb create-table --table-name YourGlobalTableName --attribute-definitions AttributeName=id,AttributeType=S --key-schema AttributeName=id,KeyType=HASH --billing-mode PAY_PER_REQUEST
# Wait for table to become active
aws dynamodb wait table-exists --table-name YourGlobalTableName
# Create global table (enable multi-region replication)
aws dynamodb create-global-table --global-table-name YourGlobalTableName --replication-group RegionName=us-east-1
# Add additional regions if needed
aws dynamodb update-global-table --global-table-name YourGlobalTableName --replica-updates '{"Create": {"RegionName": "eu-west-1"}}'
# Verify global table creation
aws dynamodb describe-global-table --global-table-name YourGlobalTableNameImportant considerations:
- Base table must exist before enabling global tables
- First region in replication group is the primary region
- Table must use provisioned capacity or on-demand mode (not reserved)
- Table schema and settings are replicated across all regions
- Global tables require DynamoDB Streams to be enabled
Investigate permission issues and review audit logs:
# Check IAM permissions for the role/user
aws iam get-policy-version --policy-arn arn:aws:iam::123456789012:policy/YourPolicyName --version-id v1
# Simulate permissions for global table operations
aws iam simulate-principal-policy --policy-source-arn arn:aws:iam::123456789012:role/YourRole --action-names dynamodb:DescribeGlobalTable dynamodb:UpdateGlobalTable
# Search CloudTrail for global table operations
aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=CreateGlobalTable --start-time $(date -u -d '24 hours ago' +%s) --end-time $(date -u +%s) --query 'Events[?contains(CloudTrailEvent, "YourGlobalTableName")]'
# Check for DeleteGlobalTable events
aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=DeleteGlobalTable --start-time $(date -u -d '7 days ago' +%s) --end-time $(date -u +%s)Permission requirements:
- dynamodb:DescribeGlobalTable
- dynamodb:UpdateGlobalTable
- dynamodb:CreateGlobalTable
- dynamodb:DeleteGlobalTable
- dynamodb:UpdateGlobalTableSettings
- Plus regular table permissions for data operations
Add defensive programming for global table operations:
async function ensureGlobalTableExists(globalTableName, regions) {
try {
const describeCommand = new DescribeGlobalTableCommand({
GlobalTableName: globalTableName
});
const response = await dynamodbClient.send(describeCommand);
// Check if all required regions are present
const existingRegions = response.GlobalTableDescription.ReplicationGroup.map(r => r.RegionName);
const missingRegions = regions.filter(region => !existingRegions.includes(region));
if (missingRegions.length > 0) {
console.log('Adding missing regions: ' + missingRegions.join(', '));
await addRegionsToGlobalTable(globalTableName, missingRegions);
}
return response.GlobalTableDescription;
} catch (error) {
if (error.name === 'GlobalTableNotFoundException') {
console.log('Global table ' + globalTableName + ' not found, creating...');
// First ensure base table exists
await ensureTableExists(globalTableName);
// Create global table
const createCommand = new CreateGlobalTableCommand({
GlobalTableName: globalTableName,
ReplicationGroup: regions.map(region => ({ RegionName: region }))
});
const createResponse = await dynamodbClient.send(createCommand);
console.log('Global table ' + globalTableName + ' created');
// Wait for active status
await waitForGlobalTableActive(globalTableName);
return createResponse.GlobalTableDescription;
}
throw error;
}
}
async function waitForGlobalTableActive(globalTableName, maxWaitMinutes = 10) {
const startTime = Date.now();
while (Date.now() - startTime < maxWaitMinutes * 60 * 1000) {
try {
const command = new DescribeGlobalTableCommand({ GlobalTableName: globalTableName });
const response = await dynamodbClient.send(command);
if (response.GlobalTableDescription.GlobalTableStatus === 'ACTIVE') {
console.log('Global table ' + globalTableName + ' is ACTIVE');
return true;
}
console.log('Global table status: ' + response.GlobalTableDescription.GlobalTableStatus);
await new Promise(resolve => setTimeout(resolve, 30000)); // Wait 30 seconds
} catch (error) {
console.error('Error checking global table status:', error);
return false;
}
}
throw new Error('Global table ' + globalTableName + ' did not become active within ' + maxWaitMinutes + ' minutes');
}Best practices:
- Always check global table existence before operations
- Implement retry logic with exponential backoff
- Fall back to regular table operations if global table unavailable
- Monitor replication status and region health
- Use infrastructure-as-code for consistent global table configuration
## GlobalTableNotFoundException Deep Dive
### Global Tables Architecture
DynamoDB global tables use a multi-master replication model:
1. Primary region: First region where global table is created (conceptual, not technical)
2. Replication group: All regions where table is replicated
3. Conflict resolution: Last writer wins based on timestamp
4. Data consistency: Eventually consistent across regions (typically within 1 second)
### Global Table States
Global tables go through specific states:
1. CREATING: Initial creation, replication being set up
2. ACTIVE: Fully operational, accepting writes in all regions
3. UPDATING: Adding/removing regions or changing settings
4. DELETING: Global table being removed (underlying tables remain)
### Common Configuration Issues
Region sequencing problems:
- Attempting to create global table in region where base table doesn't exist
- Adding regions before initial replication completes
- Removing primary region before other regions
Capacity mode conflicts:
- Global tables require consistent billing mode across all regions
- Cannot mix provisioned and on-demand capacity
- Auto-scaling settings must be managed per region
Stream requirements:
- DynamoDB Streams must be enabled with NEW_AND_OLD_IMAGES
- Stream ARN format differs for global tables
- Stream consumption must handle multi-region writes
### Cross-Region Considerations
Latency and performance:
- Writes go to local region, replicate asynchronously
- Read-after-write consistency only within same region
- Consider routing writes to nearest region for users
Cost implications:
- Data transfer charges between regions
- Replicated write capacity units (WCUs)
- Monitoring costs across multiple regions
Disaster recovery:
- Global tables provide automatic failover
- Application must handle regional endpoint failover
- DNS-based or SDK-based region routing
### Debugging Checklist
When facing GlobalTableNotFoundException:
1. [ ] Run aws dynamodb list-global-tables in the creation region
2. [ ] Verify base table exists with describe-table
3. [ ] Check global table status with describe-global-table
4. [ ] Confirm IAM permissions include global table operations
5. [ ] Verify AWS region configuration matches global table regions
6. [ ] Check CloudTrail for CreateGlobalTable/DeleteGlobalTable events
7. [ ] Review replication group configuration
8. [ ] Test with AWS CLI using same credentials/region
### When Global Tables Aren't Appropriate
Consider alternatives when:
- Strong consistency required: Use single-region table with cross-region reads
- Cost sensitivity: Data transfer between regions can be expensive
- Regulatory compliance: Data must reside in specific jurisdictions
- Simple replication needs: Consider DynamoDB Streams with Lambda for custom replication
### Migration to Global Tables
When converting existing table to global table:
1. Enable DynamoDB Streams on source table
2. Create global table with source region first
3. Add destination regions
4. Monitor replication lag during initial sync
5. Update application to use global table endpoints
6. Test failover scenarios
### Monitoring and Alerting
Key metrics to monitor:
- ReplicationLatency: Time for changes to propagate between regions
- PendingReplicationCount: Number of unreplicated writes
- UserErrors: GlobalTableNotFoundException occurrences
- ThrottledRequests: Capacity issues in any region
Set up CloudWatch alarms for:
- Replication latency > 5 seconds
- Pending replication count > 1000
- GlobalTableNotFoundException errors > 0
ImportConflictException: There was a conflict when attempting to import to the table
How to fix 'ImportConflictException: There was a conflict when attempting to import to the table' in DynamoDB
ResourceNotFoundException: Requested resource not found
How to fix "ResourceNotFoundException: Requested resource not found" in DynamoDB
TrimmedDataAccessException: The requested data has been trimmed
How to fix "TrimmedDataAccessException: The requested data has been trimmed" in DynamoDB Streams
InvalidExportTimeException: The specified ExportTime is outside of the point in time recovery window
How to fix "InvalidExportTimeException: The specified ExportTime is outside of the point in time recovery window" in DynamoDB
MissingAuthenticationTokenException: Missing Authentication Token
How to fix "MissingAuthenticationTokenException: Missing Authentication Token" in DynamoDB