Optimising AWS to Azure Migration: How We Successfully Migrated our AI Product

Yazan Kassam, DevOps Engineer

7 min read

.

July 15, 2024

DevOps

Side-by-side logos of AWS and Azure

Cloud computing is an integral ground for AI initiatives to reach their full potential. They offer scalable infrastructure, computational power, storage, and speed for machine learning algorithms to evolve.

An increasing number of technology enterprises are using cloud computing services in one form or another. But, as businesses change course, they may want to migrate their applications from one cloud platform to another. The reasons can include a desire for cost savings, enhanced performance, improved scalability, or leveraging unique Azure features.

In this article, we explore how AlphaApps successfully migrated an AI product from AWS to Azure. We will delve into the CI/CD challenges encountered during the migration, the innovative solutions implemented, and the resulting benefits. Additionally, we will share best practices for ensuring a smooth and efficient transition. Whether you are currently facing similar obstacles or planning a future migration, this article offers valuable insights to support your journey.

Understanding Pedant: Our AI-powered document processing solution

Pedant AI platform user interface highlighting document management features

Our AI product, Pedant, is a platform that revolutionises financial document management by streamlining processes for invoices, delivery notes, and bank cheques. Leveraging artificial intelligence, Pedant automates the extraction, classification, and verification of data from these documents, helping organisations reduce operational costs, speed up processing times, and minimise errors.

Initially, we utilised AWS CodeCommit, CodeBuild, and CodePipeline for Pedant's CI/CD pipeline. This setup was effective for automating our build and test processes, facilitating seamless code integration, and running extensive tests. However, the need for enhanced integration and scalability prompted us to migrate to Azure. 

Let us delve into the specific reasons behind this decision and the benefits we aimed to achieve.

No items found.

AWS to Azure migration: Why we moved our AI product

Here’s why we chose to migrate our AI product to Azure.

1. Leveraging Azure's cognitive services suite for our AI Product

Azure offers several AI tools and services under its Cognitive Services suite, each tailored for specific applications. For an AI product focused on intelligent document processing like ours, services like Azure AI Vision and Azure Form Recognizer are invaluable. These tools automate and enhance data extraction, classification, and verification processes. They also significantly improve efficiency and accuracy in managing financial documents such as invoices, delivery notes, and bank cheques.

2. Seamless integration with OpenAI models

The integration with OpenAI in Azure OpenAI Service provides REST API access to OpenAI's powerful language models, including GPT-4 and GPT-4o. This allows AI products to leverage the advanced capabilities of GPT-4 without needing to set up separate infrastructure or manage deployments.

3. Enhancing AI product flexibility with Azure Web App Architecture

The architecture of Azure Web App offers high flexibility and efficiency in resource consumption with Scale out and Scale up features, especially compared to AWS Lambda Functions, which have a memory limit of 10,240 MB. For AI products and services, this means more scalable and adaptable resource management, enabling complex and demanding applications.

Additionally, Azure Web App Plans allow shared computing resources among multiple apps. They enhance cost management and make it easier to scale AI applications without incurring prohibitive costs.

4. Achieving cost efficiency with Azure's server-based services

Transitioning from fully serverless AWS Lambda Functions to server-based Azure Web App has been crucial for cost management. The approach is particularly beneficial when handling a high volume of document processing requests, as it allows for more manageable resource allocation. The server-based architecture in Azure ensures that AI projects can maintain high performance and scalability while optimising operational expenses.

AWS to Azure: Overcoming migration challenges

1. Adapting to Azure: navigating a new cloud platform

Pedant was our first product on Azure and it required us to get familiar with a new cloud platform. We dedicated time to learning and adapting to Azure’s environment, ensuring a smooth transition and effective use of its services. Our efforts laid a solid foundation for successfully implementing Pedant and leveraging Azure's capabilities for optimal performance.

2. Choosing the right managed computing services

Azure offers several managed computing services, including Container Instance, Web App, Container App, Function, and AKS. Selecting the best option for each microservice in our project posed a significant challenge. To address this, we conducted thorough evaluations of each service and focused on their specific functionalities and capabilities.

3. Enhancing scalability with server-based computing

Transitioning Pedant's AI section from serverless computing to server-based services was essential to achieve stability. This shift allowed us to overcome the capacity limitations inherent in serverless computing. It ensured that Pedant could scale seamlessly with growing demand. By adopting server-based services, we enhanced the platform's ability to handle intensive document processing tasks efficiently.

