aws / aws-appsync-community

The AWS AppSync community
https://aws.amazon.com/appsync
Apache License 2.0
507 stars 32 forks source link

[Question] Cloudformation - Usage Question, Batch* #37

Closed Dellybro closed 3 years ago

Dellybro commented 5 years ago

Within my cloud formation template I have all the resolvers for my appsync client but for my many to many relationship i'm going to need to do a batchput / batchget, my question is how do i get the table name within my response vtl as an environment variable?

My .vtl's are their own file which end up in an s3 location after pushing it through my pipeline so i'm trying to not use the inline style which i know is possible to do what i'm asking for, but i'd prefer to separate my yaml resource from my .vtls

itrestian commented 5 years ago

As you noticed, the batch operations, by their nature, target multiple DynamoDb tables so the way to implement batching would be to reference the different table names in the resolver mapping templates.

If your mapping templates are embedded in the cloud formation template, you can use string join operations and reference the DynamoDb table names as a workaround. Since you're not using inline templates, the only workaround I can think at this point is when you upload your vtl files to S3 to scan them and replace the DynamoDb table placeholders.