Q81. SQS와 Auto Scaling을 활용한 확장 가능한 애플리케이션 아키텍처 설계

AWS 자격증을 준비하는 여러분, 안녕하세요. 오늘은 AWS Certified Solutions Architect - Associate 자격증 시험에 자주 출제되는 주제인 확장 가능한 애플리케이션 아키텍처 설계에 대해 알아보겠습니다. 특히 Amazon SQS와 Auto Scaling을 활용하여 효율적이고 유연한 시스템을 구축하는 방법을 살펴보겠습니다.

문제 상황

Q1:
솔루션 설계자는 AWS에 배포되는 새 애플리케이션을 위한 클라우드 아키텍처를 설계하고 있습니다. 처리할 작업 수에 따라 필요에 따라 애플리케이션 노드를 추가 및 제거하면서 프로세스가 병렬로 실행되어야 합니다. 프로세서 응용 프로그램은 상태 비저장입니다. 솔루션 설계자는 응용 프로그램이 느슨하게 연결되어 있고 작업 항목이 영구적으로 저장되어 있는지 확인해야 합니다.

솔루션 설계자는 어떤 디자인을 사용해야 합니까?

<small>A solutions architect is designing a cloud architecture for a new application that will be deployed on AWS. The processes should run in parallel, adding and removing application nodes as needed based on the number of jobs to be processed. The processor application is stateless. The solutions architect must ensure that the application is loosely coupled and that work items are persisted.

Which design should the solutions architect use?</small>

선택지

A. Amazon SNS 주제를 생성하여 처리할 작업을 보내고, Auto Scaling 그룹을 CPU 사용량에 따라 조정합니다.
<small>A. Create an Amazon SNS topic to send jobs that need to be processed. Create an Amazon Machine Image (AMI) that consists of the processor application. Create a launch configuration that uses the AMI. Create an Auto Scaling group that uses the launch configuration. Set up scaling policies for the Auto Scaling group to add and remove nodes based on CPU utilization.</small>

B. Amazon SQS 대기열을 생성하여 처리할 작업을 보관하고, Auto Scaling 그룹을 네트워크 사용량에 따라 조정합니다.
<small>B. Create an Amazon SQS queue to hold jobs that need to be processed. Create an Amazon Machine Image (AMI) that consists of the processor application. Create a launch configuration that uses the AMI. Create an Auto Scaling group that uses the launch configuration. Set up scaling policies for the Auto Scaling group to add and remove nodes based on network utilization.</small>

C. Amazon SQS 대기열을 생성하여 처리할 작업을 보관하고, Auto Scaling 그룹을 SQS 대기열의 항목 수에 따라 조정합니다.
<small>C. Create an Amazon SQS queue to hold jobs that need to be processed. Create an Amazon Machine Image (AMI) that consists of the processor application. Create a launch template that uses the AMI. Create an Auto Scaling group that uses the launch template. Set up scaling policies for the Auto Scaling group to add and remove nodes based on the number of items in the SQS queue.</small>

D. Amazon SNS 주제를 생성하여 처리할 작업을 보내고, Auto Scaling 그룹을 SNS 주제에 게시된 메시지 수에 따라 조정합니다.
<small>D. Create an Amazon SNS topic to send jobs that need to be processed. Create an Amazon Machine Image (AMI) that consists of the processor application. Create a launch template that uses the AMI. Create an Auto Scaling group that uses the launch template. Set up scaling policies for the Auto Scaling group to add and remove nodes based on the number of messages published to the SNS topic.</small>

정답 및 해설

정답은 C입니다.

Amazon SQS(Simple Queue Service)는 이 사용 사례에 이상적인 선택입니다. SQS는 분산 시스템과 서버리스 애플리케이션을 위한 완전관리형 메시지 대기열 서비스로, 다음과 같은 이점을 제공합니다:

  1. 느슨한 결합: SQS를 사용하면 애플리케이션 구성 요소 간의 느슨한 결합을 구현할 수 있습니다. 작업 생성자와 처리자가 독립적으로 운영될 수 있습니다.

  2. 내구성: SQS는 메시지를 여러 가용 영역에 중복 저장하여 높은 내구성을 보장합니다.

  3. 확장성: SQS 대기열은 거의 무제한으로 확장할 수 있어, 처리해야 할 작업의 수가 급증하더라도 문제없이 처리할 수 있습니다.

  4. Auto Scaling과의 통합: SQS 대기열의 메시지 수를 기반으로 EC2 Auto Scaling 그룹을 조정할 수 있습니다. 이를 통해 작업량에 따라 처리 능력을 동적으로 조정할 수 있습니다.

구현 단계:

  1. SQS 대기열 생성: 처리해야 할 작업을 저장할 SQS 대기열을 생성합니다.
  2. AMI 생성: 프로세서 애플리케이션이 포함된 Amazon Machine Image(AMI)를 생성합니다.
  3. 시작 템플릿 생성: AMI를 사용하는 시작 템플릿을 생성합니다.
  4. Auto Scaling 그룹 생성: 시작 템플릿을 사용하는 Auto Scaling 그룹을 생성합니다.
  5. 조정 정책 설정: SQS 대기열의 메시지 수에 기반한 조정 정책을 설정합니다.

이 설계는 요구사항을 모두 충족합니다:

  • 병렬 처리: 여러 EC2 인스턴스가 동시에 작업을 처리할 수 있습니다.
  • 동적 확장: 작업량에 따라 인스턴스를 추가하거나 제거할 수 있습니다.
  • 상태 비저장: 프로세서 애플리케이션은 상태 비저장으로 유지됩니다.
  • 느슨한 결합: SQS를 통해 작업 생성자와 처리자 간의 느슨한 결합을 구현합니다.
  • 작업 항목 영구 저장: SQS는 메시지를 안전하게 저장합니다.

<small>The correct answer is C.

Amazon SQS (Simple Queue Service) is the ideal choice for this use case. SQS is a fully managed message queuing service for distributed systems and serverless applications, offering the following benefits:

  1. Loose coupling: SQS allows for loose coupling between application components. Job producers and processors can operate independently.

  2. Durability: SQS ensures high durability by storing messages redundantly across multiple Availability Zones.

  3. Scalability: SQS queues can scale almost infinitely, handling any surge in the number of jobs to be processed.

  4. Integration with Auto Scaling: EC2 Auto Scaling groups can be scaled based on the number of messages in an SQS queue. This allows for dynamic adjustment of processing capacity based on workload.

Implementation steps:

  1. Create SQS queue: Create an SQS queue to store jobs that need to be processed.
  2. Create AMI: Create an Amazon Machine Image (AMI) containing the processor application.
  3. Create launch template: Create a launch template using the AMI.
  4. Create Auto Scaling group: Create an Auto Scaling group using the launch template.
  5. Set scaling policies: Set up scaling policies based on the number of messages in the SQS queue.

This design meets all requirements:

  • Parallel processing: Multiple EC2 instances can process jobs simultaneously.
  • Dynamic scaling: Instances can be added or removed based on workload.
  • Stateless: The processor application remains stateless.
  • Loose coupling: SQS implements loose coupling between job producers and processors.
  • Job item persistence: SQS safely stores messages.</small>

오답 설명

A. Amazon SNS는 메시지를 영구적으로 저장하지 않으며, 작업 대기열로 적합하지 않습니다. CPU 사용량은 작업량을 정확히 반영하지 못할 수 있습니다.
<small>A. Amazon SNS does not persist messages and is not suitable as a job queue. CPU utilization may not accurately reflect the workload.</small>

B. 네트워크 사용량은 작업량을 정확히 반영하지 못할 수 있으며, SQS 대기열의 메시지 수가 더 적절한 지표입니다.
<small>B. Network utilization may not accurately reflect the workload, and the number of messages in the SQS queue is a more appropriate metric.</small>

D. SNS는 메시지를 영구적으로 저장하지 않으며, 게시된 메시지 수를 기반으로 한 조정은 신뢰할 수 없습니다.
<small>D. SNS does not persist messages, and scaling based on the number of published messages is unreliable.</small>

결론

이 문제는 AWS의 다양한 서비스를 활용하여 확장 가능하고 유연한 아키텍처를 설계하는 능력을 평가합니다. SQS와 Auto Scaling의 조합은 작업량에 따라 동적으로 조정되는 효율적인 시스템을 구축하는 데 매우 효과적입니다. 이러한 설계 패턴은 클라우드 네이티브 애플리케이션 개발에서 중요한 역할을 하며, AWS 솔루션 아키텍트로서 반드시 숙지해야 할 내용입니다.

<small>This question assesses the ability to design scalable and flexible architectures using various AWS services. The combination of SQS and Auto Scaling is highly effective in building efficient systems that dynamically adjust based on workload. These design patterns play a crucial role in cloud-native application development and are essential knowledge for AWS Solution Architects.</small>

원본 문제 링크

댓글

이 블로그의 인기 게시물

Anaconda-Python 환경 VSCode에서 사용하기

Python 웹 크롤링 - Scrapy 활용 파워볼 번호 수집(파일)