Meet Blueberry`s AWS Solution architects and developers to see how we design serverless architectures for our customers.
Our customer is a non-profit organization focused on helping the community search for missing children. They approached us to deliver a mobile application that would automatically notify all the volunteers and search parties when a child goes missing. It has been developed in cooperation with the local Czech police department, which has built a dedicated API exposing their database of missing children.
There are tens of thousands of people in the Czech Republic voluntarily participating in looking for lost children. Based on the nature of this application it is crucial for the system to be perfectly reliable and automatically scalable because there will be totally unpredictable spikes in the traffic.
Our topmost focus was on cutting down the development costs as much as, which is why we decided to build a mobile application written in React Native—it allows us to partially share the source code between both Android and iOS platforms, which significantly speeds up the development phase.
To cut down the operational costs even further, we decided that this is a perfect opportunity to build a serverless architecture and designed an infrastructure that will be cost-efficient, highly-available and effortlessly scalable with the ease provided by AWS.
The backend infrastructure is completely serverless, which essentially means that our customer is paying only for what their customers consume and not for the operation of the infrastructure when it is not utilized. The benefits of using serverless design vs a traditional one can be seen in the picture.
We`re leveraging AppSync, a GraphQL API that AWS provides, over the classical REST API, because it enables us to lower the amount of data transmitted between the backend and the mobile application itself. Also, it allows the mobile application to work offline from a local cache, which speeds up the interaction with the mobile app extremely.
By periodically invoking a lambda function with AWS CloudWatch, we process the data from the Police`s API and save it into the AWS DynamoDB. Changes to the DynamoDB table produce events that are captured by AWS DynamoDB streams which automatically trigger another lambda function that processes the data and automatically sends a push notification to the mobile application. The user—upon receiving the push notification—opens the mobile app, which synchronizes missing data and displays the missing child info.
The complete stack consists of React Native application, AWS AppSync (GraphQL API), AWS Cognito Identity Pool, AWS Lambda functions, AWS DynamoDB, and AWS DynamoDB streams, AWS CloudWatch and AWS X-Ray.
Since we`re working with a cloud, we can leverage Infrastructure as a Code principle and use Terraform to easily interact and build our environments with AWS. We have multiple completely identical infrastructures for acceptance testing, production and for all the developers, which ensures that they are working with a production-like environment and lessens the potential problems caused by inconsistencies between these environments. We`ve fully automated delivering all the changes both for the mobile application and its infrastructure with our CI/CD pipelines. We`ve also introduced integration and compliance tests for the infrastructure written in Chef`s Inspec, to make sure it works properly.
Monitoring distributed systems is an extremely difficult task to do. We`ve included distributed tracing with AWS X-Ray in our lambda functions to make sure that every component and every cloud service is behaving as expected and makes it easy to debug, should this be ever needed.
To make sure that the platform scales seamlessly and everything is working as expected we`ve performed a set of load tests on the platform.
Our customer wants to expand their services across the EU, which with the combination of AWS and Terraform will be an easy task.