I want to get some X-Ray traces of my Lambda function. From reading the documentation it seems I can just enable active tracing in the configuration and it should record it automatically without any new code deploys correct?
Only if I want custom sub segments would I explicitly make some X-Ray calls in the lambda function?
Yes, you are correct, with the following caveats:
When you follow the step above, the console will advise that the IAM policy that the function executes under will be modified. If you're using a role created by the console when creating a function, you may need to modify the role manually. Either create a new policy and attach it to the role, create an inline policy attachment, or edit the existing policy for the role with a SID like this (this is an example - use globs in IAM policies with great care):
{
"Sid": "AllowXRay",
"Resource": "*",
"Action": [
"xray:PutTraceSegments",
"xray:PutTelemetryRecords"
],
"Effect": "Allow"
}
After following these steps, I was able to see full traces of my function in the XRay console.