Q22 — AWS SAA-C03 Ch.6
Question 22 of 65 | ← Chapter 6
Q387. A company recently migrated its web application to the AWS Cloud. The company uses an Amazon EC2 instance to run multiple processes to host the application. The processes include an Apache web server that serves static content. The Apache web server makes requests to a PHP application that uses a local Redis server for user sessions.The company wants to redesign the architecture to be highly available and to use AWS managed solutions.Which solution will meet these requirements?
- A. Use AWS Elastic Beanstalk to host the static content and the PHP application. Configure Elastic Beanstalk to deploy its EC2 instance into a public subnet. Assign a public IP address
- B. Use AWS Lambda to host the static content and the PHP application. Use an Amazon API Gateway REST API to proxy requests to the Lambda function. Set the API Gateway CORS configuration to respond to the domain name. Configure Amazon ElastiCache for Redis to handle session information
- C. Keep the backend code on the EC2 instance. Create an Amazon ElastiCache for Redis cluster that has Multi-AZ enabled. Configure the ElastiCache for Redis cluster in cluster mode. Copy the frontend resources to Amazon S3. Configure the backend code to reference the EC2 instance
- D. Configure an Amazon CloudFront distribution with an Amazon S3 endpoint to an S3 bucket that is configured to host the static content. Configure an Application Load Balancer that targets an Amazon Elastic Container Service (Amazon ECS) service that runs AWS Fargate tasks for the PHP application.Configure the PHP application to use an Amazon ElastiCache for Redis cluster that runs in multiple Availability Zones ✓
Correct Answer: D. Configure an Amazon CloudFront distribution with an Amazon S3 endpoint to an S3 bucket that is configured to host the static content. Configure an Application Load Balancer that targets an Amazon Elastic Container Service (Amazon ECS) service that runs AWS Fargate tasks for the PHP application.Configure the PHP application to use an Amazon ElastiCache for Redis cluster that runs in multiple Availability Zones
Explanation
By configuring an Amazon CloudFront distribution with an S3 endpoint, you can serve the static content efficiently with low latency and high availability.Using an Application Load Balancer (ALB) allows you to distribute traffic across multiple instances of the PHP application running on Amazon ECS using AWS Fargate. This provides scalability and fault tolerance. Configuring the PHP application to use an Amazon ElastiCache for Redis cluster that runs in multiple Availability Zones ensures that the session information is highly available and can withstand failures. Option A not the best choice because it uses Elastic Beanstalk, which is a Platform as a Service (PaaS) offering and may not provide the flexibility and control required for hosting the PHP application and managing the Redis server.Option B is not the best choice because using AWS Lambda for hosting the PHP application may not be suitable for long-running processes like web servers. Additionally, using API Gateway to proxy requests to Lambda adds unnecessary complexity.Option C does not leverage AWS managed services effectively. Keeping the backend code on the EC2 instance requires manual management and does not provide the same level of scalability and fault tolerance as using managed services like Amazon ECS and ElastiCache.