

# 排查 Amazon ECS ResourceNotFoundException 错误
<a name="resource-not-found-error"></a>

以下是一些 ` ResourceNotFoundException` 错误消息和可以用来修复错误的操作。

要使用 AWS 管理控制台 检查已停止的任务是否有错误消息，请参阅 [查看 Amazon ECS 已停止任务错误](stopped-task-errors.md)。

## 任务未能在 AWS Secrets Manager 中检索到 ARN 为“*sercretARN*”的密钥。请检查指定区域中是否存在该密钥。
<a name="unable-to-pull-secrets-ecr"></a>

当任务无法从 Secrets Manager 中检索到密钥时，将出现此错误。这意味着 Secrets Manager 中不存在任务定义中指定（并包含在错误消息中）的密钥。

区域也包含在错误消息中。

正在从 *region* 区域中的 AWS Secrets Manager 获取密钥数据：密钥 *sercretARN*：ResourceNotFoundException：Secrets Manager 找不到指定的密钥。

有关查找密钥的信息，请参阅《AWS Secrets Manager 用户指南》中的 [Find secrets in AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_search-secret.html)**。

可使用下表确定和解决错误。


| 问题 | 操作 | 
| --- | --- | 
| 该密钥位于与任务定义不同的区域。 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/AmazonECS/latest/developerguide/resource-not-found-error.html) | 
| 任务定义中的密钥 ARN 不正确。正确的密钥存在于 Secrets Manager 中。 | 使用正确的密钥更新任务定义。有关更多信息，请参阅《Amazon Elastic Container Service API 参考》中的 [使用控制台更新 Amazon ECS 任务定义](update-task-definition-console-v2.md) 或 [RegisterTaskDefinition](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RegisterTaskDefinition.html)。 | 
| 该密钥已不再存在。 |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_cn/AmazonECS/latest/developerguide/resource-not-found-error.html)  | 