appsync vs apollo

Scotty Moe

Updated on:

This article aims to compare the use of GraphQL with API Gateway and apollo-server-lambda versus AppSync.

When utilizing API Gateway and apollo-server-lambda, developers have greater control over the GraphQL request cycle. However, this requires writing resolver logic in code and a handler function for complete GraphQL requests.

Additionally, memory and feature support need to be considered when using API Gateway and apollo-server-lambda. There is also additional work required for implementing subscriptions with websockets.

In contrast, AppSync is a managed service that handles query validation, batching calls, and subscriptions. It utilizes VTL to define calls to various data sources such as DynamoDB, ElasicSearch, HTTP, Aurora Serverless RDS, or Lambda.

AppSync resolvers can be auto-generated using Amplify CLI, but it offers less control over the entire GraphQL request process. Although AppSync is easier to set up and does not require running a full Apollo server, it can be more expensive as a managed service.

Ultimately, the choice between API Gateway and AppSync depends on factors such as control, code complexity, and cost.

Comparison of Control and Complexity

When comparing control and complexity, API Gateway with apollo-server-lambda provides more control over the GraphQL request cycle and requires writing resolver logic in code, while AppSync offers less control over the entire GraphQL request and can auto-generate resolvers using Amplify CLI.

With API Gateway and apollo-server-lambda, developers have the flexibility to customize the request cycle and have full control over the resolver logic, allowing for more fine-grained control and customization.

On the other hand, AppSync abstracts away some of the complexity by handling query validation, batching calls, and subscriptions. It also provides the convenience of auto-generating resolvers using Amplify CLI, which reduces the amount of code that needs to be written. However, this convenience comes at the cost of giving up some control over the GraphQL request cycle.

Cost Considerations

Cost considerations should be taken into account when deciding between using API Gateway with apollo-server-lambda and AppSync for GraphQL implementation. Both options have different cost implications that can impact the overall budget of the project.

API Gateway with apollo-server-lambda requires running a full Apollo server, which may result in higher costs due to the need for additional resources. On the other hand, AppSync is a managed service, which can be more expensive as it provides convenience and offloads the operational burden.

Additionally, with API Gateway and apollo-server-lambda, the cost may vary depending on the memory and feature support required for the GraphQL implementation. Subscriptions with websockets also require additional work, potentially adding to the cost.

Considering the cost aspect, it is crucial to weigh the trade-offs between control, code complexity, and the budget allocated for the project when choosing between API Gateway with apollo-server-lambda and AppSync for GraphQL implementation.

Subscription Support

Subscription support is a crucial aspect to consider when comparing the capabilities of API Gateway with apollo-server-lambda and AppSync for GraphQL implementation.

API Gateway with apollo-server-lambda requires additional work to enable subscriptions with websockets. This involves setting up and managing the websocket connections manually.

On the other hand, AppSync provides out-of-the-box support for subscriptions, making it easier to implement real-time functionality in GraphQL applications. With AppSync, developers can define subscription resolvers that automatically handle the websocket connections and deliver real-time updates to subscribed clients.

This simplifies the development process and reduces the overall complexity of implementing subscriptions.

Therefore, if subscription functionality is a key requirement for a GraphQL application, AppSync provides a more convenient and streamlined solution compared to API Gateway with apollo-server-lambda.

Leave a Comment