Lambda (C# NetCore) timing out when trying to retrieve ThingShadow

0

I have a Lambda function (Runtime: .NET Core 3.1 (C#/PowerShell)) which tries to retrieve a Shadow document using the GetThingShadow API call. This Lambda was working until yesterday and suddenly stopped working today with a timeout error. The Lambda is configured with a Role and a policy that grants the Lambda to access the ThingShadow. This whole setup was working until yesterday. Any clue on what might cause this issue suddenly?

1 Answer
1

Hi,

May I confirm if the issue is permanent or is it intermittent? Are you only seeing a timeout error or are there other errors as well? Can you provide a short snippet of the error in the Cloudwatch log here? Please make sure it does not contain any sensitive information.

A timeout error implies that Lambda is unable to reach the IoT Endpoint. Is it possible that the Lambda function has been modified recently and VPC configuration has been added? By default, a Lambda function loses internet connectivity when it is connected to a VPC and requires some additional configuration in order to have internet access. You can read more about this here in our knowledge center article https://aws.amazon.com/premiumsupport/knowledge-center/internet-access-lambda-function/

On the other hand, if your Lambda function is already VPC enabled, certain changes to the VPC configuration may lead to the Lambda function losing internet access. Therefore, even if there were no changes to the Lambda function itself, it could still end up losing internet access. For example, the route to the NAT gateway/instance may have been modified. This is one way I can think of that a Lambda might suddenly stop working where the Lambda's API calls are leading to timeouts

If you provide me with the region of your Lambda and Thing then I can double check if there may be some sort of ongoing issue. I'm not aware of any issue at the moment and I do not think this is the reason but I will double check once I know the region.

AWS
SUPPORT ENGINEER
Ryan_A
answered 2 years ago
  • Hi, The Lambda was redeployed as part of our regular maintenance yesterday. VPC was already enabled on this Lambda to communicate with our internal resources over a VPN tunnel (which is also having issues currently). The Lambda is running in us-east-2 region and the thing is 32465. We confirmed that by removing the VPC settings the API call is successful. There wasn't any change to the VPC or its related settings recently. Also the Cloud watch log it just says timed out. The issue is also permanent

  • Hi,

    Thanks for your response and for performing that test. I was just about to suggest removing the VPC settings to see if the API call will be successful. However, this actually confirms that there is an issue with the VPC settings.

    I know you have mentioned that there were no changes to the VPC settings but I would recommend double checking this and making sure that the VPC settings are correct. You can refer to the following resources:

    1. https://aws.amazon.com/premiumsupport/knowledge-center/internet-access-lambda-function/
    2. https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html#vpc-internet

    As a possible alternative solution, AWS IoT core supports VPC endpoints(https://aws.amazon.com/about-aws/whats-new/2021/07/aws-iot-core-supports-vpc-endpoints/) so you can use this instead of configuring your Lambda for internet access.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions