考题解析 | 为 Amazon EC2 实例提供快速切换网络连接能力


  题目

A company plans to run a monitoring application on an Amazon EC2 instance in a VPC. Connections are made to the EC2 instance using the instance’s private IPv4 address. A solutions architect needs to design a solution that will allow traffic to be quickly directed to a standby EC2 instance if the application fails and becomes unreachable.
Which approach will meet these requirements?
A. Deploy an Application Load Balancer configured with a listener for the private IP address and register the primary EC2 instance with the load balancer. Upon failure, de-register the instance and register the standby EC2 instance.
B. Configure a custom DHCP option set. Configure DHCP to assign the same private IP address to the standby EC2 instance when the primary EC2 instance fails.
C. Attach a secondary elastic network interface to the EC2 instance configured with the private IP address. Move the network interface to the standby EC2 instance if the primary EC2 instance becomes unreachable.
D. Associate an Elastic IP address with the network interface of the primary EC2 instance. Disassociate the Elastic IP from the primary instance upon failure and associate it with a standby EC2 instance.

  参考答案

C

  需求概括

一家公司计划在VPC中的Amazon EC2实例上运行一个监控应用程序。使用该实例的私有IPv4地址建立到EC2实例的连接。解决方案架构师需要设计一种解决方案,以便在应用程序出现故障且无法访问时,能够快速将流量引导至备用EC2实例。
哪种方法可以满足这些要求?
公司需要在VPC中的EC2实例上运行监控应用,使用私有IPv4地址连接,当主实例应用故障不可达时,要快速将流量导向备用实例,需设计满足此要求的方案。

  技术总结

负载均衡服务:负载均衡器通常用于在多个实例间分配流量,但一般不直接基于私有IP地址进行配置和实例的动态注册与注销来实现故障时的快速流量切换。
DHCP服务:DHCP主要用于自动分配IP地址等网络配置,难以实现主实例故障时为备用实例分配相同私有IP地址以快速切换流量。
弹性网络接口服务:弹性网络接口可以附加到EC2实例,并且可以配置私有IP地址。当主实例不可达时,将配置了私有IP地址的弹性网络接口移动到备用实例上,可快速实现流量切换。
弹性IP服务:弹性IP是用于公有IP地址的,而题目中连接使用的是私有IPv4地址,所以使用弹性IP无法满足在私有IP连接场景下快速切换流量的需求。

  参考解析

技巧:排除明显错误选项,在没有明显错误的选项中选择最合理的选项。

A. 不正确。部署一个配置了私有IP地址监听器的应用程序负载均衡器,并将主EC2实例注册到负载均衡器。出现故障时,注销该实例并注册备用EC2实例。应用程序负载均衡器一般不基于私有IP地址做这种动态实例注册注销来实现故障快速流量切换,且这种方式操作相对复杂,不能快速实现流量导向备用实例。
B. 不正确。配置自定义DHCP选项集。配置DHCP以便在主EC2实例出现故障时为备用EC2实例分配相同的私有IP地址。DHCP自动分配IP地址,很难精准实现主实例故障时马上为备用实例分配相同私有IP地址,无法快速满足流量切换需求。
C. 正确。将配置了私有IP地址的辅助弹性网络接口附加到EC2实例。如果主EC2实例不可达,将网络接口移动到备用EC2实例。弹性网络接口可配置私有IP地址,主实例不可达时移动网络接口到备用实例,能快速实现流量切换,满足要求。
D. 不正确。将弹性IP地址与主EC2实例的网络接口关联。出现故障时,从主实例解除弹性IP关联,并将其与备用EC2实例关联。题目连接使用私有IPv4地址,弹性IP是公有IP相关,此方式无法在私有IP连接场景下快速切换流量。