Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(ecs): target a specific container and port for SRV service discovery #12796

Assignees
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container feature-request A feature should be added or improved.

Comments

@misterjoshua
Copy link
Contributor

misterjoshua commented Jan 31, 2021

I would like to point SRV service discovery records to specific ports on specific containers in tasks.

Use Case

When setting up a clustered Keycloak server, in addition to serving web traffic, the Keycloak instances need to talk among themselves using Infinispan/JGroups on a different port. The best way to accomplish this on ECS with bridge networking would be to use DNS-based service discovery, with the SRV record type. But this can only work if the SRV records can point to the Infinispan ports and not the same port as the web traffic. Currently, CDK's ECS Service constructs want to use the default (web) port on the default container, but in my case, I'd like SRV records pointing at Infinispan ports.

Proposed Solution

I would appreciate being able to tell service discovery which container and port to use for the SRV record. An interface like this would work:

new ecs.Ec2Service(stack, 'Service', {
  ...
  cloudMapOptions: {
    dnsRecordType: cloudmap.DnsRecordType.SRV,
    // New fields:
    container: specificContainerDefinition,
    containerPort: 81,
  },
});

Other

I have a PR linked to this issue.

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@misterjoshua misterjoshua added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 31, 2021
@misterjoshua misterjoshua changed the title (ecs): provide more control over the cloudmap services (ecs): target a specific container and port for SRV service discovery Feb 1, 2021
@NGL321 NGL321 added the @aws-cdk/aws-ecs Related to Amazon Elastic Container label Feb 1, 2021
@SoManyHs SoManyHs removed the needs-triage This issue or PR still needs to be triaged. label Feb 1, 2021
@mergify mergify bot closed this as completed in #12798 Mar 4, 2021
mergify bot pushed a commit that referenced this issue Mar 4, 2021
…overy records (#12798)

Adds `container` and `containerPort` as optional properties of `CloudMapOptions`. This change allows the user to select which container and container port the `SRV` record points to.

Closes #12796

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Mar 4, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

This was referenced Mar 6, 2021
cornerwings pushed a commit to cornerwings/aws-cdk that referenced this issue Mar 8, 2021
…overy records (aws#12798)

Adds `container` and `containerPort` as optional properties of `CloudMapOptions`. This change allows the user to select which container and container port the `SRV` record points to.

Closes aws#12796

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment