Q63. S3와 Lambda를 활용한 확장 가능한 이미지 변환 솔루션

AWS 자격증을 준비하는 여러분, 안녕하세요. 오늘은 실제 기업 환경에서 자주 마주치는 대용량 파일 처리 시나리오를 통해 AWS의 핵심 서비스들의 활용법을 알아보겠습니다. 특히 S3와 Lambda를 조합한 서버리스 아키텍처의 강점을 이해하는 데 중점을 두겠습니다.

문제 상황

Q1:
한 회사가 AWS에서 인프라를 운영 중이며, 문서 관리 애플리케이션에 70만 명의 사용자 기반을 보유하고 있습니다. 이 회사는 대용량 .pdf 파일을 .jpg 이미지 파일로 변환하는 새로운 제품을 개발하려고 합니다. .pdf 파일의 평균 크기는 5MB입니다. 회사는 원본 파일과 변환된 파일을 모두 보관해야 하며, 시간이 지남에 따라 급증할 수 있는 수요에 대응할 수 있는 확장 가능한 솔루션이 필요합니다.

어떤 솔루션이 이러한 요구 사항을 가장 비용 효율적으로 충족할 수 있을까요?

<small>A company runs its infrastructure on AWS and has a registered base of 700,000 for its document management application. The company wants to create a product that converts large .pdf files to .jpg image files. The .pdf files average 5 MB in size. The company needs to keep both the original files and the converted files. A solutions architect must design a scalable solution that can accommodate rapidly increasing demand over time.
Which solution will meet these requirements MOST cost-effectively?</small>

선택지

A. .pdf 파일을 Amazon S3에 저장합니다. AWS Lambda 함수를 호출하여 파일을 .jpg 형식으로 변환하고 Amazon S3에 다시 저장하도록 S3 PUT 이벤트를 구성합니다.
<small>Store the .pdf files in Amazon S3. Configure S3 PUT events to invoke an AWS Lambda function to convert the files to .jpg format and store them back in Amazon S3.</small>

B. .pdf 파일을 Amazon DynamoDB에 저장합니다. DynamoDB 스트림 기능을 사용하여 AWS Lambda 함수를 호출하여 파일을 .jpg 형식으로 변환하고 DynamoDB에 다시 저장합니다.
<small>Store the .pdf files in Amazon DynamoDB. Use the DynamoDB Streams feature to invoke an AWS Lambda function to convert the files to .jpg format and store them back in DynamoDB.</small>

C. Amazon EC2 인스턴스, Amazon Elastic Block Store(Amazon EBS) 스토리지 및 Auto Scaling 그룹이 포함된 AWS Elastic Beanstalk 애플리케이션에 .pdf 파일을 업로드합니다. EC2 인스턴스의 프로그램을 사용하여 파일을 .jpg 형식으로 변환합니다. .pdf 파일과 .jpg 파일을 EBS 스토어에 저장합니다.
<small>Upload the .pdf files to an AWS Elastic Beanstalk application that includes Amazon EC2 instances, Amazon Elastic Block Store (Amazon EBS) storage, and an Auto Scaling group. Use a program on the EC2 instances to convert the files to .jpg format. Store the .pdf files and .jpg files on the EBS store.</small>

D. .pdf 파일을 Amazon EC2 인스턴스, Amazon Elastic File System(Amazon EFS) 스토리지 및 Auto Scaling 그룹이 포함된 AWS Elastic Beanstalk 애플리케이션에 업로드합니다. EC2 인스턴스의 프로그램을 사용하여 파일을 .jpg 형식으로 변환합니다. .pdf 파일과 .jpg 파일을 EFS 스토어에 저장합니다.
<small>Upload the .pdf files to an AWS Elastic Beanstalk application that includes Amazon EC2 instances, Amazon Elastic File System (Amazon EFS) storage, and an Auto Scaling group. Use a program on the EC2 instances to convert the files to .jpg format. Store the .pdf files and .jpg files on the EFS store.</small>

정답 및 해설

정답은 A입니다.

<small>The correct answer is A.</small>

