Q3 — AWS DEA-C01 Ch.1
Question 3 of 100 | ← Chapter 1
A data engineer maintains custom Python scripts that perform a data formatting process that many AWS Lambda functions use. When the Data engineer needs to modify the Python scripts, the data engineer must manually update all the Lambda functions. The data engineer requires a less manual way to update the Lambda functions. Which solution will meet this requirement?
- A. Store a pointer to the custom Python scripts in the execution context object in a shared Amazon S3 bucket.
- B. Package the custom Python scripts into Lambda layers. Apply the Lambda layers to the Lambda functions. ✓
- C. Store a pointer to the custom Python scripts in environment variables in a shared Amazon S3 bucket.
- D. Assign the same alias to each Lambda function. Call reach Lambda function by specifying the function's alias.
Correct Answer: B. Package the custom Python scripts into Lambda layers. Apply the Lambda layers to the Lambda functions.
Explanation
为满足数据工程师对AWSLambda函数更新自动化的需求,最佳解决方案是将自定义的Python脚本打包成Lambda层。Lambda层允许将代码或库打包并部署到多个Lambda函数中,从而简化代码的共享和管理。通过将自定义Python脚本打包为Lambda层并应用到Lambda函数中,数据工程师可以仅通过更新Lambda层来自动更新所有使用该层的Lambda函数,无需手动更新每个函数。选项B正确实现了这一点。其他选项如A、C涉及到使用S3桶中的指针或环境变量,但这并不直接支持代码的自动更新;D选项关于Lambda函数的别名,与代码更新无关。