Lamda API call Not Returning Data to AEM Cloud Environment | Community
Skip to main content
May 20, 2025
Solved

Lamda API call Not Returning Data to AEM Cloud Environment

  • May 20, 2025
  • 6 replies
  • 948 views

Hi ,

 We are storing the userdetails in AWS DB, and We have our lambda api which returns userdetails when called , 
To call the API we are sending key and token in headers , the same api is returning data in our AMS environment , local environment as well as in POSTMAN , but the api is not returning any data in Cloud Environment and its running into exception, so is there anything we need to allow in lambda , please advise me on this issue what might be the potential cause for this behaviour.

Regards 
Shankar

Best answer by Shankar_K

Hi All,
Thanks for all replies 

When I revisited the issue with a different perspective and analyzed the Lambda services, I noticed that all requests were being blocked by the WAF. We also observed that our cloud IP was visible in the logs.

To resolve this, we whitelisted our IP, which allowed us to successfully retrieve the data.

However, we encountered another issue: the IP kept changing dynamically due to the nature of cloud infrastructure.

To address this, we configured a dedicated Egress IP and updated our Java code by modifying the HttpClientBuilder to use HttpClients.useSystemProperties(). This change helped stabilize the IP.

After whitelisting the dedicated Egress IP and applying the Java code update, the issue was resolved.

Hope this helps.

 

6 replies

narendiran_ravi
May 20, 2025

Hi @shankar_k ,

Could you please provide more details about the exception?
Additionally, have you checked the Dispatcher and CDN logs to see if the request is being blocked?

AmitVishwakarma
Community Advisor
Community Advisor
May 20, 2025

Hi @shankar_k ,

Madhur-Madan
Community Advisor
Community Advisor
May 21, 2025

Hi @shankar_k ,

fo. Since the API works in local, AMS, and Postman, but fails only from AEM Cloud, this points to an environment-specific issue. To help troubleshoot further, could you confirm:

  • Is the request from AEM Cloud actually reaching the Lambda (i.e., does it show up in CloudWatch logs)?
  • Are you seeing the key and token headers arrive in the Lambda event payload when triggered from AEM Cloud?
  • Is the Lambda function returning a response and failing during DB access, or is it failing before?
  • Is the AEM Cloud environment possibly using a proxy or different outbound IP range that could affect access or auth?
  • Are there any differences in the way headers are sent or encoded from AEM Cloud compared to AMS/local?
Shankar_KAuthor
May 21, 2025

Hi @madhur-madan @amitvishwakarma @narendiran_ravi 

x-amzn-RequestId
 
e7da5dca-2833-4f6a-9870-3db0af4a4384
x-amzn-ErrorType
 
ForbiddenException
x-amz-apigw-id
 
K6lWeEWzIAMEELA=
 
 
I can see these headers in response what could be the reason
 
 
EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
May 23, 2025

Hi @shankar_k 

 

AEMaaCS blocks traffic for non-standards ports, if your API is listening in a non-standard port, you need to configure the Advanced Network Config, please check this: https://aemsimplifiedbynikhil.wordpress.com/2024/06/27/advanced-networking-in-aemaacs-http-https-connections-on-non-standard-ports-for-flexible-port-egress/

 

 

Hope this helps

Esteban Bustamante
kautuk_sahni
Community Manager
Community Manager
June 26, 2025

@shankar_k Just checking in — were you able to resolve your issue?
We’d love to hear how things worked out. If the suggestions above helped, marking a response as correct can guide others with similar questions. And if you found another solution, feel free to share it — your insights could really benefit the community. Thanks again for being part of the conversation!

Kautuk Sahni
Shankar_KAuthorAccepted solution
June 26, 2025

Hi All,
Thanks for all replies 

When I revisited the issue with a different perspective and analyzed the Lambda services, I noticed that all requests were being blocked by the WAF. We also observed that our cloud IP was visible in the logs.

To resolve this, we whitelisted our IP, which allowed us to successfully retrieve the data.

However, we encountered another issue: the IP kept changing dynamically due to the nature of cloud infrastructure.

To address this, we configured a dedicated Egress IP and updated our Java code by modifying the HttpClientBuilder to use HttpClients.useSystemProperties(). This change helped stabilize the IP.

After whitelisting the dedicated Egress IP and applying the Java code update, the issue was resolved.

Hope this helps.