Amazon S3와 AWS Lambda를 조합한 솔루션이 이 시나리오에 가장 적합하며 비용 효율적입니다. 이 방식의 주요 장점은 다음과 같습니다:

  1. 확장성: S3는 사실상 무제한의 스토리지를 제공하며, Lambda는 동시 실행 수를 자동으로 조절합니다.
  2. 서버리스: 인프라 관리가 필요 없어 운영 부담이 줄어듭니다.
  3. 이벤트 기반 처리: S3에 파일이 업로드되면 자동으로 Lambda 함수가 트리거되어 효율적입니다.
  4. 비용 효율성: 사용한 만큼만 비용을 지불하며, 유휴 리소스에 대한 비용이 발생하지 않습니다.

구현 단계:

  1. S3 버킷을 생성하여 .pdf 파일을 저장합니다.
  2. Lambda 함수를 작성하여 .pdf를 .jpg로 변환하는 로직을 구현합니다.
  3. S3 버킷에 PUT 이벤트 발생 시 Lambda 함수를 트리거하도록 설정합니다.
  4. 변환된 .jpg 파일을 동일한 S3 버킷 또는 별도의 버킷에 저장합니다.

이 방식은 수요 증가에 따라 자동으로 확장되며, 관리 오버헤드가 최소화됩니다.

<small>The combination of Amazon S3 and AWS Lambda provides the most scalable and cost-effective solution for this scenario. Here are the key advantages of this approach:

  1. Scalability: S3 offers virtually unlimited storage, and Lambda automatically scales the number of concurrent executions.
  2. Serverless: No infrastructure management is required, reducing operational overhead.
  3. Event-driven processing: Lambda functions are automatically triggered when files are uploaded to S3, ensuring efficient processing.
  4. Cost-effectiveness: You only pay for what you use, with no costs for idle resources.

Implementation steps:

  1. Create an S3 bucket to store the .pdf files.
  2. Write a Lambda function to implement the logic for converting .pdf to .jpg.
  3. Set up the S3 bucket to trigger the Lambda function on PUT events.
  4. Store the converted .jpg files in the same S3 bucket or a separate bucket.

This approach scales automatically with increasing demand and minimizes management overhead.</small>

오답 설명

B. Amazon DynamoDB: DynamoDB는 대용량 바이너리 파일 저장에 적합하지 않습니다. 문서 크기 제한(400KB)이 있어 5MB 파일을 저장할 수 없습니다.
<small>B. Amazon DynamoDB: DynamoDB is not suitable for storing large binary files. It has a document size limit (400KB) that cannot accommodate 5MB files.</small>

C. Elastic Beanstalk with EC2 and EBS: 이 방식은 확장성이 있지만, 서버 관리가 필요하고 비용이 더 높습니다. 또한 EBS는 단일 AZ에 제한되어 있어 고가용성 측면에서 제한적입니다.
<small>C. Elastic Beanstalk with EC2 and EBS: While scalable, this approach requires server management and is more costly. EBS is also limited to a single AZ, which can be a limitation for high availability.</small>

D. Elastic Beanstalk with EC2 and EFS: C와 유사하지만 EFS를 사용하여 더 나은 확장성을 제공합니다. 그러나 여전히 서버 관리가 필요하고 Lambda와 S3 조합보다 비용이 높습니다.
<small>D. Elastic Beanstalk with EC2 and EFS: Similar to C, but with better scalability using EFS. However, it still requires server management and is more expensive than the Lambda and S3 combination.</small>

결론

이 문제는 AWS의 서버리스 아키텍처와 이벤트 기반 처리의 장점을 잘 보여줍니다. S3와 Lambda의 조합은 확장성, 비용 효율성, 관리 용이성 측면에서 뛰어난 선택입니다. 대용량 파일 처리와 변환 작업에서 이러한 서비스를 활용하는 방법을 이해하는 것은 AWS 솔루션 아키텍트로서 중요한 스킬입니다.

<small>This question highlights the advantages of serverless architecture and event-driven processing in AWS. The combination of S3 and Lambda offers superior scalability, cost-effectiveness, and ease of management. Understanding how to leverage these services for large-scale file processing and transformation tasks is a crucial skill for AWS Solution Architects.</small>

원본 문제 링크

댓글

이 블로그의 인기 게시물

Windows Git 설치 및 GitHub 활용 방법

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