4. Enhancing deployment flexibility in Azure

Initially, Azure Web App presented a challenge as it did not support running multiple containers simultaneously for deployment, especially when including sidecar containers. However, Azure introduced Docker Compose as a preview feature to support this function.

Following extensive testing and quality assurance, we found it to be stable and well-suited for our production environment. This update resolved our initial deployment limitations and provided flexibility.

5. Improving functionality: Managing multi-port exposures for HTTP/gRPC

Azure Container App did not support exposing multiple ports for HTTP/gRPC from our containers, which posed a challenge for our application's functionality. However, a recent production release introduced this feature, effectively resolving the limitation. This update enhanced our app's capabilities by allowing us to manage multi-port exposures seamlessly.

Benefits of Aws to Azure migration for our AI product and strategy

1. Cost-effective consumption model

Azure Container App offers a consumption plan based on request volume that proved cost-effective for our application. It effectively aligns our operational costs with actual usage demands. This approach minimised overhead expenses while ensuring optimal resource utilisation, helping with project efficiency and budget management.

2. Stickiness and scale optimisation

Azure Container App also supports stickiness for WebSocket connections and features a scale to zero capability. It optimises resource usage by scaling down to zero instances during periods of inactivity.

3. Leveraging MLOps in Azure machine learning

Embracing MLOps in Azure Machine Learning has streamlined our model training and deployment processes. MLOps tools in Azure Machine Learning ensure smoother operations and more effective deployment of AI solutions, driving overall product success and innovation.

Best practices for migrating an AI product from AWS to Azure

Illustration showcasing best practices for AWS to Azure migration

1. Strategic cost optimisation and migration assessment

Maximise cost efficiency by aligning resource utilisation with the specific needs of your product at each development stage. For instance, to cut expenses, we utilised Azure Functions with zip deployment instead of a dockerized approach. This allowed us to take advantage of the 'pay as you go' pricing model instead of the more costly Premium tier.

Additionally, employ a strategic migration assessment tool to evaluate your readiness for migrating an AI product. This ensures smooth operation post-migration and helps you achieve your goals. Keep stakeholders informed and involved early in the process to secure their support and facilitate a seamless transition.

2. Optimise CI/CD setup with compatible tools

Implement CI/CD tools that integrate seamlessly with your existing repositories. Given our repositories were already on GitLab, we opted for GitLab CI to facilitate rapid deployment. To address the disk space issue, we implemented a GitLab Custom Runner on an Azure VM, which provided the necessary capacity for building our AI images.

3. Address transition challenges proactively

By Dockerizing all AI services and abandoning all AWS SDKs and Lambda's libraries, organisations undoubtedly expedite the migration process to Azure effectively.

4. Data migration strategy

Develop a data migration carefully to ensure compatibility. The command-line utility AzCopy can be used to copy unstructured files such as PDFs and images to and from a storage account. It is an invaluable tool for seamless data movement from an EC2 Jumpbox to Azure Storage Account Containers.

5. Containerisation with Azure Kubernetes Service (AKS)

Containerising your AI applications with Docker and deploying them on Azure Kubernetes Service (AKS) can make your applications more scalable, portable, and manageable. It helps streamline deployment and ensures your AI solution runs smoothly across different environments.

Future outlook for our AI project and strategy

In conclusion, the migration of our AI product from AWS to Azure posed numerous challenges, yet with careful planning, we were able to overcome them and enhance our CI/CD process. This experience has offered us valuable insights that will shape our future AI strategies.

The transition to Azure has equipped us with powerful tools such as Azure Document Intelligence and Azure AI Version, improving the accuracy of OCR processing and field extraction from invoices and cheques. 

Organisations looking to migrate AI products to Azure should adopt a strategic approach, leveraging cloud-native tools like MLOps in Azure Machine Learning to enhance current products and pave the way for more agile and scalable AI solutions.

No items found.

AWS to Azure migration: FAQs

What are the challenges of migrating an AI product from AWS to Azure?

Migrating an AI product from AWS to Azure involves challenges such as service compatibility, data transfer complexities, adapting to Azure tools, integrating existing infrastructure, and cost management through continuous monitoring and adjustment.

Is it easy to switch from AWS to Azure?

Switching from AWS to Azure requires adapting to Azure-specific tools, services, and infrastructure, which may be challenging initially. However, with thorough planning and understanding of Azure's offerings, the transition can be managed effectively to align with organisational goals and requirements.