小编Sha*_*eel的帖子

DynamoDB:在GSI(全局二级索引)上的查询不返回数据

我正在使用无服务器框架来设置下表:

provider:
  name: aws
  runtime: nodejs6.10
  stage: dev
  region: ap-southeast-1
  environment:
    DYNAMODB_TABLE: "Itinerary-${self:provider.stage}"
    DYNAMODB_COUNTRY_INDEX: country_index
  iamRoleStatements:
    - Effect: Allow
      Action:
        - dynamodb:Query
        - dynamodb:Scan
        - dynamodb:GetItem
        - dynamodb:PutItem
        - dynamodb:UpdateItem
        - dynamodb:DeleteItem
      Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
    - Effect: Allow
      Action:
        - dynamodb:Query
        - dynamodb:Scan
        - dynamodb:GetItem
        - dynamodb:PutItem
        - dynamodb:UpdateItem
        - dynamodb:DeleteItem
      Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}/index/${self:provider.environment.DYNAMODB_COUNTRY_INDEX}"
resources:
  Resources:
    ItineraryTable:
      Type: 'AWS::DynamoDB::Table'
      DeletionPolicy: Retain
      Properties:
        AttributeDefinitions:
          -
            AttributeName: ID
            AttributeType: S
          -
            AttributeName: Country
            AttributeType: S
        KeySchema:
          -
            AttributeName: ID
            KeyType: HASH
        GlobalSecondaryIndexes: …
Run Code Online (Sandbox Code Playgroud)

amazon-dynamodb aws-lambda serverless-framework

1
推荐指数
1
解决办法
1509
查看次数