2017-10-06 35 views
0

ユーザーのID(FacebookまたはGoogleから)と他の文字で構成されるパーティションキーを持つAmazon Dynamodbテーブルがあります。ワイルドカードを使ってきめ細かいアクセスポリシーのプロパティを指定することができますが、私はdynamodb:LeadingKeysでワイルドカードを取得できませんでした。ここでdynamodbのファイングレインアクセスポリシーでワイルドカード文字(*)を使用できますか?

が働いポリシーです:

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
     { 
      "Effect": "Allow", 
      "Action": [ 
       "dynamodb:BatchGetItem", 
       "dynamodb:BatchWriteItem", 
       "dynamodb:DeleteItem", 
       "dynamodb:GetItem", 
       "dynamodb:PutItem", 
       "dynamodb:Query", 
       "dynamodb:UpdateItem" 
      ], 
      "Resource": [ 
       "arn:aws:dynamodb:<region>:<...>:table/<table-name>" 
      ], 
      "Condition": { 
       "ForAllValues:StringEquals": { 
        "dynamodb:LeadingKeys": [ 
         "g_${accounts.google.com:sub}" 
        ] 
       } 
      } 
     } 
    ] 
} 

しかし、これは動作しません:

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
     { 
      "Effect": "Allow", 
      "Action": [ 
       "dynamodb:BatchGetItem", 
       "dynamodb:BatchWriteItem", 
       "dynamodb:DeleteItem", 
       "dynamodb:GetItem", 
       "dynamodb:PutItem", 
       "dynamodb:Query", 
       "dynamodb:UpdateItem" 
      ], 
      "Resource": [ 
       "arn:aws:dynamodb:<region>:<...>:table/<table-name>" 
      ], 
      "Condition": { 
       "ForAllValues:StringEquals": { 
        "dynamodb:LeadingKeys": [ 
         "*_${accounts.google.com:sub}" 
        ] 
       } 
      } 
     } 
    ] 
} 

答えて

0

私はこれに対する解決策を見つけました。したがって、ForAllValues:StringEqualsを使用する代わりにForAllValues:StringLikeを使用してください。

作業方針は、次のとおりです。

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
     { 
      "Effect": "Allow", 
      "Action": [ 
       "dynamodb:BatchGetItem", 
       "dynamodb:BatchWriteItem", 
       "dynamodb:DeleteItem", 
       "dynamodb:GetItem", 
       "dynamodb:PutItem", 
       "dynamodb:Query", 
       "dynamodb:UpdateItem" 
      ], 
      "Resource": [ 
       "arn:aws:dynamodb:<region>:<...>:table/<table-name>" 
      ], 
      "Condition": { 
       "ForAllValues:StringLike": { 
        "dynamodb:LeadingKeys": [ 
         "*_${accounts.google.com:sub}" 
        ] 
       } 
      } 
     } 
    ] 
} 

は、この参照を見つけるために、私にしばらく時間がかかった:http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#AccessPolicyLanguage_ConditionType

関連する問題