SAP-C02 · Question #190
A company is processing videos in the AWS Cloud by using Amazon EC2 instances in an Auto Scaling group. It takes 30 minutes to process a video. Several EC2 instances scale in and out depending on…
The correct answer is C. Configure scale-in protection for the instances during processing. Video processing tasks are failing due to EC2 instances terminating prematurely while processing 30-minute videos, despite a 1-hour SQS visibility timeout and a maxReceiveCount of 1.
Question
A company is processing videos in the AWS Cloud by using Amazon EC2 instances in an Auto Scaling group. It takes 30 minutes to process a video. Several EC2 instances scale in and out depending on the number of videos in an Amazon Simple Queue Service (Amazon SQS) queue. The company has configured the SQS queue with a redrive policy that specifies a target dead- letter queue and a maxReceiveCount of 1. The company has set the visibility timeout for the SQS queue to 1 hour. The company has set up an Amazon CloudWatch alarm to notify the development team when there are messages in the dead-letter queue. Several times during the day, the development team receives notification that messages are in the dead-letter queue and that videos have not been processed properly. An investigation finds no errors in the application logs. How can the company solve this problem?
Options
- ATurn on termination protection for the EC2 instances.
- BUpdate the visibility timeout for the SOS queue to 3 hours.
- CConfigure scale-in protection for the instances during processing.
- DUpdate the redrive policy and set maxReceiveCount to 0.
How the community answered
(13 responses)- A15% (2)
- B8% (1)
- C69% (9)
- D8% (1)
Why each option
Video processing tasks are failing due to EC2 instances terminating prematurely while processing 30-minute videos, despite a 1-hour SQS visibility timeout and a maxReceiveCount of 1.
Turning on termination protection for all EC2 instances would prevent the Auto Scaling group from scaling in at all, defeating the purpose of dynamic scaling based on queue size and increasing costs.
The current visibility timeout of 1 hour is already sufficient for a 30-minute task; increasing it further will not resolve issues caused by instances terminating prematurely.
Configuring scale-in protection for instances during processing ensures that the Auto Scaling group will not terminate EC2 instances that are actively working on a video, allowing the 30-minute processing task to complete before the instance is removed.
Setting the `maxReceiveCount` to 0 in the redrive policy would cause messages to be immediately moved to the dead-letter queue on the first receive attempt if not deleted, effectively preventing any processing from occurring.
Concept tested: Preventing premature instance termination in Auto Scaling groups for long-running tasks
Source: https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-instance-protection.html
Community Discussion
No community discussion yet for this question.