Articles - Merapar

Using AWS Appsync and Amplify in your development process

Written by Alex Borland | Sep 20, 2020 1:29:00 PM

Within Merapar we create complete backend solutions for Media, Broadcast and IoT companies. These industry verticals have a common case where they serve a large consumer base with unpredictable usage patterns and a continuous need to improve consumer experience with ongoing functional enhancements.

Building the Service

Service Operators strive to provide their consumers with ever increasing functionality, simplicity of use, interoperability with other platforms / services and a personalised consumer experience. Each increment of the consumer’s UX always requires backend evolutions and testing. This means developing user centric solutions, requiring us to adapt the way we organise the development of our backends and the tools we use to decouple dependencies and maintain delivery velocity.

Traditional backend services are designed around a common understanding of the functional needs of the service with a well defined API to the frontend. This allowed frontend and backend development teams to create their solutions independently, where backend teams focused on providing the richest functionality and frontend teams focused on providing the best user experience.

However, the inflexible nature of a fixed API between frontend and backend meant that incrementing functionality to the end consumer was slow, with one or two functional releases per year.

AWS Amplify and AppSync

With the integration of AWS Amplify and AWS Appsync, Merapar shifted our approach where the backend follows the API specifications demanded by the front-end. In other words, previously we were specifying our API’s to the UI’s, now we can implement the backend as demanded by the frontend. This approach is far more optimised and has resulted in more rapid increments to the User Experience.

As an example our front-end engineers now can express their needs in the AWS AppSync GraphQL schema utilizing the power of AWS Amplify. The backend developers can (depending on the internal structure) choose to have one or more GraphQL resolvers or resolve pipelines setup to implement the schema.

AWS Amplify in combination with AWS Appsync allowed us to transition between back-end focused development to front-end focused development. AWS Amplify offers the tools to generate the resources required for the front-end to start developing and define the API schema’s in advance of the full backend functionality being completed.

In practice we have better decoupling between frontend and backend teams. The activities front-end engineers can perform on the backend (for example the schema definition) needs little or no direct involvement from the backend engineers.

Integrated Services

The multiple authorisation schemas supported by AWS Appsync allows developers to adopt a security schema which suits the purpose. During resource generation, using AWS Amplify, the hard work of integrating and configuring both API authorisation and user authentication is taken care of simply.

AWS Appsync offers by default scalability to 1.000 RPS, while this is a soft limit, it does scale far beyond this limit. We found during scalability testing this performance is instantly available, important in the Media and Broadcast space, where very high load peaks are often generated during prime time sport and news events. Read our other, technical blog, about solving possible cache stampede challenges with the AWS Appsync integrated cache.

An important feature of AWS Appsync is the support of subscriptions. While many other mechanisms are available to provide push notifications within the AWS ecosystem, having subscriptions within the same system, enabling proper use of authorisations, proved much quicker to develop the end to end solution. With previous use of our own hosted Apollo GraphQL service the handles were available, but required the hosting and managing of these services separately.

This picture depicts a typical deployment overview of AWS AppSync, where AWS AppSync takes care of resolving the queries and the subscriptions. AWS Lambda is used for handling the resolvers and providing mutations for possible subscriptions.

Development Benefits

  • Continues to allow decoupled development from frontend to backend, but also enables much closer coordination. As backend and frontend are different disciplines within our organisation, decoupling using a GraphQL schema provides a technical way to decouple but provides effective communication between the teams.
  • Allows much smaller functional increments to be developed by front and backend individuals/teams, tested and validated for continuous releases.
  • AWS AppSync allows you to setup DTAP-like environments with a pay as you go model, reducing overhead costs compared to running GraphQL independently.
  • Security, subscriptions and authentication are prebuilt as part of the service reducing development time and allowing developers to focus on delivering functionality