LoginSignup
0
1

More than 1 year has passed since last update.

"errorMessage": "An error occurred (UnauthorizedOperation) when calling the DescribeInstances operation: You are not authorized to perform this operation.", エラー

Last updated at Posted at 2021-05-18

【An error occurred (UnauthorizedOperation) when calling the DescribeInstances operation】
DescribeInstances するための権限がない。というエラー。

エラー
{
  "errorMessage": "An error occurred (UnauthorizedOperation) when calling the DescribeInstances operation: You are not authorized to perform this operation.",
  "errorType": "ClientError",
  "stackTrace": [
    "  File \"/var/task/lambda_function.py\", line 10, in lambda_handler\n    response = ec2_client.describe_instances()\n",
    "  File \"/var/runtime/botocore/client.py\", line 357, in _api_call\n    return self._make_api_call(operation_name, kwargs)\n",
    "  File \"/var/runtime/botocore/client.py\", line 676, in _make_api_call\n    raise error_class(parsed_response, operation_name)\n"
  ]
}

対象のLambda関数に付与されたIAMロールに AmazonEC2ReadOnlyAccessを追加する。
Lambda > 関数 > 対象Lambda関数 > 設定タブ > アクセス権限 > 実行ロール > 【対象ロール】> IAM設定画面に遷移 > 【ポリシーをアタッチします】> AmazonEC2ReadOnlyAccessを選択 > 【ポリシーのアタッチ】

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1