Skip to content

Add advertised host & port to AmazonEcsProvider#2426

Open
samritchie wants to merge 1 commit intoasynkron:devfrom
samritchie:amazon-ecs
Open

Add advertised host & port to AmazonEcsProvider#2426
samritchie wants to merge 1 commit intoasynkron:devfrom
samritchie:amazon-ecs

Conversation

@samritchie
Copy link
Copy Markdown

Description

The Amazon ECS provider effectively only supports awsvpc network mode - it picks up IP from the task interface, and port from the cluster configuration via the task tag.

ECS (non-Fargate) can also be configured in host & bridge network modes, in which case the advertised host should be (usually) the container instance’s private IP, and in the case of bridge mode, the container-host port mapping needs to be interrogated to find the advertised (auto-assigned) host port.

The current version of the code assumes the ECS tasks are configured in awsvpc mode and will throw an exception when it encounters no interfaces.

Changes made:

  • Added optional advertisedPort and advertisedHost params to the AmazonEcsProvider constructor
  • Changed client parameter/member to interface type (IAmazonECS)
  • Record advertised port instead of cluster port in the task tag (if configured)
  • Record advertised host in a new task tag (if configured)
  • Modified ECSUtils getMembers to respect advertised host if tagged, and log a warning if no interfaces or host is available
  • Added soul-destroying null checks for AWSSDK v4 compatibility
  • Added (restored?) GetHostPrivateIPv4Address and GetHostPublicIPv4Address to assist
  • Migrated AwsHttpClient to System.Text.Json & System.Net.Http.HttpClient

Purpose

This pull request is a:

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added tests that prove my fix is effective or that my feature works
    No, but I’ve been running this config in an ECS cluster in bridge mode
  • I have added necessary documentation (if appropriate)
    No, Probably really needs examples added to https://proto.actor/docs/ProtoActor/cluster/aws-provider-net, I am happy to do this if the change is merged.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 20, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants