DynamoDB returns ExportNotFoundException when you try to access or describe an export that does not exist, has been deleted, or is in a different region. This error occurs with the ExportTableToPointInTime API when referencing exports by their Amazon Resource Name (ARN) or export ID.
The ExportNotFoundException error in DynamoDB indicates that the export job you're trying to access cannot be found in the current AWS region or account. This error typically occurs in several scenarios: 1. Export deleted: The export job has been completed and automatically deleted after the retention period (default 14 days) 2. Wrong region: You're trying to access an export in a different AWS region than where it was created 3. Invalid ARN: The Amazon Resource Name (ARN) provided doesn't match any existing export 4. Export ID mismatch: The export ID doesn't correspond to any known export in your account 5. Cross-account access: Trying to access an export from a different AWS account without proper permissions DynamoDB exports are temporary resources used for data migration, backup, or analytics. Each export has a unique ARN and exists only for a limited time after completion.
First, ensure you're using the correct export ARN and AWS region:
Check current AWS region configuration:
aws configure get region
List all exports in the current region:
aws dynamodb list-exports
Check specific export details (if you know the ARN):
aws dynamodb describe-export --export-arn "arn:aws:dynamodb:us-east-1:123456789012:table/MyTable/export/016123456789-abcdefg"
Key checks:
- Verify the ARN matches the exact format shown in ListExports output
- Ensure you're in the same region where the export was created
- Check account ID matches your current AWS account
Exports have limited lifetime. Check if the export still exists and its status:
Get detailed export information:
aws dynamodb describe-export --export-arn "arn:aws:dynamodb:us-east-1:123456789012:table/MyTable/export/016123456789-abcdefg" --query 'ExportDescription.[ExportArn, ExportStatus, ExportTime, EndTime]'
Check CloudWatch logs for export lifecycle events:
aws logs filter-log-events --log-group-name "/aws/dynamodb" --filter-pattern "ExportNotFoundException" --start-time $(date -d "24 hours ago" +%s)000
Export lifecycle:
1. IN_PROGRESS: Export is being created
2. COMPLETED: Export finished successfully
3. FAILED: Export creation failed
4. DELETED: Export was deleted (manually or automatically)
Retention period: Exports are automatically deleted 14 days after completion unless manually deleted earlier.
Implement proper error handling and fallback logic in your application code:
Basic error handling pattern:
try {
// Attempt to describe export
const response = await dynamodb.describeExport({ ExportArn: exportArn }).promise();
return response.ExportDescription.ExportStatus;
} catch (error) {
if (error.name === 'ExportNotFoundException') {
console.log('Export not found, initiating new export...');
return await createNewExport();
}
throw error;
}
Best practices:
- Always wrap export operations in try-catch blocks
- Implement retry logic with exponential backoff
- Cache export ARNs with TTL matching export retention period
- Use idempotent operations when creating new exports
Implement monitoring to track export creation, completion, and deletion:
Track export lifecycle in your application:
- Store export ARNs in a durable store (DynamoDB, RDS)
- Record creation time, status, and S3 location
- Schedule cleanup for completed exports (14 days after completion)
- Remove expired exports from tracking
CloudWatch Alarms for export failures:
aws cloudwatch put-metric-alarm --alarm-name "DynamoDB-Export-Failures" --metric-name "UserErrors" --namespace "AWS/DynamoDB" --statistic "Sum" --period 300 --evaluation-periods 1 --threshold 1 --comparison-operator "GreaterThanOrEqualToThreshold" --alarm-actions "arn:aws:sns:us-east-1:123456789012:MyAlertsTopic"
Monitoring strategy:
- Track export ARNs in a durable store
- Set up CloudWatch alarms for export failures
- Log export lifecycle events for audit trails
- Implement alerting for critical export failures
Build robust export validation and automatic recovery mechanisms:
Validation and recovery flow:
1. Try to get existing export using describeExport
2. If export not found, check S3 for existing export data
3. If S3 data exists, update tracking metadata
4. If no data found, create new export
S3 data check:
- Extract export ID from ARN
- Check S3 bucket for export data at prefix: exports/{exportId}/
- If data exists, export may have been deleted but data persists
Creating new export:
aws dynamodb export-table-to-point-in-time --table-arn "arn:aws:dynamodb:us-east-1:123456789012:table/MyTable" --export-time "2024-01-01T00:00:00Z" --s3-bucket "my-export-bucket" --s3-prefix "exports/" --export-format "DYNAMODB_JSON"
Recovery strategies:
- Check S3 for existing export data before recreating
- Implement idempotent export creation
- Use deterministic export IDs for repeatable operations
- Maintain export metadata in a separate tracking table
Implement proactive measures to prevent ExportNotFoundException:
Export management best practices:
- Cache export ARNs with appropriate TTL (13 days to be safe)
- Implement export tracking in DynamoDB with TTL
- Use Infrastructure as Code to manage export lifecycle
- Schedule regular export validation and cleanup
- Implement export versioning for long-term data needs
Infrastructure as Code example (CloudFormation):
Resources:
ExportTrackingTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: ExportTracking
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: ExportId
AttributeType: S
- AttributeName: CreatedAt
AttributeType: N
KeySchema:
- AttributeName: ExportId
KeyType: HASH
TimeToLiveSpecification:
AttributeName: ExpiresAt
Enabled: true
Prevention strategies:
- Cache export ARNs with appropriate TTL
- Implement export tracking in DynamoDB with TTL
- Use Infrastructure as Code to manage export lifecycle
- Schedule regular export validation and cleanup
- Implement export versioning for long-term data needs
## DynamoDB Export Deep Dive
### Export Architecture and Limitations:
Export Types:
1. ExportTableToPointInTime: Creates point-in-time export of table data
2. Incremental Exports: Not natively supported - must implement custom logic
3. Continuous Exports: Use DynamoDB Streams + Kinesis Data Firehose for real-time
Export Retention and Cleanup:
- Default retention: 14 days after export completion
- Manual deletion possible via DeleteExport API
- S3 data persists independently - configure S3 lifecycle policies
- Export metadata stored in DynamoDB system tables (not visible to users)
Performance Considerations:
- Export operations don't affect table performance (uses backup infrastructure)
- Large tables may take hours to export
- Export size affects S3 storage costs and transfer times
- Use export filters to reduce data volume when possible
### Cross-Region and Cross-Account Exports:
Cross-Region Challenges:
- Exports are region-specific (ARN includes region code)
- Cannot describe exports across regions without proper configuration
- Consider using AWS Backup for cross-region disaster recovery
Cross-Account Access:
- Export ARNs include account ID
- IAM policies must allow cross-account describe/delete permissions
- S3 bucket policies must allow cross-account access for export data
### Error Handling Patterns:
Common Error Scenarios:
1. ExportNotFoundException after successful creation: Race condition or premature deletion
2. Intermittent not found errors: Region configuration issues or IAM permission delays
3. Export exists but data missing: S3 permissions or export failure
Debugging Techniques:
1. Enable AWS CloudTrail for API call auditing
2. Check DynamoDB CloudWatch metrics for export operations
3. Review S3 access logs for export data access patterns
4. Use AWS X-Ray for distributed tracing of export workflows
### Alternative Approaches:
When exports don't meet requirements:
1. AWS Backup for DynamoDB: Managed backup and restore with longer retention
2. DynamoDB Streams + Lambda: Real-time data processing pipelines
3. AWS Data Pipeline: Scheduled data movement to S3/Redshift
4. Third-party tools: AWS Database Migration Service, Striim, etc.
Cost Optimization:
- Delete exports immediately after use if 14-day retention isn't needed
- Compress export data in S3 (DynamoDB JSON is verbose)
- Use S3 Intelligent-Tiering for infrequently accessed export data
- Implement data filtering to export only necessary attributes
### Security Considerations:
IAM Best Practices:
- Principle of least privilege for export operations
- Use IAM conditions to restrict exports to specific tables
- Implement SCPs (Service Control Policies) for organization-wide export controls
- Rotate IAM credentials regularly
Data Protection:
- Enable S3 encryption for export data at rest
- Use KMS keys for additional encryption control
- Implement VPC endpoints for private S3 access
- Audit export data access with S3 access logging
### Monitoring and Alerting:
Essential CloudWatch Metrics:
- ExportSuccessfulRecords: Number of records successfully exported
- ExportFailedRecords: Number of records that failed to export
- ExportDuration: Time taken for export completion
- UserErrors: Client-side errors including ExportNotFoundException
Recommended Alarms:
- Export failure rate > 1% over 5 minutes
- Export duration > 1 hour for large tables
- ExportNotFoundException count > 0 in any 15-minute period
- S3 storage growth rate exceeding expectations
ValidationException: The provided key element does not match the schema
How to fix "ValidationException: The provided key element does not match the schema" in DynamoDB
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
UnrecognizedClientException: The security token included in the request is invalid
How to fix "UnrecognizedClientException: The security token included in the request is invalid" in DynamoDB