There are more AWS SDK examples available in the AWS Doc SDK Examples
Add a true client IP header to a CloudFront Functions viewer request event
The following code example shows how to add a true client IP header to a CloudFront Functions viewer request event.