Search code examples
aws-sdkaws-appsyncvtl

Is there a Model.objects.update_or_create() for AWS Appsync using VTL?


I'm using $util.autoId() and would like to know if there is a pattern to do an update_or_create() (similar to the Django one) using VTL or if I should link the Resolver to a Lambda and do the logic in there?


Solution

  • You can use the Amazon DynamoDB UpdateItem operation to perform an update-else-create operation. We have published an end-to-end sample that includes an example AWS AppSync resolver that illustrates this pattern.