Skip to content

"Connection reset by peer" in AWS IoT Core rule message action to S3

0

Hello every one,

Currently I have a issue when using IoT Core message rule to route MQTT message to S3 that says "Failed to put S3 object. The error received was Unable to execute HTTP request: Connection reset by peer. Message arrived on: <topic-name>, Action: s3, Bucket: <bucket name>, Key: <object key>. Value of x-amz-id-2: n/a".

It does not occur frequently, but causes the rule message fail. I saws in some questions that the rule engine already has built-in retry policy. But I checked that when "Connection reset by peer" occurs, there is no retry from the rule engine. (Sometimes, I get the error message "Failed to put S3 object. The error received was Client execution did not complete before the specified timeout configuration.. " but it still successfully to deliver to S3)

Actually I can configure the error action to send the message to Lambda to handle the error, but I still want to know if it is the temporary connection issue or not. My message is about less than 2KB, and the IoT Core and S3 are in the same region, there is very low chance it is affected by network latency. Refer to:

Please kindly help me.

Best regards,

1 Answer
1

The "Connection reset by peer" error you're experiencing with your AWS IoT Core rule action to S3 is likely a temporary network issue. While the AWS IoT rules engine does have a built-in retry policy, it doesn't apply to all types of errors.

For S3 actions specifically, if a static key is used, AWS IoT overwrites a single file each time the rule is invoked. It's recommended to use a message timestamp or another unique identifier to save a new file for each message received, which could help mitigate some issues.

Regarding retries, the rules engine typically attempts to send a message at least once and retries at most twice, with a maximum of three tries. However, retries are not attempted in certain situations, including when the downstream service closes the TCP connection after the try. This could explain why you're not seeing retries for the "Connection reset by peer" error.

To address this issue, you could:

  1. Implement an error action, as you mentioned, to send the message to a Lambda function for handling.
  2. Use a unique key for each S3 object to avoid overwriting.
  3. Consider implementing application-level retry logic if the built-in retries are insufficient.
  4. Monitor and analyze the frequency and patterns of these errors to determine if they're related to specific timeframes or conditions.

If the issue persists or occurs frequently, it may be worth contacting AWS support for further investigation, as there could be underlying network or configuration issues specific to your setup.
Sources
S3 - AWS IoT Core
HTTP - AWS IoT Core
Network issue to S3: Timeouts in S3? | AWS re:Post

answered a year ago

EXPERT

reviewed a year ago

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.