A company is developing a serverless API using API Gateway and Lambda. The Lambda functions share common libraries and custom classes. A solutions architect needs to simplify deployments and maximize code reuse. Which solution satisfies these requirements?
Choose an answer
Tap an option to check your answer.
Correct answer: Package the shared libraries, custom classes, and the Lambda function code together into a Docker image. Push that image to Amazon ECR and configure each Lambda function to use the container image as its deployment package..
Why this is the answer
The correct solution leverages AWS Lambda's support for container images. Packaging the shared libraries, custom classes, and the Lambda function code into a Docker image, pushing it to Amazon ECR, and then configuring each Lambda function to use this image as its deployment package simplifies deployments and maximizes code reuse. This approach ensures all dependencies are bundled with the function code, providing a consistent execution environment. Incorrect options: Storing Docker images in S3 and then using them for a Lambda layer is not a standard or supported method for Lambda layers. Lambda layers are typically zip archives. While pushing Docker images to ECR is correct, Lambda layers do not directly use Docker images as their source. Layers are for zip archives of dependencies. Deploying shared libraries on ECS Fargate and then trying to configure Lambda functions to use this as a layer is an incorrect architectural pattern. Lambda layers are for direct dependency inclusion, not external service calls.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed