Bird
0
0

Which of the following is the correct way to define a DynamoDB data source in an AWS AppSync GraphQL schema?

easy📝 Syntax Q12 of 15
DynamoDB - with Serverless
Which of the following is the correct way to define a DynamoDB data source in an AWS AppSync GraphQL schema?
Atype Query { getItem(id: ID!): Item @aws_dynamodb(tableName: MyTable) }
Btype Query { getItem(id: ID!): Item @aws_lambda(functionName: "MyFunction") }
Ctype Query { getItem(id: ID!): Item @aws_dynamodb(tableName: "MyTable", region: "us-east-1") }
Dtype Query { getItem(id: ID!): Item @aws_s3(bucketName: "MyBucket") }
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct directive for DynamoDB

    The @aws_dynamodb directive is used to link a DynamoDB table as a data source in AppSync.
  2. Step 2: Check syntax correctness

    type Query { getItem(id: ID!): Item @aws_dynamodb(tableName: "MyTable", region: "us-east-1") } correctly includes the tableName and region parameters, which are valid for specifying the DynamoDB data source.
  3. Final Answer:

    type Query { getItem(id: ID!): Item @aws_dynamodb(tableName: "MyTable", region: "us-east-1") } -> Option C
  4. Quick Check:

    @aws_dynamodb with tableName and region is correct syntax [OK]
Quick Trick: Look for @aws_dynamodb with tableName and region parameters [OK]
Common Mistakes:
MISTAKES
  • Using @aws_lambda instead of @aws_dynamodb for DynamoDB
  • Forgetting quotes around tableName value
  • Using @aws_s3 which is unrelated to DynamoDB

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes