AWS

ResourceNotFoundException - Resource Not Found

Getting a **ResourceNotFoundException** means the AWS resource you're trying to access doesn't exist—the resource ID is wrong, it was deleted, or it's in a different region/account. This client-side error (4xx) is common across DynamoDB, Lambda, EC2, and other AWS services. Most common when resource IDs have typos, but also appears when resources were deleted, resources are in different regions, resources belong to different accounts, or IAM policies don't grant List permissions to see the resource.

#Common Causes

  • Identity: IAM policy missing List/Describe permissions. Resource in different AWS account. Cross-account access not configured.
  • Network: Resource in different region. VPC endpoint routing to wrong region. Cross-region replication not complete.
  • Limits: Resource ID is incorrect. Resource was deleted. Typo in resource identifier. Resource doesn't exist.

Solutions

  1. 1Step 1: Diagnose - List resources to find correct ID: DynamoDB: aws dynamodb list-tables. Lambda: aws lambda list-functions. EC2: aws ec2 describe-instances. S3: aws s3 ls.
  2. 2Step 2: Diagnose - Check if resource exists: DynamoDB: aws dynamodb describe-table --table-name TABLE_NAME. Lambda: aws lambda get-function --function-name FUNCTION_NAME. EC2: aws ec2 describe-instances --instance-ids i-xxxxx.
  3. 3Step 3: Diagnose - Verify region: Check current region: aws configure get region. List resources in different regions: aws ec2 describe-instances --region us-west-2. Resource might be in different region.
  4. 4Step 4: Fix - Check resource in all regions: For EC2: Loop through regions and search. For DynamoDB: Check region where table was created. For Lambda: Verify function region matches request.
  5. 5Step 5: Fix - Verify IAM permissions: aws iam simulate-principal-policy --policy-source-arn YOUR_ARN --action-names dynamodb:DescribeTable --resource-arns arn:aws:dynamodb:REGION:ACCOUNT:table/TABLE_NAME. Ensure List/Describe permissions exist.

</>Code Examples

List Resources to Find Correct IDs
1#!/bin/bash
2# List DynamoDB tables
3echo "=== DynamoDB Tables ==="
4aws dynamodb list-tables --output table
5
6# List Lambda functions
7echo "\n=== Lambda Functions ==="
8aws lambda list-functions --query 'Functions[*].[FunctionName,Runtime]' --output table
9
10# List EC2 instances
11echo "\n=== EC2 Instances ==="
12aws ec2 describe-instances \
13  --query 'Reservations[*].Instances[*].[InstanceId,InstanceType,State.Name]' \
14  --output table
15
16# List S3 buckets
17echo "\n=== S3 Buckets ==="
18aws s3 ls
19
20# List IAM roles
21echo "\n=== IAM Roles ==="
22aws iam list-roles --query 'Roles[*].[RoleName,Arn]' --output table | head -20
Check Resource in Different Regions
1#!/bin/bash
2# Check DynamoDB table in different regions
3TABLE_NAME="MyTable"
4REGIONS=("us-east-1" "us-west-2" "eu-west-1")
5
6echo "=== Checking Table in Different Regions ==="
7for REGION in "${REGIONS[@]}"; do
8  echo "\nChecking region: ${REGION}"
9  aws dynamodb describe-table \
10    --table-name ${TABLE_NAME} \
11    --region ${REGION} 2>&1 | head -3
12done
13
14# Check Lambda function in different regions
15FUNCTION_NAME="my-function"
16echo "\n=== Checking Lambda Function ==="
17for REGION in "${REGIONS[@]}"; do
18  echo "\nRegion: ${REGION}"
19  aws lambda get-function \
20    --function-name ${FUNCTION_NAME} \
21    --region ${REGION} \
22    --query 'Configuration.[FunctionName,Runtime,LastModified]' \
23    --output table 2>&1 | head -5
24done
Verify IAM Permissions for Resource Access
1#!/bin/bash
2# Get your identity
3IDENTITY_ARN=$(aws sts get-caller-identity --query Arn --output text)
4TABLE_NAME="MyTable"
5REGION="us-east-1"
6ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
7
8# Simulate DynamoDB permissions
9echo "=== Simulating DynamoDB Permissions ==="
10aws iam simulate-principal-policy \
11  --policy-source-arn ${IDENTITY_ARN} \
12  --action-names dynamodb:DescribeTable dynamodb:ListTables \
13  --resource-arns "arn:aws:dynamodb:${REGION}:${ACCOUNT_ID}:table/${TABLE_NAME}" \
14  --query 'EvaluationResults[*].[EvalActionName,EvalDecision]' \
15  --output table
16
17# Check if you can list resources
18echo "\n=== Testing List Permissions ==="
19aws dynamodb list-tables 2>&1 | head -5
20if [ $? -eq 0 ]; then
21  echo "✓ Can list tables"
22else
23  echo "✗ Cannot list tables (check IAM permissions)"
24fi

Related Errors

Provider Information

This error code is specific to AWS services. For more information, refer to the official AWS documentation.

ResourceNotFoundException - Resource Not Found | AWS Error Reference | Error Code Reference