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

Support Service discovery in ECS #1554

Closed
kraigor opened this issue Jan 15, 2019 · 3 comments · Fixed by #2065 · May be fixed by MechanicalRock/account-reaper#6
Closed

Support Service discovery in ECS #1554

kraigor opened this issue Jan 15, 2019 · 3 comments · Fixed by #2065 · May be fixed by MechanicalRock/account-reaper#6
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container feature-request A feature should be added or improved. pr/work-in-progress This PR is a draft and needs further work.

Comments

@kraigor
Copy link

kraigor commented Jan 15, 2019

Hi,
it seems like there's no way to relate Discovery Service to Ec2Service. Are there any plans on implementing this?
Thanks

@rix0rrr rix0rrr added feature-request A feature should be added or improved. @aws-cdk/aws-ecs Related to Amazon Elastic Container gap labels Jan 16, 2019
@rix0rrr
Copy link
Contributor

rix0rrr commented Jan 16, 2019

You're right that we don't have support for this yet. It will come eventually but I cannot give you a date on it just yet.

cc @SoManyHs

@kraigor
Copy link
Author

kraigor commented Jan 16, 2019

@rix0rrr thanks for the information.
I found a workaround, here's an example (I hope it may be useful to somebody):

var ns = new dis.CfnPrivateDnsNamespace(...
var discovery = new dis.CfnService(...
var service = new ecs.Ec2Service(...

var hook = ((<any>service).resource as ecs.CfnService);
hook.propertyOverrides.serviceRegistries = [{
    registryArn: discovery.serviceArn
}];

@SoManyHs SoManyHs self-assigned this Jan 22, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Feb 20, 2019
@SoManyHs SoManyHs changed the title EC2Service discovery Support Service discovery in ECS Feb 22, 2019
@SoManyHs SoManyHs added the pr/work-in-progress This PR is a draft and needs further work. label Feb 23, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Feb 25, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Mar 5, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Mar 7, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Mar 8, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Mar 12, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Mar 13, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Mar 21, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Mar 21, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Mar 26, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Apr 1, 2019
SoManyHs added a commit to SoManyHs/aws-cdk that referenced this issue Apr 2, 2019
@nacitar
Copy link

nacitar commented Sep 2, 2022

An example workaround with the cfn escape hatch in c#:

// Assumes service and discoveryService are both defined.

// ABRITRARY BLOCK; ServiceRegistries isn't exposed in the cdk constructs
// https://github.com/aws/aws-cdk/issues/1554
{
    ECS.CfnService cfnService = service.Node.DefaultChild as ECS.CfnService
        ?? throw new Exception("If you see this, ECS.Ec2Service no longer wraps ECS.CfnService.");
    cfnService.ServiceRegistries = new[] {
        new ECS.CfnService.ServiceRegistryProperty {
            Port = 12345,
            RegistryArn = discoveryService.ServiceArn
        }
    };
}

The arbitrary block keeps the workaround from polluting the enclosing namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecs Related to Amazon Elastic Container feature-request A feature should be added or improved. pr/work-in-progress This PR is a draft and needs further work.
Projects
None yet
4 participants