Moonpig Tech Blog
Published in

Moonpig Tech Blog

Re:Invent Moonpig edition

Every year at their annual developer conference, Re:Invent, AWS announces a whole range of new services and updates to existing services. At Moonpig this provides us with exciting new possibilities to simplify the code we run, offer us cheaper ways of operating on the cloud and the ability to provide our customers with a better experience. Re:Invent 2022 was no different and in this post we’ll look at some of the new services that are most exciting for us.

OpenSearch Serverless

Our tech stack is built on serverless technologies. Over the years it has allowed us to move faster, scale quicker and keep us focused on our customer needs, rather than worrying about infrastructure (no user story has ever started with “as a user I want an auto scaling group”). Almost every part of the Moonpig website, from the home page to the order history page is running without any provisioned infrastructure, except from the search system. This has meant we’ve often had to over provision our baseline search cluster to account for bursts in traffic, which can be costly.

OpenSearch logo

We also use OpenSearch as part of our logging system, allowing our engineers to query logs from Lambda, API Gateways and the hardware in our factories all in one place. There is a similar story here too, we need to provision the cluster large enough to deal with any bursts in demand. Our engineering teams tend to work around 9–5 and mostly in the UK, so we have 2 very distinct traffic patterns. We have an almost continual load on log ingestion since we operate in the USA, Europe and Australia, but only have a large load on querying the logs during our UK business hours.

Serverless OpenSearch will allow us to easily and quickly scale the website search system, as well as scale ingestion and query nodes independently in our logging stack. It’s safe to say we’re excited about this one.

Lambda SnapStart

Almost all of our running code is written on C# on .NET and Typescript on Node, and almost all of our compute workloads run on Lambda. For years the idea of a ‘Cold Start’ 😰 has struck fear into an engineer building consumer facing applications on Lambda, where a .NET function might have a cold start time of around 800ms and a Node function might be around 300ms. Neither of these are as bad as the 5 second+ times that Java functions suffer. Lambda SnapStart can allow Java functions to start in as little as 500ms by taking a snapshot (and people think AWS naming it weird…) of the newly created and warmed Lambda function, and use that snapshot to start all subsequent Lambda instances, rather than starting up from cold each time. Whilst we don’t run Java at Moonpig, the innovation and changes to the Lambda service that have allowed the SnapStart feature to exist will hopefully be of benefit to us in the future and help us to reduce our .NET and Node cold start times.

AWS SAM and Terraform tooling

The SAM Squirrel and the Terraform logo

At Moonpig Infrastructure as Code is a hard requirement, and our IaC tooling of choice is Terraform. Nothing can make it to a production environment without a Terraform definition. We use Terraform because it helps us configure not only our AWS accounts, but a variety of other SaaS providers we use. However, because it’s not AWS’s native IaC language (that would be CloudFormation), it can often be left behind when AWS announces some great tooling. The Serverless Application Model, or SAM, CLI is a CLI tool that AWS have supported for years that can alleviate many of the pains around Serverless development, and until recently, it has only supported CloudFormation. The SAM tooling now supports Terraform allowing us to easily run, test and debug our Lambda functions locally, which can massively reduce the feedback loop for our engineering teams. This seems like a great win for developer experience, and it’s great to see AWS supporting the open source Terraform IaC toolset with their own CLI.

Everything else

There are just too many great AWS announcements that happened at Re:Invent to take a closer look at all of them, but here is a summary of the rest:

  • EventBridge improvements. There are several interesting improvements to Eventbridge introduced at Re:Invent including the new advanced filtering, pipes and the scheduler. Many companies have a need to schedule events for a certain time in the future and there was no native way to do so on AWS. This could have lots of applications in the future.
  • Amplify and NextJS. We run our consumer facing website and many internal tools on NextJS. AWS hasn’t offered a native way of running server side rendered Next apps on AWS above Next v11, so we’ve had to run our Next v12 apps on Lambda. Now that Amplify supports v12 and the recently announced v13, we can investigate if they’d be suitable for our requirements.
  • Console Resource Explorer. Because we operate in multiple regions, it can often take several clicks to find your resource. The new Resource Explorer allows you to easily search for resources in the same search bar you use to search for AWS services. And it’s totally free to use.
  • Cloudwatch improvements. We make heavy use of Cloudwatch for our logs and metrics, and we process a large volume of PII data. Whilst we take active efforts to ensure we don’t log this, Cloudwatch Datamasking can help us go one step further and remove it when we’re processing the data to ensure it’s never exposed. This goes along with the announced Cross Account Cloudwatch log querying, cross account X-Ray and X-Ray across SQS to complete a number of nice improvements in the logging and observability space.

Re:Invent isn’t the only time that AWS releases new features and services, but it certainly is one of the busiest times of the year for announcements. Along with the hundreds of talks and deep dive sessions, it makes for an exciting time for anyone using AWS. Our modern technology stack allows our engineers to adopt many of the new services and gives us plenty of new and interesting things to look at once we’ve got past the busy winter card and gifting season. I hope you’ve enjoyed reading about some of the new AWS services we look forward to exploring at Moonpig.

--

--

Learn about how we use technology, lean and agile practices to succeed in the online personalisation market whilst moving at supersonic speed.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ryan Cormack

Serverless software engineer working on systems in the AWS cloud