AWS EC2 Instance Customization for End-User Devices: Best Practices

Customizing Content Based on End-User Devices with AWS EC2 Instances

Prev Question Next Question

Question

Your company is planning to deliver content via an application hosted on a set of EC2 Instances.

The end devices can be laptops, mobile devices, tablets etc.

The content needs to be customized based on the type of end-user device.

Which of the following can help fulfill this requirement, individually and separately, and ensure that cost is MINIMIZED and MAXIMUM ease of deployment? Select 2 answers.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - A and B.

Option C is incorrect since this is the wrong type of Load Balancer to use for this purpose.

Option D is incorrect since AppStream is the incorrect service to use for this requirement.

The Application Load balancers can be used to distribute the processing powers to different Instances based on the type of request.

The AWS Documentation mentions the following about Lambda@Edge which supports the requirement.

CloudFront can return different objects to viewers based on the device they're using by checking the User-Agent header, which includes information about the devices.

For example, CloudFront can return different images based on the screen size of their device.

For more information on Lambda@Edge, please refer to the below URL.

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-at-the-edge.html

The best options for this scenario would be Application Load Balancers (ALBs) and CloudFront with Lambda@Edge.

  1. Application Load Balancers (ALBs): ALBs can route traffic to different EC2 instances based on the type of end-user device, which can be identified through the HTTP headers. With ALBs, it is possible to create rules for forwarding traffic based on the user agent header. This means that traffic can be routed to different EC2 instances based on the type of device that is making the request.

ALBs can also handle SSL termination, allowing secure traffic to be decrypted at the load balancer level, thereby reducing the load on the backend EC2 instances. Additionally, ALBs can distribute traffic based on various metrics, including round-robin, least connections, and IP hash.

  1. CloudFront with Lambda@Edge: CloudFront with Lambda@Edge is another option that can be used to customize content based on the type of end-user device. CloudFront is a content delivery network (CDN) that can be used to cache content and deliver it to end-users from the edge locations that are closest to them.

Lambda@Edge is a serverless compute service that can be used to run code at the edge locations. This means that Lambda@Edge functions can be used to customize the content that is being delivered based on the type of device that is making the request.

Using CloudFront with Lambda@Edge can help minimize costs because the content is cached at the edge locations, reducing the number of requests that need to be handled by the backend EC2 instances. This can also help to reduce latency and improve the overall user experience.

Network Load Balancers (NLBs) and AppStream 2.0 are not the best options for this scenario because they do not have the capability to route traffic based on the type of end-user device.

In summary, for this scenario, ALBs and CloudFront with Lambda@Edge are the most suitable options to fulfill the requirements while minimizing costs and maximizing ease of deployment.