< Back to AWS - Insight

Ten tips for a seamless move to serverless

Serverless

As managing legacy monolith applications becomes increasingly cumbersome, many businesses are integrating microservices into their application architecture to solve problems related to maintaining and updating the application, safely adding new features, managing scalability, and onboarding new developers.

Past this point, the next logical step in this process is to make a move to serverless computing.

Just as the transition to microservices is generally gradual, with more and more services breaking off the monolith until the monolith disappears, the switch to serverless generally follows a similar pattern.

So the challenge for many at this stage becomes how to make it a smooth transition.

Below we’ve highlighted ten tips to help you tackle this common challenge and seamlessly move to serverless.

Ensuring a smooth transition to serverless

  1. Define your goal: What business problem are you trying to solve by moving to serverless? Is slow feature delivery causing you to lose customers? Are scalability and stability problems damaging your brand? Are you looking to reduce the cost of running your system? Do you want to lower your developers’ operational overhead and have them focus on creating business value? Whatever the reason is, understand the business impact you want to create by moving to serverless.
  2. Identify low-risk business areas for the pilot: It’s essential to recognize that innovation and change require learning. Learning requires taking risks and making mistakes. Start migrating low-risk, non-critical business processes to minimize risk and avoid costly mistakes. The key is to prevent big-bang migration wherever possible and ensure you have your stakeholders’ support.
  3. Prototype, learn, and repeat: This is the fun part where you build proofs of concept (POCs) to learn and validate your assumptions. These POC projects are your playground where you can learn quickly and fail cheaply; do not confuse them with production code. Be sure to delete them after you have extracted maximum learning from them.
  4. Apply continuous delivery: The sooner you apply continuous delivery (CD) to your serverless project, the better. This is the time to choose a tried and tested deployment framework. While it can be tempting, resist the urge to create your own – it’s precisely the type of heavy lifting you want to avoid.
  5. Automate testing: With a move to serverless, your code has become simpler than ever; however, the complexity doesn’t disappear. Instead, the complexity moves around. It is now in the configuration and security of your functions and how they interact with external dependencies. These are the things that are most likely to break your application now. What is tested should reflect this change in the risk profile. The focus here should be on integration and acceptance tests.
  6. Build observability into the code: This stage involves a few key factors for consideration – leverage and ship your logs to a log aggregation service where they can be easily searched. Use structured logging with JSON and complement log messages with contextual data helpful in finding related logs. For example, include the order ID as an attribute in every log message related to an order. This is the opportune time to create dashboards and alarms for key performance indicators.
  7. Focus on security: Follow the principle of least privilege, meaning each function should have only the permissions it needs – nothing more, nothing less. Apply account level isolation so each environment has a separate account to help contain a security breach. You can also use git commit hooks to stop account credentials from leaking.
  8. Apply continuous learning: You’re in production; congratulations! But don’t stop there. Keep experimenting, learning and iterating on your designs. Share what you’ve learned with other teams and with the broader developer community.
  9. Standardize error-handling and correlation IDs: Identify common patterns and cross-cutting concerns. Then, look for ways to standardize how you deal with these concerns—using middleware engines such as middy is an excellent way to normalize your code.
  10. Automate operations and security monitoring: Use the power of serverless to automate processes and security monitoring. For example, you can adopt ChatOps using AWS Lambda with Slack integration.