Skip to content

failed to load data from dynamodb #13

@rajeshwer

Description

@rajeshwer

hi

i am looking to use dynamodb for below data

{
    "allowed_amis": {
        "Amazon": {
            "value": "id"
        }
    }
}

below is my policy
https://play.openpolicyagent.org/p/9GWfNsFAxe

when i try to load data from dynamodb i am getting below error

curl -X POST http://127.0.0.1:8181/v1/data/amiid --data-binary '{ "input": {"path": "allowed_amis.Amazon.value","value": "id"}}' |jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   469  100   406  100    63   1691    262 --:--:-- --:--:-- --:--:--  1954
{
  "code": "internal_error",
  "message": "error(s) occurred while evaluating query",
  "errors": [
    {
      "code": "eval_builtin_error",
      "message": "dynamodb.policy: ValidationException: Query key condition not supported\n\tstatus code: 400, request id: 602b4674-7749-4463-8955-2f18b49ed817",
      "location": {
        "file": "amiid",
        "row": 9,
        "col": 12
      }
    }
  ]
}

data in dynamodb

aws dynamodb scan --table-name OpaDynamoDB --endpoint-url http://localhost:8000 
{
    "Items": [
        {
            "allowed_amis.Amazon.value": {
                "S": "id"
            },
            "pk": {
                "S": "foo/bar"
            }
        }
    ],
    "Count": 1,
    "ScannedCount": 1,
    "ConsumedCapacity": null
}

i am using below policy

package amiid

default allowresult = "invalid ami image"

allowresult {
   # Lookup ami from data
   path := dynamodb.policy("foo/bar", input.path)
   input.value = path.value
}

can you provide a working example on how to use this
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions