11
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS lambdaからdynamodbに接続: "AccessDeniedException"で怒られたのでポリシーを設定した

Posted at

やりたかったこと

lambdaから条件によって、dynamodb内のレコードを読み書きしたかった。

発生した問題

2017-04-03T12:11:12.144Z	******	Unable to delete item. Error JSON:
{
    "message": "User: arn:aws:sts::******:assumed-role/******/****** is not authorized to perform: dynamodb:DeleteItem on resource: arn:aws:dynamodb:us-east-1:******:table/******",
    "code": "AccessDeniedException",
    "time": "2017-04-03T12:11:12.131Z",
    "requestId": "******",
    "statusCode": 400,
    "retryable": false,
    "retryDelay": 0
}

どう解決したか?

lambdaのポリシーに、dynamodbにアクセスできる権限を付与しました。

まず、現在のlambdaのポリシーを確認
IMG_3987.JPG

次に、ポリシーの役割を増やす。こんな感じ
(なんかフワフワした説明ですみません)
IMG_3988.JPG

その際、ARNという、完全修飾名みたいなものが必要になる。dynamodbはoverviewからわかります
IMG_3989.JPG

以上!

11
6
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
11
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?