Transitioning and Expanding Your Serverless Application to a Global SaaS Offering with AWS

Jari Ikävalko
Skillwell
16 min readSep 27, 2023

--

Growing enterprises often start by developing internal applications to solve specific problems. However, when these applications have the potential to solve industry-wide challenges, transitioning them into Software-as-a-Service (SaaS) offerings can open up new revenue streams. In this blog post, we’ll explore how to take your internally developed serverless application and prepare it for a global customer base.

When an application is initially developed for internal use, it’s generally designed to solve specific organizational needs. However, as the application matures and its potential to serve a broader audience becomes evident, the idea of transforming it into a Software-as-a-Service (SaaS) offering starts to take shape. At this juncture, it’s essential to recognize that the journey from an internal application to a commercial SaaS product isn’t just about adding a pricing page or enabling user sign-ups. There are architectural details that are often not part of the initial design but become crucial when opening up the application for external clients.

Missing Pieces in the Original Architecture

Initial designs often focus on immediate needs, overlooking elements critical for transitioning to a SaaS model.

Let’s explore these:

  1. Multi-Tenancy: An internal application is typically single-tenant by nature. Transitioning to a SaaS model demands considerations for housing multiple tenants (customers) in an efficient yet isolated manner.
  2. Scalability: Internal applications often start with a limited user base and may not require design considerations for global scale. While serverless architectures can inherently handle variable workloads, scaling to accommodate a diverse and extensive customer base presents challenges both in terms of infrastructure and performance. Additionally, AWS service limits, such as API request rates or storage capacities, can impose constraints that need to be proactively managed to ensure smooth scaling.
  3. Data Segregation and Security: With internal applications, data security is important but often confined to organizational boundaries. When transitioning to SaaS, ensuring data isolation and security for multiple external customers becomes paramount.
  4. Regulatory and Compliance Needs: Internal applications usually need to comply with a more straightforward set of guidelines. However, when serving multiple clients across countries, you might have to navigate a labyrinth of regulatory requirements.

Focus of This Blog Post

The focus of this post is to guide you through the intricacies of taking an application, originally developed for internal use, and expanding it into a SaaS product for a global audience. We will explore how AWS features and organizational structures, such as AWS regions and customer-specific AWS accounts, can facilitate this transition and scaling process.

Example Scenario

Imagine a logistics management application initially developed for internal use by a Finnish shipping company. The application optimizes delivery routes, manages real-time inventory, and streamlines communication between drivers and dispatchers. Over time, it incorporates machine learning algorithms for predictive delivery times and automatic warehouse stock replenishment.

Seeing the broader application potential, the company decides to transition this solution into a SaaS offering. However, the initial architecture didn’t consider elements crucial for a multi-tenant environment — such as data segregation and multi-tenancy itself. Additionally, adapting the application to meet varying regulatory and compliance needs across countries would require a substantial overhaul of the existing codebase.

Given these complexities and the fact that the application’s traffic patterns don’t demand shared resources between customer instances, the company opts for a simpler route. Each country-specific offering is deployed as a standalone instance on its own AWS account, making it easier to adapt to local requirements without altering the original architecture fundamentally.

The goal now is to leverage AWS services to scale this serverless application model for a diverse customer base across various nations. Each country-specific offering is deployed as a standalone instance in its own AWS account, fine-tuned to meet local regulations and preferences. This approach allows us to take full advantage of AWS’s robust global infrastructure for reliable, high-performance service delivery.

To summarize, the cornerstone of our example scenario is the notion of deploying standalone instances for each country-specific offering, each within its own AWS account. This approach streamlines adaptation to local requirements while preserving the integrity of the original architecture. Utilizing individual AWS accounts for each country-specific instance not only simplifies international expansion but also mitigates the complexities involved in retrofitting multi-tenancy and data segregation into an existing solution. In the following section, we will delve into the anticipated milestones that will guide this global SaaS transformation.

Anticipated Milestones for Global SaaS Transformation

As we pivot towards a SaaS delivery model, there are several key milestones that will serve as our guiding markers. These benchmarks not only measure our progress but also ensure the successful metamorphosis of our internal application into a scalable, global SaaS offering.

