SAP-C02 practice question 15 of 35
A company is developing a new serverless API by using Amazon API Gateway and AWS Lambd a. The company integrated the Lambda functions with API Gateway to use several shared libraries and custom classes. A solutions architect needs to simplify the deployment of the solution and optimize for code reuse. Which solution will meet these requirements?
Full set: 689 questionsDomain Design for New Solutions
AWS Lambda layers are the supported mechanism for sharing libraries and custom code across many Lambda functions. For layers whose contents are delivered as a container image, the image must be pushed to Amazon ECR and referenced when the layer is created. Functions that stay in the traditional .zip format can attach that layer and automatically gain access to the shared components, giving one authoritative copy and greatly simplifying deployments.
Option B follows exactly this model: build the shared libraries and classes into a container image, push it to ECR, create a Lambda layer from that image, then attach the layer to every Lambda function that backs the API.
A. Lambda layers accept container images only from ECR or zipped archives from S3; an image stored in S3 is not a valid source.
C. A running ECS/Fargate container cannot be attached as a Lambda layer; Lambda layers are static artifacts in ECR or S3.
D. Packaging every function as its own container image duplicates the shared code in each image, defeating the goal of reuse and increasing deployment effort.
1. AWS Lambda Developer Guide
“Creating and sharing Lambda layers (container images)”
Section: Layers as container images – requirement to push to Amazon ECR. https://docs.aws.amazon.com/lambda/latest/dg/using-layers.html
2. AWS Lambda Developer Guide
“Lambda deployment packages”
Paragraph: “A function deployment package is a .zip file or a container image stored in ECR.” https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html
3. AWS Lambda Developer Guide PDF (2023-12-07)
p.121-124
“Working with Lambda layers”— describes single copy of shared code
attachment to many functions
and ECR requirement for image layers.
Keep practicing
Take the free SAP-C02 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other SAP-C02 practice questions
- Question 1A company runs an application in (he cloud that consists of a database and a website User…
- Question 2A company wants to migrate an Amazon Aurora MySQL DB cluster from an existing AWS account…
- Question 3A company is running a two-tier web-based application in an on-premises data center. The …
- Question 4A company is running a critical stateful web application on two Linux Amazon EC2 instance…
- Question 5A company plans to migrate a legacy on-premises application to AWS. The application is a …
- Question 6A company needs to migrate an on-premises SFTP site to AWS. The SFTP site currently runs …
