BBD was tasked with building a solution using as many serverless and managed services as possible. This would allow for scaling on demand, while minimising on-going maintenance and operational efforts, as well as being simple to use, scalable, responsive and cost-effective.
Rewardsco targets a wide range of markets, so the platform needed to perform efficiently, even on slow network connections. Another key requirement was that the platform should not suffer under a sudden influx of traffic as we release various deals to customers, which can cause a higher sudden demand in infrastructure.
To facilitate high demand and reduce costs, 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.
The team from BBD needed to utilise technologies that would enable rapid development which would not result in any trade-offs. The BBD team further needed to have all the tech under one umbrella since a distributed solution would increase the complexity of the solution.
AWS Elastic Beanstalk
The solution consisted of two main components: a customer-facing website and a CMS system. Each component included a back- or front-end. A key service in enabling this project was AWS Elastic Beanstalk.
The solution consisted included 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.
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 is its simplicity, which was ideal as Rewardsco needed to be able to maintain the service on our own. Elastic Beanstalk offered crucial capabilities, including:
- Auto scaling
- App health monitoring
- Load balancing
- Simplified deployment process
- High flexibility
- Allows for multiple environments
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.
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
These options allowed us to easily decide which deployment strategy would work best for our user base and to change the configuration in the future to meet 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.
AWS Lambda is not only fast and high-performance, but it is highly scalable and has huge cost benefits. For this project, BBD 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 could 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 images. By utilising the auto-scaling abilities of Lambda and stacking that on top of the caching capabilities of API Gateway and CloudFront, BBD was able to increase image load times quite significantly 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. AWS empowered Rewardsco to monitor and adjust our platform according to our needs without the complexities that auto-scaling and managing servers can bring.