Description
Lambda’s PassThrough mode forwards trace context to downstream services. Use Active for Lambda to send traces automatically for sampled requests.
Potential impact
Without per-function traces, delays across a chain of functions may be difficult to locate.
Remediation
Set tracing_mode: Active and give each function’s execution role X-Ray write permissions. After deploying, invoke both functions and check for sampled traces from each.
Examples
The loop deploys HelloWorld and ByeBye from different ZIP files. Supply both packages and the execution role, and set lambda_runtime to a supported runtime compatible with the packages.
Before
yaml
- name: Create Lambda functions in a loop
community.aws.lambda:
name: "{{ item.name }}"
state: present
zip_file: "{{ item.zip_file }}"
runtime: "{{ lambda_runtime }}"
role: "arn:aws:iam::987654321012:role/lambda_basic_execution"
handler: "hello_python.my_handler"
tracing_mode: "PassThrough"
tags:
key1: "value1"
loop:
- name: HelloWorld
zip_file: hello-code.zip
- name: ByeBye
zip_file: bye-code.zip
After
yaml
- name: Create Lambda functions in a loop
community.aws.lambda:
name: "{{ item.name }}"
state: present
zip_file: "{{ item.zip_file }}"
runtime: "{{ lambda_runtime }}"
role: "arn:aws:iam::987654321012:role/lambda_basic_execution"
handler: "hello_python.my_handler"
tracing_mode: Active
tags:
key1: "value1"
loop:
- name: HelloWorld
zip_file: hello-code.zip
- name: ByeBye
zip_file: bye-code.zip