Q18 — AWS SAA-C03 Ch.17
Question 18 of 89 | ← Chapter 17
Q1318. A company runs an application that uses Docker containers in an on-premises data center. The application runs on a container host that stores persistent data files in a local volume. Container instances use the stored persistent data.The company wants to migrate the application to fully managed AWS services.Which solution will meet these requirements?
- A. Use Amazon Elastic Kubernetes Service(Amazon EKS) with self-managed nodes. Attach an Amazon Elastic Block Store(Amazon EBS) volume to an Amazon EC2 instance. Mount the EBS volume on the containers to provide persistent storage.
- B. Use Amazon Elastic Container Service(Amazon ECS) with the AWS Fargate launch type. Create an Amazon Elastic File System(Amazon EFS) volume. Mount the EFS volume on the containers to provide persistent storage. ✓
- C. Use Amazon Elastic Container Service(Amazon ECS) with the AWS Fargate launch type. Create an Amazon DynamoDB table. Configure the application to use the DynamoDB table for persistent storage.
- D. Use Amazon Elastic Container Service(Amazon ECS) with the Amazon EC2 launch type. Create an Amazon Elastic File System(Amazon EFS) volume. Mount the EFS volume on the containers to provide persistent storage.
Correct Answer: B. Use Amazon Elastic Container Service(Amazon ECS) with the AWS Fargate launch type. Create an Amazon Elastic File System(Amazon EFS) volume. Mount the EFS volume on the containers to provide persistent storage.
Explanation
The correct solution that meets the requirements of migrating a Docker-based application to AWS with persistent storage using fully managed services is:B. Use Amazon Elastic Container Service (Amazon ECS) with the AWS Fargate launch type. Create an Amazon Elastic File System (Amazon EFS) volume. Mount the EFS volume on the containers to provide persistent storage.Why Option B is Correct:Fully Managed ServicesAmazon ECS with Fargate is a serverless container orchestration service, meaning AWS manages the underlying infrastructure (no EC2 instances to manage).Amazon EFS is a fully managed, scalable NFS file system that works seamlessly with Fargate for persistent storage.Persistent Storage SupportEFS volumes can be mounted directly into Fargate tasks, allowing containers to access shared, persistent data (similar to an on-premises local volume but scalable and highly available). EFS automatically scales with storage needs and is replicated across Availability Zones (AZs) for high durability.No Server ManagementUnlike ECS with EC2 (Option D) or EKS with self-managed nodes (Option A), Fargate eliminates the need to manage servers, patches, or scaling policies.Why Other Options Are Incorrect:A. Use Amazon EKS with self-managed nodes + EBS volume on EC2 Not fully managed: EKS with self-managed nodes requires provisioning and maintaining EC2 instances. EBS limitations: EBS volumes are block storage tied to a single EC2 instance (not shareable across multiple containers/tasks like EFS).C. Use Amazon ECS with Fargate + DynamoDB for persistent storage Incorrect storage type: DynamoDB is a NoSQL database, not a file system. Applications relying on file- based persistence (e.g., storing logs, configuration files, or user uploads) cannot use DynamoDB directly.D. Use Amazon ECS with EC2 launch type + EFS volumeNot fully managed: The EC2 launch type requires managing EC2 instances (scaling, patching, etc.), which contradicts the requirement for fully managed services.Implementation Steps for Option B:Set Up Amazon ECS with FargateGo to Amazon ECS Create Cluster and select "Networking only" (Fargate does not require EC2 instances).Configure a VPC and subnets for the cluster.Create an Amazon EFS File SystemGo to Amazon EFS Create file system.Select the same VPC as the ECS cluster and configure mount targets in each AZ for high availability. Enable encryption (KMS) and lifecycle policies (e.g., transition to Infrequent Access to save costs).Define an ECS Task Definition with EFS VolumeIn the ECS console, create a task definition (JSON or UI-based). Under "Container Definitions", specify the Docker image and configure "Storage and Logging". Add an EFS volume by providing the file system ID and access point (optional for fine-grained permissions).Example (JSON snippet):json"volumes": [{"name": "efs-volume","efsVolumeConfiguration": {"fileSystemId": "fs-12345678","rootDirectory": "/","transitEncryption": "ENABLED","authorizationConfig": {"accessPointId": "fsap-12345678"}}}],"containerDefinitions": [{"name": "app-container","image": "your-docker-image","mountPoints": [{"sourceVolume": "efs-volume","containerPath": "/app/data","readOnly": false}]}]Run the ECS Task or ServiceDeploy the task as a one-off task or a service (for long-running applications). Configure scaling policies (if using a service) based on CPU/memory usage or custom CloudWatch metrics.Verify Persistent StorageAfter the task runs, SSH into a container (or check logs) to confirm files written to /app/data persist across task restarts.Test by stopping/starting the task--data should remain intact.Key Considerations:Performance:EFS has higher latency than EBS (due to NFS protocol), but it is shared and scalable. For high-performance workloads, consider EFS Provisioned Throughput (pay for dedicated IOPS).Security:Use EFS access points to restrict container access to specific directories. Enable VPC endpoints for EFS to keep traffic within AWS's network.Encrypt data at rest (KMS) and in transit (TLS).Cost Optimization:EFS pricing is based on storage used (GB/month) and request costs (metadata operations). Use lifecycle policies to move infrequently accessed files to EFS Infrequent Access (EFS IA) for lower costs.Conclusion:Option B is the best choice because it combines fully managed ECS Fargate (no server management) with EFS (scalable, shared persistent storage). Other options either introduce unnecessary complexity (A, D) or use the wrong storage type (C).