Migrating to a simplified serverless cloud solution
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 its entire stack, it 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 its ongoing maintenance and operational effort.
Knowing it didn’t have the in-house 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 BBD 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 its customers, causing a higher sudden demand in infrastructure. To facilitate this and help save cost to the client, BBD 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 BBD, the requirement set out by the client needed to be:
- Flexible in design;
- Reliable; and, above all
The team from BBD 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. BBD needed to utilise technologies that would enable rapid development that 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.”
The BBD team further needed to have all the tech under one umbrella since a distributed solution would increase the complexity of the solution.
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’s 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 e-mails to customers;
- CloudFormation scripts (at the time developed in Troposphere); and
- CI/CD was done through BitBucket at the time.
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 set up pipelines to deploy to various non-production 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 BBD’s client 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:
- App health monitoring;
- Load balancing;
- Simplified deployment process;
- High flexibility; and
- Allows for multiple environments.
With these rich features in play, BBD 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 roll-outs 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 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, BBD 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, BBD 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 BBD was able to decrease image load times quite significantly. All of this without having to keep track of various sized images.
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 its platform according to its needs around the complexities that auto-scaling can bring, without the in-house 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 BBD at www.bbdsoftware.com.