In the ensuing sections of this blog post, we will delve into the following critical milestones:

  • Streamlined Instance Setup: Ensuring the application architecture is designed for dynamic and scalable deployments, including initial installation and future updates, across multiple AWS accounts.
  • Unified Codebase Management: Maintaining a single repository to manage customer-specific features and requirements.
  • Automated Deployment for Country-Specific Instances: Automating the setup and deployment of new country-specific instances in isolated AWS accounts.
  • Robust Data Security and Compliance: Ensuring comprehensive data protection and regulatory compliance for each customer instance.
  • Comprehensive Monitoring and Oversight: Implementing real-time monitoring and alert systems across all customer-specific instances.
  • Self-Service Customer Onboarding: Enabling an intuitive, user-friendly setup process for new customers.

By providing this roadmap, we aim to offer you a structured exploration of each challenge and the AWS solutions that are suited to overcome them. To set the stage, we will first introduce the existing architecture of our logistics management application. Armed with this foundational knowledge, we will then delve into each of these key milestones in greater detail.

Understanding the Existing Architecture

To fully appreciate the challenges and strategies involved in transforming our internal logistics management application into a global SaaS offering, it’s essential to first understand its existing architecture. The application is built using a suite of AWS resources, complemented by a frontend developed in Angular. Below are the key components:

Backend Components:

  • AWS Lambda: Executes serverless functions that manage various logistics operations.
  • Amazon DynamoDB: Acts as the primary database for storing logistics data.
  • API Gateway: Serves as the entry point for application traffic, facilitating the routing, transformation, and management of requests between clients and back-end services.
  • Amazon S3: Houses essential files, such as shipping labels and invoices.
  • Amazon SQS and SNS: Responsible for message queuing and notifications, respectively.
  • AWS Step Functions: Orchestrates complex logistics workflows involving multiple microservices, mainly Lambda functions.
  • Amazon CloudWatch: Offers comprehensive monitoring and logging capabilities.
  • AWS IAM: Manages role-based access to various AWS resources.
  • Amazon Route 53: Handles DNS management for domain-related configurations.
  • Amazon SageMaker: Enables machine learning capabilities for predictive analytics and route optimizations.

Frontend Components:

  • Angular: The user interface of the application is developed using Angular.
  • Amazon S3: Hosts the static Angular application files.
  • Amazon CloudFront: Delivers the Angular application with optimized performance via a Content Delivery Network (CDN).

Deployment Pipeline:

The application currently operates in three distinct environments — Development, Staging, and Production. AWS CodePipeline manages the deployment process, leveraging AWS CodeBuild for code compilation and AWS CodeDeploy for deployments to these specific environments.

With this baseline understanding, the forthcoming sections will explore how we can adapt and scale this architecture to suit the unique requirements of a multi-tenant, global SaaS offering.

The existing serverless architecture is robust and well-orchestrated, providing a strong foundation for our expansion into a global SaaS offering. The setup process is already streamlined through AWS CloudFormation and AWS CodePipeline, allowing us to focus on other complexities involved in scaling across multiple countries and customers. In the next section, we’ll explore the key details that we need to address when ensuring the application architecture is designed for dynamic and scalable deployments.

Streamlined Instance Setup

As we shift our logistics management application to a global SaaS model, it’s essential that the architecture can be dynamically and scalably deployed to any number of AWS accounts. This not only involves the initial setup but also ensures the system can handle future updates without hitches.

Our existing infrastructure leverages the capabilities of AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy to facilitate automated deployments across multiple environments — namely development, staging, and production. Given this established setup, it’s reasonable to infer that the majority of our CloudFormation templates and deployment scripts are already parameterized, thus enabling seamless deployments to any designated AWS account.

However, to successfully enable the dynamic extension of deployments across an unspecified number of new AWS accounts, certain considerations must be meticulously examined.

These considerations encompass the following:

  1. Naming of Resources: Specific AWS resources, such as S3 buckets, mandate unique names. For other resources, adhering to a descriptive naming scheme within customer accounts is advisable. Such naming considerations must be integrated into the CloudFormation scripts through careful parameterization.
  2. Permission Policies: Upon modifying AWS resource names, it is imperative to update the associated permission policies to reflect these changes, ensuring seamless access control.
  3. DNS Records: For each customer account, a dedicated HostedZone for a subdomain must be established. Additionally, DNS records pointing to this HostedZone must be updated in the main domain’s HostedZone. Automating this process is crucial for seamless deployments.
  4. SSL certificates: Employing individual SSL certificates for each subdomain is considered best practice. These certificates can be requested via AWS Certificate Manager (ACM) and their provisioning should be automated. For a detailed example on how to accomplish this, you can refer to this AWS Blogs article: How to Deploy Public ACM Certificates Across Multiple AWS Accounts and Regions Using AWS CloudFormation StackSets.

