Solving AWS ECS Connect Timeouts: Configure Default Settings Easily

Facing unexpected timeouts in AWS ECS Service Connect? Learn how to resolve them by configuring the new timeout settings introduced in January 2024 to prevent disruptions in long-running processes.

Sushil sagar

2 months ago

solving-aws-ecs-connect-timeouts-configure-default-settings-easily

Introduction

If you've been battling unexpected request timeouts in your AWS ECS Service Connect setup, you're not alone. I recently ran into an issue where long-running processes mysteriously failed—only to discover that the root cause was the default 15-second request timeout for HTTP and gRPC requests. 😱

Here’s the good news: As of January 2024, AWS now allows you to configure these timeout values. Let's explore how.

Understanding the Default Timeout Behavior

Before this update, AWS ECS Service Connect enforced a fixed 15-second timeout on each request. If your process took longer—boom—it was terminated. This default wasn’t exposed in your service’s configuration, making it tricky to diagnose.

This was particularly painful for:

  • Long-polling APIs

  • Background job processors

  • Real-time data pipelines

🆕 The January 2024 Update: Configurable Timeouts

In response to user feedback, AWS introduced configurable timeout settings for ECS Service Connect. 🎉

You can now define:

  • **idleTimeoutSeconds**: How long to keep idle connections open

  • **perRequestTimeoutSeconds**: Maximum duration for a single request

How to Update Timeout Settings

Prerequisites
  • Updated AWS CLI (post-January 2024 version)

  • Task definitions with portName values

Timeout Parameters Explained

ParameterDefaultPurposeidleTimeoutSeconds300 (TCP), 3600 (HTTP)Max idle time before closing a connectionperRequestTimeoutSeconds15Max time allowed for a single request

Modify Your ECS Service Definition

Here's a sample update to your service definition JSON:

{

"serviceConnectConfiguration": {

"services": [

{

"clientAliases": [

{

"port": 3000

}

],

"portName": "your-port-name",

"timeout": {

"idleTimeoutSeconds": 3600,

"perRequestTimeoutSeconds": 3600

}

}

]

}

}

You can apply this via:

  • AWS CLI

  • CloudFormation

  • Tools like ecspresso

✅ Verifying the Configuration

After applying changes, verify them with:

aws ecs describe-services \

--cluster your-cluster-name \

--services your-service-name

📝 Note:
Default values like the 15-second request timeout won’t appear unless explicitly defined—so always set them manually if needed.

⚠️ Important Considerations

  • No Documented Upper Limit
    AWS hasn’t shared a max value for timeouts—set them wisely based on use case.

  • Reevaluate Architecture for Long Tasks
    Long timeouts may not always be ideal. Consider:

    • Async job processing

    • Decoupled service patterns

    • Background queues (e.g., SQS, SNS, Step Functions)

Conclusion

The 15-second default timeout in ECS Service Connect can quietly break your long-running workflows. But with AWS’s new configurable timeout options, you can take control—tailoring connection behavior to your app’s needs.

Just remember:

  • Explicitly define perRequestTimeoutSeconds and idleTimeoutSeconds

  • Keep your CLI and SDK updated

  • Validate your settings after deployment

With these tweaks, your services will run smoother, longer, and without those unexpected timeouts.