Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

544
Views
AWS AppSync Resolvers Lambda Function vs Velocity Template Language (VTL)

I have been looking into AWS AppSync to create a managed GraphQL API with DynamoDB as the datastore. I know AppSync can use Apache Velocity Template Language as a resolver to fetch data from dynamoDB. However, that means I have to introduce an extra language to the programming stack, so I would prefer to write the resolvers in Javascript/Node.js

Is there any downside of using a lambda function to fetch data from DynamoDB? What reasons are there to use VTL instead of a lambda for resolvers?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

There are pros and cons to using lambda functions as your AppsSync resolvers (although note you'll still need to invoke your lambdas from VTLs):

Pros

  • Easier to write and maintain
  • More powerful for marshalling and validating requests and responses
  • Common functionality can be more DRY than possible with VTLs (macros are not supported)
  • More flexible debugging and logging
  • Easier to test
  • Better tooling and linting available
  • If you need to support long integers in your DynamoDB table (DynamoDB number types do support long, but AppSync resolvers only support 32-bit integers. You can get around this if you use a lambda, for example by serializing longs to a string before transport through the AppSync resolver layer) - See (currently) open Feature Request: https://github.com/aws/aws-appsync-community/issues/21

Cons

  • Extra latency for every invocation
  • Cold starts = even more latency (although this can usually be minimised by keeping your lambdas warm if this is a problem for your use case)
  • Extra cost
  • Extra resources for each lambda, eating up the fixed 200 limit

If you're doing a simple vanilla DynamoDB operation it's worth giving VTLs a go. The docs from AWS are pretty good for this: https://docs.aws.amazon.com/appsync/latest/devguide/resolver-mapping-template-reference-dynamodb.html

If you're doing anything mildly complex, such as marshalling fields, looping, or generally hacky non-DRY code, then lambdas are definitely worth considering for the speed of writing and maintaining your code provided you're comfortable with the extra latency and cost.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!