Modernising your entire cloud architecture can often sound like a daunting task. In many cases this type of migration would be avoided due to the complexity and possible risks involved if not done correctly. Not to mention the level of expertise you need to configure all the various servers for your cloud solution (DB, Build Servers, Scaling Solutions etc).
When online South African mobile retailer, Rewardsco, decided to modernise their entire stack, they turned to BBD to build a solution using as many serverless and managed services as possible to allow for scaling based on demand, while minimising their on-going maintenance and operational effort.
Knowing that they didn’t have the inhouse capacity necessary at the time, the solution also needed to be simplified and easy to work with. As an accomplished cloud solutions provider, the company partnered with us to lay the foundation for this cloud native modernisation project.
The brief was to create a responsive, scalable and highly reliable yet cost effective platform.
Since the products listed on Rewardsco’s site are marketed to a wide range of target markets, the platform needed to be highly performant, even on slow network connections.
Another key requirement was that the platform should not suffer under a sudden influx of traffic as the client releases various deals to their customers, causing a higher sudden demand in infrastructure. To facilitate this and help save cost to the client, we needed to downscale infrastructure as soon as the demand would drop to regular traffic levels. This meant implementing CI/CD processed with auto scaling according to traffic to the website.
For us, the requirement set out by the client needed to be:
- Performant
- Scalable
- Maintainable
- Flexible in design
- Reliable
- And above all, simplistic
The BBD team realised that a serverless approach would be best suited since the client did not have the cloud knowledge to manage elaborate servers on a 24/7 basis.
“Due to the strict time constraints on the project, we needed technology that would enable us to deliver with accuracy and quality” explains Frikkie van Biljon, one of the two BBD cloud engineers on the project. We needed to utilise technologies that would enable rapid development which would not result in any trade-offs for the client. “Ultimately, we needed managed servers that are configurable enough to solve for this custom problem.”
Our team further needed to have all the tech under one umbrella since a distributed solution would increase the complexity of the solution.
Architecture
In a nutshell, the solution consisted of two main components: a customer facing website and a CMS system. Each component in turn including a back- or front-end. “Although we could discuss the various services at length” says Van Biljon, “a key service in enabling this project was AWS’ Elastic Beanstalk”.
The solution consisted of the following:
- Client-facing website with Server-Side Rendering (React + NextJS + NodeJS)
- An API hosted on Lambda
- API Gateway exposing the Lambdas
- Postgres Database
- Cognito Layer for Authentication
- Elastic Beanstalk Environments (Dev, Test, UAT and Production)
- SES for sending emails to customers
- CloudFormation Scripts (At the time developed in Troposphere)
- CI/CD was done through BitBucket at the time
Elastic Beanstalk
Setting up and maintaining multiple environments at scale is no easy task. Getting this done can easily take up most of the start time for a new project. “As part of our brief, we needed to setup pipelines to deploy to various nonproduction environments before deploying a new version to production”. This process was simplified thanks to Elastic Beanstalk.
What is Elastic Beanstalk?
AWS Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.
One of the key benefits Elastic Beanstalk brings to the table is in its simplicity which was a core requirement on this project as Rewardsco needed to be able to maintain the service themselves. Much like a one-stop-shop, Elastic Beanstalk offered all those bells and whistles the clients were looking for:
- Auto scaling
- App health monitoring
- Load balancing
- Simplified deployment process
- High flexibility
- Allows for multiple environments
With these rich features in play, we developed a deployment pipeline that utilises the latest technologies presented in a user-friendly fashion.
“Once the environments and applications were created on Elastic Beanstalk, we could start deploying new versions of the client’s software, implementing automated pipelines to streamline the deployment process for our client” explains Van Biljon.
Integration with automated pipelines is near effortless thanks to the comprehensive CLI tool provided by AWS.
Elastic Beanstalk also allows engineers to specify which of the various deployment policies should be used when rolling out new versions of software. Since not all rollouts are equal in requirement it is good to know that Elastic Beanstalk can assist with this as well.
The options available include:
- AllAtOnce – disables rolling deployments and always deploys to all instances simultaneously
- Rolling – enables standard rolling deployments
- RollingWithAdditionalBatch – launches an extra batch of instances, before starting the deployment, to maintain full capacity
- Immutable – performs an immutable update for every deployment
- TrafficSplitting – performs traffic-splitting deployments to canary-test your application deployments
With these options available the client can easily decide which deployment strategy would work best for their user base. If their requirement changes in the future the configuration can easily be changed to suit their needs.
AWS Lambda
AWS Lambda provides computing services without the need to manage servers. This includes automatic scaling as load increases which ultimately leads to cost optimisation since you only pay for the computing resources used per millisecond.
Having AWS Lambda at your disposal can open a lot of doors for software engineers. Not only is it fast and performant, but it is highly scalable and has huge cost benefits for the client.
For this project we had implemented a lot of the API endpoints by using a combination of AWS Lambda, API Gateway, CloudFront and S3. Most of these endpoints were set to perform CRUD operations.
Keeping images at optimal dimensions can be a challenge when it comes to building performant websites. To increase performance, you need to serve images that are pre-scaled to the required dimensions. This means you may end up with a stack of images in various dimensions and formats to cater for all the different UI requirements – from thumbnails to high-res.
To solve this challenge, the team utilised the auto scaling abilities of Lambda and stacked that on top of the caching capabilities of API Gateway and CloudFront, Van Biljon explains that they were able to decrease image load times quite significantly. All of this without having to keep track of various sized images.
The outcome
With the power of simplicity at our disposal, thanks to advances in cloud technology, BBD was able to provide an easy to maintain solution without sacrificing flexibility. Rewardsco can now monitor and adjust their platform according to their needs around the complexities that auto scaling can bring, without the inhouse expert knowledge.
If you are looking for long lasting cloud solutions, serverless solution offerings are something to consider.
If you’re looking to move your business to the cloud, or further enhance your service offering using cloud-based solutions, reach out to us.
About Rewardsco
The Rewardsco Group consists of multiple brands with a strong focus on sales, product development, distribution and logistics, servicing consumers on behalf of the largest mobile networks, internet providers and financial services brands in South Africa. The company operates on world-class infrastructure and technology to leverage digital, telecommunications and e-commerce channels to maximise value for our clients and stakeholders.