Using AWS Services from different regions using Serverless Architecture

You’re sipping your morning coffee, scrolling through your favorite e-commerce site, and within seconds, the products load seamlessly. 

Whether you’re in Norway, New York, Tokyo, or Paris, the experience is just as smooth and fast. 

Ever wondered how these global companies manage to deliver such consistent performance? 

The secret lies in using AWS Services from different regions using Serverless Architecture!

Today, we’re going to explore how leveraging AWS’s global infrastructure can revolutionize your business. 

We’ll break down why this approach is worth every penny, highlight the benefits, tech insights, and discuss why tech businesses are jumping on this trend. 

By the end, you’ll have a clear understanding of how to harness the power of AWS and serverless architecture to stay ahead of the competition.

AWS comes with a bunch of cool services and most of the time not all the services are available in all the regions. 

At Craftsmen, while providing premium R&D services to our customers across the globe we encountered situations like this where our customers want to have services in certain regions where not all the services are available but they would like to use those services. 

In this article, we will discuss the solutions with appropriate Serverless architecture.

Let’s Assume The Following Use Case:

We would like to have our system in Central Canada ca-central-1 and we would like to use the cognitive service of AWS like Rekognition to read texts from the images which is not available in Central Canada.

To make the use case more simple let’s assume that we shall use DynamoDB as our No SQL database and S3 as file storage.

Other variants of the above use case could be like below.

The system needs to be deployed in North California (us-west-1) and the system needs to use AWS Transcribe.

There Are Two Steps To Solving This Problem:

The first step is deciding on a robust distributed architecture and the second step is using the most simple and cost-effective way to glue them together. So let’s jump into the first step!

Deciding the architecture

People want to use services close to their premises mostly to gain near to zero latency. The heart of Serverless architecture, the lambdas are available in all the regions being supported by AWS. In any system, there will be CRUD operations on data and DynamoDB is also available in all the regions.

We shall accumulate our Lambdas and DynamoDB tables in one Cloud Formation Stack through our serverless.yml.

Now the other parts that are not available in ca-central-1 ( Canada Central) we need to find the nearest regions where these services are available. Generally, these services do extensive processing of data that takes time and returns a result set. Here we are using AWS Rekognition which does process files from S3. Generally, these kinds of services can’t process on files that reside in S3 in other regions.

So we shall accumulate AWS Rekognition and S3s in another Cloud Formation Stack and let’s assume that we are deploying this to us-east-2 (Ohio).

Using AWS Services from different regions using Serverless Architecture

Since we have now spitted architecture as can be seen by the above diagram.

Still, we need to solve a big challenge, which is to ensure seamless communication between the resources across the regions ( stacks). There are several ways of doing it but I shall only cover the most simple one.

In general, almost all the AWS services which do heavy computations notify the system either through Cloudwatch or through SNS. The limitation of these events is that they can’t go across the regions.

AWS SQS comes here as a rescuer as it can be integrated with SNS or CloudWatch events of different regions.

So particularly for this use case, we shall use an SNS-SQS pipeline to bridge between the stacks. It’s better to have the SQS in the same regions where we have the endpoints ( Lambdas).

So the final architecture will look like below.

Using AWS Services from different regions using Serverless Architecture

Now there will be an obvious question like how to trigger the Rekognition operation from a lambda in the CA-CENTRAL-1 region.

All you need is to instantiate the AWS Rekognition API by supplying the appropriate region which is US-EAST-2 and S3 bucket name of US-EAST-2.

Why It’s Worth It

Cost Efficiency: AWS serverless architecture allows you to pay only for what you use. You don’t have to worry about provisioning or managing servers, which can significantly reduce your operational costs.

Scalability: Your applications can automatically scale up or down based on demand. This is particularly beneficial for businesses that experience variable traffic patterns, such as e-commerce platforms during holiday seasons.

Global Reach: By deploying your services in different AWS regions, you can ensure low latency for users worldwide. This improves the user experience and can lead to higher customer satisfaction and retention.

Benefits of Using AWS Services from Different Regions

  1. Enhanced Performance and Reliability: AWS has data centers in multiple regions across the globe. By leveraging these regions, you can ensure your application performs optimally for users regardless of their location. For instance, Netflix uses AWS to deliver high-quality streaming services to its global user base, ensuring minimal buffering and high availability.
  2. Disaster Recovery: Deploying your services across multiple regions helps in creating a robust disaster recovery plan. If one region goes down, your application can failover to another region, minimizing downtime and data loss.
  3. Compliance and Data Sovereignty: Different countries have varying regulations about data storage and processing. Using AWS services from different regions allows businesses to comply with these regulations by storing data within the required geographical boundaries.

Why Tech Businesses Need to Implement It

  1. Competitive Advantage: In today’s fast-paced tech world, businesses need to deliver services quickly and reliably. By using AWS’s global infrastructure, companies can stay ahead of the competition by providing a seamless user experience.
  2. Focus on Core Business: With serverless architecture, developers can focus more on writing code and developing features rather than managing infrastructure. This leads to faster development cycles and quicker time-to-market.
  3. Cost Management: Serverless computing eliminates the need for upfront capital expenses on hardware. Businesses can start small and scale as needed, making it an attractive option for startups and established companies alike.

Real-Life Examples

  1. Coca-Cola: During the 2014 FIFA World Cup, Coca-Cola used AWS to ensure their promotional campaigns ran smoothly across different regions. By using AWS Lambda and other serverless services, they managed to handle massive traffic spikes without any issues.
  2. Airbnb: Airbnb leverages AWS to provide a reliable and scalable platform for their users worldwide. By utilizing multiple AWS regions, they ensure that users can book accommodations and have a smooth experience regardless of their location.

Quick Steps to Getting Started with AWS Serverless Architecture

  1. Choose Your Services: Start by identifying the AWS services you need. AWS Lambda, API Gateway, DynamoDB, and S3 are popular choices for serverless applications.
  2. Plan Your Regions: Decide which AWS regions you want to deploy your services in. Consider factors like user base, latency requirements, and regulatory compliance.
  3. Set Up Monitoring and Management: Use AWS CloudWatch for monitoring your serverless applications and AWS CloudFormation for managing your infrastructure as code.
  4. Optimize and Scale: Continuously monitor your applications and optimize them for performance and cost. AWS provides various tools and services to help you achieve this.

Conclusion

Leveraging AWS services across different regions with serverless architecture is a game-changer. 

This approach offers a compelling combination of cost efficiency, scalability, and enhanced performance that can transform your business operations.

 

Embracing AWS services from different regions using serverless architecture is not just a technical decision; it’s a strategic business move.

Hire Exceptional Developers Quickly

Share this blog on

Hire Your Software Development Team

Let us help you pull out your hassle recruiting potential software engineers and get the ultimate result exceeding your needs.

Contact Us Directly

Address:

Plot # 272, Lane # 3 (Eastern Road) DOHS Baridhara, Dhaka 1206

Talk to Us
Scroll to Top