In summary, the goal of Streamlined Instance Setup is to fine-tune the existing architecture for seamless, dynamic deployments across a multitude of new AWS accounts. By addressing nuances in resource naming, permission policies, DNS configuration, and SSL certificate provisioning, we lay a robust foundation for scalable customer-specific deployments. With these essential preparations in place, we are well-positioned to tackle our next pivotal milestone: Unified Codebase Management, where we will discuss strategies for delivering customer-specific versions of our application using a single, manageable codebase.

Unified Codebase Management

In the journey toward establishing a global SaaS offering, managing a unified codebase is a cornerstone that cannot be overlooked. It’s pivotal to recognize that while the bedrock of any SaaS application remains constant, unique customer needs and regional regulations necessitate a degree of customization. This poses a fundamental question: How do we maintain a single codebase while offering customer-specific features and complying with varying regulations?

The Imperative for a Single Codebase

Operating from a single codebase brings forth several advantages, including streamlined development, easier debugging, and a simplified deployment pipeline. When all customers are on the same version, pushing updates becomes a coherent, well-coordinated process. The efficiencies realized here allow the development team to focus on feature improvements and bug fixes rather than maintaining multiple code branches.

Feature Flags: Dynamic Customization

One prevalent strategy for managing customer-specific features within a unified codebase is the use of Feature Flags. This approach enables the toggling of features on or off based on configurations that can be altered without changing the code itself. Feature Flags make it possible to serve different feature sets to different customers, all while operating from the same underlying codebase. They offer the flexibility to test new features in a controlled environment and roll them out incrementally, thus minimizing risk.

Extensions: External Customization Through Public API

Another avenue for providing customer-specific functionalities is through Extensions. In this approach, the core SaaS application exposes a public API that allows for the development of external features. These features, built as separate modules or even as stand-alone applications, interact with the core SaaS platform through API calls. This modular architecture provides the agility to adapt to customer-specific requirements and regulatory mandates without affecting the core codebase.

Striking the Balance

Both Feature Flags and Extensions come with their own set of pros and cons, and the choice between them often boils down to the specific needs of your customer base and the nature of the customizations required. Nonetheless, either strategy aligns well with the principle of maintaining a unified codebase, thereby offering a structured approach to manage customer-specific customizations efficiently.

In conclusion, Unified Codebase Management is about striking a harmonious balance between uniformity and customization. By employing strategies like Feature Flags and Extensions, we can offer a tailored experience to each customer without diverging from our core codebase. With a flexible and unified codebase in place, we are better positioned to tackle the next challenge: Automating the deployment process for new, country-specific instances to accelerate our global SaaS expansion.

Automated Deployment for Country-Specific Instances

As we scale our SaaS offering to cater to a diverse set of international clients, the capability to automate deployments becomes ever more critical. In this context, AWS Organizations and AWS Control Tower stand as pivotal tools for streamlining this process.

Leveraging AWS Organizations

AWS Organizations allows us to centrally manage the billing of AWS resources, enforce policies, and implement governance mechanisms across our entire infrastructure. With AWS Organizations, we have the capability to organize our multiple AWS accounts into a hierarchical tree structure. This structure facilitates the application of Service Control Policies (SCPs) across these accounts, thereby ensuring consistent security measures and compliance settings.

AWS Control Tower for Dynamic Account Creation

AWS Control Tower complements AWS Organizations by simplifying the setup and governance of multiple AWS accounts. With its automated account factory feature, AWS Control Tower can dynamically create new AWS accounts and integrate them into the pre-existing organization tree in AWS Organizations. This ensures that each new account adheres to our company-wide policies right from the moment it is created.

Regional Adaptability

