Q22 — AWS SAP-C02 Ch.1

Question 22 of 75 | ← Chapter 1

Q97. A video processing company has an application that downloads images from an Amazon S3 bucket, processes the images, stores a transformed image in a second S3 bucket, and updates metadata about the image in an Amazon DynamoDB table. The application is written in Nodejs and runs by using an AWS Lambda function. The Lambda function is invoked when a new image is uploaded to Amazon S3. The application ran without incident for a while. However, the size of the images has grown significantly. The Lambda function is now failing frequently with timeout errors. The function timeout is set to its maximum value.A solutions architect needs to refactor the application's architecture to prevent invocation failures. The company does not want to manage the underlying infrastructure. Which combination of steps should the solutions architect take to meet these requirements? (Select TWO.)

Correct Answer: A. Modify the application deployment by building a Docker image that contains the application code.Publish the image to Amazon Elastic Container Registry (Amazon ECR), B. Create a new Amazon Elastic Container Service (Amazon ECS) task definition with a compatibility type of AWS Fargate. Configure the task definition to use the new image in Amazon Elastic Container Registry (Amazon ECR).Adjust the Lambda function to invoke an ECS task by using the ECS task definition when a new file arrives in Amazon S3

Explanation

To prevent invocation failures and address the timeout errors in the Lambda function due to the increased size of the images, the following steps can be taken: A. Modify the application deployment by building a Docker image that contains the application code. Publish the image to Amazon Elastic Container Registry (Amazon ECR). By containerizing the application using Docker and creating a Docker image, the application can be packaged with its dependencies and runtime environment. Publishing the image to Amazon ECR allows for easy storage and distribution of the container image. B. Create a new Amazon Elastic Container Service (Amazon ECS) task definition with a compatibility type of AWS Fargate. Configure the task definition to use the new image in Amazon ECR. Adjust the Lambda function to invoke an ECS task by using the ECS task definition when a new file arrives in Amazon S3. By utilizing AWS Fargate, a serverless compute engine for containers, the company can run containers without managing the underlying infrastructure. Creating an ECS task definition with the new Docker image and configuring it to use AWS Fargate ensures that the image processing workload is efficiently executed. By adjusting the Lambda function to invoke an ECS task using the ECS task definition when a new file arrives in Amazon S3, the processing of images can be offloaded to the ECS task, allowing the Lambda function to return quickly and avoid timeout errors. Therefore, to meet the requirements, the solutions architect should take the following combination of steps: A. Modify the application deployment by building a Docker image that contains the application code. Publish the image to Amazon ECR.B. Create a new Amazon ECS task definition with a compatibility type of AWS Fargate. Configure the task definition to use the new image in Amazon ECR. Adjust the Lambda function to invoke an ECS task by using the ECS task definition when a new file arrives in Amazon S3. By containerizing the application and offloading the image processing workload to ECS, the company can prevent invocation failures and improve the performance of the application without having to manage the underlying infrastructure.