Architectural Design for an E-Commerce Portal in Africa on AWS
Tags: alx, sandtech, alxcloudcomputing, aws
Published: 2023-11-05 12:32:18


The case I am trying to solve is as follows: An e-commerce business has contacted you to draw up an architectural design for their new portal for their customers in Africa. They want to ensure their application has a very low-latency and can also store their user relational information securely and also able to be retrieved fast. The portal is expected to store some pictures for products. The business also wants to ensure their application is fault tolerant and highly available. Although they are low on budget, they also want to ensure their application is highly secured both at rest and in transit, and from unauthorized access. You should also factor in monitoring and logging of your application.
![This is the cloud architecture I have designed to solve the problem with](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/isw9mez68oni1yruq3hv.jpg)

For an ecommerce business that has a customer in Africa, I would recommend using the AWS Africa (Cape Town) region to minimize latency. Latency is the delay in the transmission of data, and lower latency means faster response time for the application. This can greatly improve the user experience, especially because an ecommerce business will use some financial transaction. So the closer the AWS region is to the customers, the lower the network latency. To ensure fault tolerance and high availability, I suggest setting up a [**Virtual Private Cloud (VPC)**](https://cloudacademy.com/blog/how-and-why-to-use-vpc-for-your-amazon-aws-infrastructure/) within that region, utilizing multiple availability zones. In this case, I have used **two** availability zones in the region. A virtual private cloud allows you to have complete control over the network configuration. You can define your own IP address range, subnets, routing tables, and network gateways, which enables you to design the network infrastructure specifically tailored to your e-commerce solution's requirement. Hosting an e-commerce solution involves handling sensitive customer data such as payment information, personal details, and order history. By setting up VPC, the e-commerce infrastructure can be isolated from other networks and be protected from potential security breaches and attacks. 

Within availability zones, I would create private and public subnets. The private subnet would contain an [**Amazon Elastic Compute Cloud (EC2)**](https://dev.to/aws-builders/ec2-101-understanding-the-basics-of-amazons-elastic-compute-cloud-2njb)instance to host the portal application. To enhance security, I assigned a **security group** to this instance, acting as a virtual firewall. Only traffic allowed by the security group rules will reach the instance.

To enable instances in the private subnet to send outbound traffic to the internet while preventing incoming connections from the internet, I employed a **NAT** Gateway in the public subnet. This NAT Gateway connects with the route table and the **Application Load Balancer** to improve the scalability and availability of the portal.

To handle fluctuations in traffic demand, I utilized [Amazon **EC2 Auto Scaling**](https://granulate.io/blog/ec2-auto-scaling-examples-challenges/) at no additional cost. This allows the EC2 instance to scale up or down based on traffic demand. This can insure that the e-commerce application becomes available, even during high traffic periods or sudden spikes in demand. The auto scaling group will automatically add more EC2 instances to handle the increased load and remove them when the demand decreases. This helps prevent overloading of resources and ensures a seamless shopping experience for customers. The EC2 instance is connected to the load balancer.

To enable internet access, I integrated an Internet Gateway **(IG)** into the architecture. I chose [**Amazon Aurora MySQL**](https://aws.amazon.com/rds/aurora/features/) as the storage solution for the e-commerce portal's relational data due to its fully managed service. Additionally, I utilized Amazon Simple Storage Service **(S3)** to store product images and other static content. To ensure disaster recovery, I replicated the content stored in S3.

To improve portal performance, I employed Amazon [**CloudFront**](https://aws.amazon.com/blogs/networking-and-content-delivery/improve-your-website-performance-with-amazon-cloudfront/), a global Content Delivery Network (CDN), to cache and deliver images and static content close to the African users. This results in faster load times for products pages, images, and other assets leading to a better experience and increased customer satisfaction. Aiming for high security both at rest and in transit, I utilized AWS Key Management Service **(KMS)** for encryption. I also implemented AWS Web Application Firewall **(WAF)** to protect the application against common web exploits and security threats.

For monitoring and logging purposes, I relied on Amazon [**CloudWatch**](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-tutorials.html) to monitor system performance and set up alarms for specific metrics. Cloudwatch collects and analyzes logs, providing businesses with insights on system level events, issues and errors. This helps identify and troubleshoot any problems in the e-commerce infrastructure quickly, ensuring smooth operations and minimizing downtime. Additionally, I used AWS [**CloudTrail** ](https://aws.amazon.com/blogs/mt/aws-cloudtrail-best-practices/) to record API calls and track user activity for auditing and compliance reasons. This helps in detecting and investigating any unauthorized access attempts, potential security breaches, or suspicious activities related to the e-commerce infrastructure. It provides detailed information about the API calls, including the source IP address, identity of the caller, and time of the request, helping to enhance security measures. 

To optimize costs, I recommend utilizing [**Reserved instances**](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-reserved-instances.html) as they provide significant discounts over on-demand pricing. By committing to a one or three year term, the business can save up to 75% on the EC2 compute cost. 

AWS offers a wide range of services and features, each with its own pricing structure. So what I would recommend is using the [AWS price calculator](https://docs.aws.amazon.com/pricing-calculator/latest/userguide/what-is-pricing-calculator.html), as the business effectively plan and budget the cost it encounters. It can help estimate the expenses associated with the different services and features, allowing to allocate resources accordingly and avoid unexpected overages.