One of the compelling advantages of this architecture is its inherent flexibility to deploy country-specific instances across different AWS regions. This is crucial for compliance with data sovereignty laws and can improve service latency for users in various geographical locations. Utilizing AWS Control Tower, we can set up landing zones in different regions for new accounts, ensuring that each country-specific instance is optimized for local requirements.

By harnessing the synergy of AWS Organizations and AWS Control Tower, we can automate the deployment and governance of new country-specific instances. This not only accelerates our time-to-market but also ensures that each instance is compliant with our security and governance framework. Such automation facilitates a smooth transition as we extend our SaaS offering globally, allowing us to focus on core product development rather than operational overhead. This sets the stage for our subsequent milestone, which focuses on ensuring robust data security and compliance mechanisms across our global SaaS offering.

Robust Data Security and Compliance

As we progress through our SaaS transformation roadmap, safeguarding customer data and ensuring compliance with a myriad of global regulations become paramount concerns. A unified codebase and streamlined deployment processes alone are not sufficient; we must also lay a robust foundation for data security and compliance.

Below, we explore some key strategies and AWS services that fortify our architecture in these crucial areas.

Encrypting Data at Rest

Encryption of data at rest is a fundamental step toward securing sensitive customer information. Utilizing services like AWS Key Management Service (KMS), we can automatically encrypt data stored in S3 buckets, DynamoDB, and other AWS storage services. This provides an added layer of security, mitigating risks associated with unauthorized data access.

Access Restriction Measures

In a multi-tenant SaaS environment, restricting data access is critical. We leverage IAM roles and policies to enforce strict access controls. These permissions are fine-tuned to ensure that only authorized personnel have access to specific resources, thereby adhering to the principle of least privilege.

AWS Organizations and Service Control Policies (SCPs)

Using AWS Organizations and Service Control Policies (SCPs), we can enforce consistent security and compliance policies across multiple AWS accounts. SCPs allow us to define granular permissions and restrictions that propagate across the organizational hierarchy, ensuring a uniform application of security measures.

Monitoring and Auditing with AWS CloudTrail and Audit Accounts

Monitoring user activity and API usage is vital for both security and compliance. AWS CloudTrail provides detailed logs of all account activity, making it easier to conduct thorough audits. Furthermore, implementing a separate AWS account exclusively for audit purposes provides an isolated environment to securely store and analyze these logs.

Compliance Tracking with AWS Config’s Multi-Account Support

Leveraging the multi-account capabilities of AWS Config, we can continuously monitor and assess our resource configurations for compliance across numerous AWS accounts. Automated alerts notify us of any non-compliant changes, allowing for immediate corrective actions. This integrated approach simplifies governance, risk management, and compliance operations, ensuring that we are aligned with both external regulations and internal policies.

In summation, achieving robust data security and compliance in a SaaS environment is a multi-faceted endeavor. By leveraging a combination of encryption techniques, access control measures, organizational policies, and proactive monitoring, we are well-positioned to protect customer data and meet stringent compliance requirements. As we advance toward full SaaS adoption, these security and compliance mechanisms will continue to evolve and adapt, thereby bolstering the integrity and reliability of our platform.

Comprehensive Monitoring and Oversight

The efficacy of any SaaS offering is inherently linked to the ability of the SaaS operator to maintain comprehensive visibility over the entire ecosystem. The significance of this oversight isn’t about scrutinizing customer-specific data but centers around ensuring the seamless operation of the platform and the effective utilization of its features by customers.

Real-time Analytics for Operational Excellence

As elucidated in my earlier article, “Implementing Serverless Real-Time Analytics for SaaS with AWS Services”, real-time analytics play an invaluable role in gauging system performance and customer engagement. Leveraging cutting-edge AWS services, analytics can offer a granular understanding of user behavior, resource consumption, and system health, which is pivotal for strategic decision-making and customer satisfaction.

Onboarding: Beyond Technical Setup

Onboarding is not merely a one-off activity focused on the technical setup of a new instance. Rather, it’s an ongoing process that extends until the customer fully embraces the service, using it as intended. Tracking the various stages of customer onboarding is crucial, as it helps to identify areas where customers might be struggling or where they could leverage the platform more efficiently.

Universal SaaS Control Plane: An Integrated Solution

