

# Amazon ECS での ResourceInitializationError エラーのトラブルシューティング
<a name="resource-initialization-error"></a>

以下に、`ResourceInitialization` エラーメッセージおよび、そのエラーを修正するために取れる措置を示します。

停止したタスクのエラーメッセージを AWS マネジメントコンソール で確認する方法については、「[Amazon ECS の停止したタスクのエラーを表示する](stopped-task-errors.md)」を参照してください。

**Topics**
+ [The task cannot pull registry authentication from Amazon ECR. There is a connection issue between the task and Amazon ECR. Check your task network configuration.](#unable-to-pull-secrets-ecr)
+ [The task can't download the environment variable files from Amazon S3. There is a connection issue between the task and Amazon S3. Check your task network configuration.](#failed-to-download-env-files)
+ [The task cannot pull secrets from AWS Systems Manager Parameter Store. Check your network connection between the task and AWS Systems Manager.](#unable-to-pull-secrets-sys-manager)
+ [The task can’t pull secrets from AWS Secrets Manager. There is a connection issue between the task and Secrets Manager. Check your task network configuration.](#unable-to-pull-secrets-asm-no-arn)
+ [The task can’t pull the secret from Secrets Manager. The task can't retrieve the secret with ARN ‘*secretARN*' from Secrets Manager. Check whether the secret exists in the specified Region.](#unable-to-pull-secrets-asm)
+ [pull command failed: unable to pull secrets or registry auth Check your task network configuration.](#pull-command-failed)
+ [The task cannot find the Amazon CloudWatch log group defined in the task definition. There is a connection issue between the task and Amazon CloudWatch. ネットワーク設定を確認します。](#failed-to-initialize-logging-network)
+ [failed to initialize logging driver](#failed-to-initialize-logging)
+ [failed to invoke EFS utils commands to set up EFS volumes](#efs-utils-failed)

## The task cannot pull registry authentication from Amazon ECR. There is a connection issue between the task and Amazon ECR. Check your task network configuration.
<a name="unable-to-pull-secrets-ecr"></a>

このエラーは、タスクが Amazon ECR に接続できないことを示します。

タスクと Amazon ECR との間の接続を確認してください。詳細については、「[Amazon ECS の停止したタスクの接続を検証する](verify-connectivity.md)」を参照してください。

## The task can't download the environment variable files from Amazon S3. There is a connection issue between the task and Amazon S3. Check your task network configuration.
<a name="failed-to-download-env-files"></a>

このエラーは、タスクが Amazon S3 から環境設定ファイルをダウンロードできない場合に発生します。

タスクと Amazon S3 VPC エンドポイントとの間の接続を確認してください。詳細については、「[Amazon ECS の停止したタスクの接続を検証する](verify-connectivity.md)」を参照してください。

## The task cannot pull secrets from AWS Systems Manager Parameter Store. Check your network connection between the task and AWS Systems Manager.
<a name="unable-to-pull-secrets-sys-manager"></a>

このエラーは、タスクが Systems Manager の認証情報を使用して、タスク定義で定義されたイメージをプルできない場合に発生します。

タスクと Systems Manager VPC エンドポイントとの間の接続を確認してください。詳細については、「[Amazon ECS の停止したタスクの接続を検証する](verify-connectivity.md)」を参照してください。

## The task can’t pull secrets from AWS Secrets Manager. There is a connection issue between the task and Secrets Manager. Check your task network configuration.
<a name="unable-to-pull-secrets-asm-no-arn"></a>

このエラーは、タスクが Secrets Manager の認証情報を使用して、タスク定義で定義されたイメージをプルできない場合に発生します。

エラーは、Systems Manager VPC エンドポイントとタスク間のネットワーク接続に問題があることを示します。

タスクとエンドポイント間の接続を確認する方法については、「[Amazon ECS の停止したタスクの接続を検証する](verify-connectivity.md)」を参照してください。

## The task can’t pull the secret from Secrets Manager. The task can't retrieve the secret with ARN ‘*secretARN*' from Secrets Manager. Check whether the secret exists in the specified Region.
<a name="unable-to-pull-secrets-asm"></a>

このエラーは、タスクが Secrets Manager の認証情報を使用して、タスク定義で定義されたイメージをプルできない場合に発生します。

この問題は、次のいずれかの理由によって発生します。


| エラーの原因 | 手順 | 
| --- | --- | 
|   Secrets Manager VPC エンドポイントとタスク間のネットワーク接続の問題 エラーメッセージに次のいずれかの文字列が表示されている場合、問題の原因はネットワークです。 [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/resource-initialization-error.html)  |  タスクと Secrets Manager エンドポイント間の接続を確認します。詳細については、「[Amazon ECS の停止したタスクの接続を検証する](verify-connectivity.md)」を参照してください。  | 
| タスク定義で定義されたタスク実行ロールに、Secrets Manager のアクセス許可がありません。 |  タスク実行ロールに、Secrets Manager に必要なアクセス許可を追加します。詳細については、「[Secrets Manager または Systems Manager のアクセス許可](task_execution_IAM_role.md#task-execution-secrets)」を参照してください。  | 
| シークレット ARN が存在しません | Secrets Manager に ARN が 存在することを確認します。イメージの表示については、「Secrets Manager デベロッパーガイド」の「[Secrets Manager でシークレットを検索する](https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_search-secret.html)」を参照してください。 | 

## pull command failed: unable to pull secrets or registry auth Check your task network configuration.
<a name="pull-command-failed"></a>

このエラーは、タスクが Amazon ECR、Systems Manager、または Secrets Manager に接続できない場合に発生します。これはネットワークの設定ミスが原因です。

この問題を解決するには、タスクと Amazon ECR との間の接続を確認します。また、タスクとシークレットを保存するサービス (Systems Manager または Secrets Manager) との間の接続も確認する必要があります。詳細については、「[Amazon ECS の停止したタスクの接続を検証する](verify-connectivity.md)」を参照してください。

## The task cannot find the Amazon CloudWatch log group defined in the task definition. There is a connection issue between the task and Amazon CloudWatch. ネットワーク設定を確認します。
<a name="failed-to-initialize-logging-network"></a>

このエラーは、タスクがタスク定義で定義した CloudWatch ロググループを見つけられない場合に発生します。

このエラーは、CloudWatch VPC エンドポイントとタスクとの間のネットワーク接続に問題があることを示します。

タスクとエンドポイント間の接続を確認する方法については、「[Amazon ECS の停止したタスクの接続を検証する](verify-connectivity.md)」を参照してください。

## failed to initialize logging driver
<a name="failed-to-initialize-logging"></a>

このエラーは、タスクがタスク定義で定義した CloudWatch ロググループを見つけられない場合に発生します。

このエラーは、タスク定義内に CloudWatch グループが存在しないことを示します。

対象の CloudWatch を検索するには、次の手順を実行します。

1. 次のコマンドを実行して、タスク定義情報を取得します。

   ```
   aws ecs describe-task-definition \ 
       --task-definition task-def-name
   ```

   各コンテナの出力を見て、`awslogs-group` 値を書き留めます。

   ```
   "logConfiguration": {
                   "logDriver": "awslogs",
                   "options": {
                       "awslogs-group": "/ecs/example-group",
                       "awslogs-create-group": "true",
                       "awslogs-region": "us-east-1",
                       "awslogs-stream-prefix": "ecs"
                   },
   ```

1. このグループが CloudWatch に存在することを確認します。詳細については、「Amazon CloudWatch Logs ユーザーガイド」の「[ロググループとログストリームの操作](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html)」を参照してください。**

   この問題は、タスク定義で指定されたグループが正しくないことか、ロググループが存在しないことのいずれかです。

1. 問題を修正します。    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/resource-initialization-error.html)

## failed to invoke EFS utils commands to set up EFS volumes
<a name="efs-utils-failed"></a>

以下の問題により、タスクに Amazon EFS ボリュームをマウントできない可能性があります。
+ Amazon EFS ファイルシステムが正しく設定されていません。
+ タスクに必要なアクセス許可がありません。
+ ネットワークおよび VPC 構成に関連する問題があります。

 この問題をデバッグして修正する方法については、AWS re:Post の 「[AWS Fargate タスクに Amazon EFS ボリュームをマウントできない理由](https://repost.aws/knowledge-center/fargate-unable-to-mount-efs)」を参照してください。