Learn the best solution for ensuring users see all their documents in a multi-AZ AWS web application using EC2 and EBS. Discover why Amazon EFS is the ideal choice for scalability and availability in this AWS Certified Cloud Practitioner CLF-C02 exam question.
Table of Contents
Question
(BONUS QUESTION SAA-03) A company is hosting a web application on AWS using a single Amazon EC2 instance that stores user-uploaded documents on an Amazon EBS volume. For better scalability and availability, the company duplicated the architecture and created a second EC2 instance and EBS volume in another Availability Zone, placing both behind an Application Load Balancer. After completing this change, users reported that each time they refreshed the website, they could see a subset of their documents or the other, but never all documents at the same time. What should the solutions architect propose to ensure users see all their documents at once?
A. Copy the data so both EBS volumes contain all documents
B. Configure the Application Load Balancer to route a user to the server with the documents
C. Copy the data from both EBS volumes to Amazon EFS. Modify the application to save new documents to Amazon EFS
D. Configure the Application Load Balancer to send the request to both servers. Return each document from the correct server
Answer
C. Copy the data from both EBS volumes to Amazon EFS. Modify the application to save new documents to Amazon EFS
Explanation
The ideal solution involves using Amazon EFS, which is a storage system that can be accessed simultaneously by multiple EC2 instances from different Availability Zones, ensuring that all users see all their documents regardless of the instance they are routed to by the Application Load Balancer.
The issue described arises because the architecture uses separate Amazon Elastic Block Store (EBS) volumes attached to individual EC2 instances in different Availability Zones (AZs). EBS volumes are block storage and are limited to being attached to a single EC2 instance within the same AZ. This setup causes data inconsistency because each EC2 instance stores and accesses its own isolated data, preventing users from seeing all their documents when routed to different instances.
To resolve this, we need a shared storage solution that allows both EC2 instances to access the same data across multiple AZs. The best option here is Amazon Elastic File System (EFS).
Why Amazon EFS is the Best Solution
Shared Access Across Multiple Instances
Amazon EFS is a file storage service that supports simultaneous access by multiple EC2 instances across different AZs within the same region.
This ensures that all user-uploaded documents are stored in one centralized location, making them accessible regardless of which EC2 instance processes the request.
High Availability and Scalability
EFS automatically scales as files are added or removed, eliminating the need for manual provisioning.
It is designed for high availability, with data redundantly stored across multiple AZs.
Simplified Application Logic
By modifying the application to save and retrieve documents directly from EFS, you eliminate the complexity of synchronizing data between separate EBS volumes.
This ensures consistent user experience without requiring additional load balancer configurations or custom routing logic.
Durability and Performance
EFS provides 99.999999999% (11 nines) durability and can handle high-throughput workloads, making it suitable for web applications with dynamic user uploads.
Why Other Options Are Incorrect
A. Copy the data so both EBS volumes contain all documents: This would require constant synchronization between the two EBS volumes, which introduces operational complexity and latency issues. Additionally, EBS cannot natively replicate data across AZs.
B. Configure the Application Load Balancer to route a user to the server with the documents: While sticky sessions could ensure users are routed to the same instance, this does not solve the underlying problem of inconsistent data between isolated EBS volumes. It also reduces fault tolerance and scalability.
D. Configure the Application Load Balancer to send requests to both servers and return each document from the correct server: This approach is overly complex and inefficient. It requires custom logic to aggregate responses from both servers, increasing latency and development overhead without addressing root issues.
The optimal solution is to migrate data from both EBS volumes to Amazon EFS and modify the application to use EFS for storing new documents (Option C). This approach leverages AWS best practices for building scalable, highly available architectures while simplifying application management.
Amazon AWS Certified Cloud Practitioner CLF-C02 certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Amazon AWS Certified Cloud Practitioner CLF-C02 exam and earn Amazon AWS Certified Cloud Practitioner CLF-C02 certification.