To this end, our proprietary solution, Universal SaaS Control Plane, has been specifically engineered to provide SaaS operators with a centralized dashboard offering a holistic view of all customer instances. It enables operators to understand customer onboarding progress, monitor resource utilization, and perform real-time analytics, all while ensuring strict adherence to privacy and compliance standards.

Operational Transparency: A Cornerstone of Customer Trust

Unquestionably, transparency and control are foundational elements for building and retaining customer trust. By employing robust monitoring and oversight tools, SaaS operators can not only improve the reliability and performance of the service but also instill confidence among their customer base.

In summary, a focus on comprehensive monitoring and oversight is critical for running a reliable and efficient SaaS offering. With these systems in place, we’re set to explore the final touchpoint of our customer experience: a self-service onboarding process that allows customers to easily sign up, choose their service tier, and begin using the platform effectively.

Self-Service Customer Onboarding

As the final cornerstone in our journey to transform a serverless application into a comprehensive SaaS offering, we introduce self-service customer onboarding. This element allows us to complete the customer experience loop, empowering users to take control of their journey from the get-go. From signing up for the service to changing subscription tiers, self-service streamlines the process, making it as frictionless as possible.

Service Tiers

As part of our transformation journey, we’ve introduced multiple service tiers — Bronze, Silver, and Gold — each carefully designed to meet a range of customer needs. These tiers offer distinct combinations of features and capabilities, providing customers with the flexibility to select and transition between plans as their requirements evolve.

Role of Universal SaaS Control Plane

Our Universal SaaS Control Plane plays a pivotal role in this regard. It acts as the orchestrator, coordinating between the customer-facing marketing website and the underlying SaaS infrastructure. When a customer decides to take our service into use via the marketing website, it triggers a set of orchestrated actions within the Universal SaaS Control Plane. These actions initiate the onboarding process, allocate resources, and ensure the seamless integration of the customer into the system.

By leveraging the capabilities of the Universal SaaS Control Plane, we provide a unified, automated, and streamlined onboarding process that not only enhances the customer experience but also significantly reduces the manual operational overhead.

This focus on self-service and streamlined onboarding aligns perfectly with our overall mission to offer an agile, customer-centric SaaS solution. It marks the culmination of our efforts, rendering our application not just serverless but truly Software-as-a-Service.

Conclusion

As we’ve navigated through the myriad complexities and intricacies of transitioning a serverless application into a full-fledged SaaS offering, several key themes have emerged. These themes form the cornerstones of our approach to offering a scalable, secure, and customer-centric SaaS solution.

  1. Streamlined Instance Setup: Our existing AWS-centric infrastructure has set the stage for dynamic and scalable deployments to new accounts, ensuring a seamless initial setup and updates for every customer instance.
  2. Unified Codebase Management: By leveraging Feature Flags and Extensions, we manage to offer a personalized customer experience while maintaining a single, unified codebase.
  3. Automated Deployment for Country-Specific Instances: Through the integration of AWS Organizations and AWS Control Tower, we’ve automated the governance and deployment process, enabling us to expand our offering across geographical regions swiftly and compliantly.
  4. Robust Data Security and Compliance: By employing industry-standard encryption and leveraging AWS tools like Service Control Policies and AWS Config, we’ve ensured that our data is both secure and compliant with various regulations.
  5. Comprehensive Monitoring and Oversight: Our in-house product, Universal SaaS Control Plane, plays a vital role in providing real-time analytics and insights into customer usage and onboarding, which are critical for business optimization.
  6. Self-Service Customer Onboarding: Finally, we’ve closed the loop by enabling customers to onboard themselves via a specific marketing website. This self-service feature is powered by Universal SaaS Control Plane and allows customers to choose from various service tiers, thereby enhancing user autonomy and satisfaction.

In summary, the transformation from a serverless architecture to a SaaS model is a multifaceted endeavor that requires meticulous planning, robust technology, and a customer-focused approach. By covering each of these aspects in detail, we have laid a solid foundation for a SaaS solution that not only meets but exceeds customer expectations.

Thank you for reading, and stay tuned for more in-depth articles on leveraging AWS services for your SaaS solutions.

--

--

Jari Ikävalko
Skillwell

Solutions Architect at Skillwell. AWS Ambassador. Specializing in SaaS and AWS integrations. Author on scalable, secure SaaS.