question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(AppMesh): How to create two virtual service/node with bidirectional backend without circular dependencies

See original GitHub issue

What is the problem?

I am currently setting up a CDK stack using ECS and AppMesh to create a micro service environment. In this micro service environment, every service should be able to talk to every other service. What I am trying to do is create a VirtualNode & Service per micro service and then call addBackend for each of these services and add all other services. However, this creates a cyclic dependencies for all services.

I haven’t found a way yet to create this bidirectional backend setup without creating cyclic dependencies inside the CDK.

Reproduction Steps

        // Inside 1 stack
        const node1 = new appmesh.VirtualNode(stack1, 'node1', {
            virtualNodeName: 'Node1',
            mesh: props.mesh,
            listeners: [appmesh.VirtualNodeListener.grpc({
                port: 8080,
                healthCheck: appmesh.HealthCheck.grpc({
                    healthyThreshold: 2,
                    interval: cdk.Duration.seconds(5),
                    timeout: cdk.Duration.seconds(2),
                    unhealthyThreshold: 3,
                }),
            })],
            accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
        });

        const service1 = new appmesh.VirtualService(stack2, 'Service1', {
            virtualServiceName:  'Service1',
            virtualServiceProvider: appmesh.VirtualServiceProvider.virtualNode(node1),
        });

       // Inside stack 2
        const node2 = new appmesh.VirtualNode(this, 'node2', {
            virtualNodeName: 'Node2',
            mesh: props.mesh,
            listeners: [appmesh.VirtualNodeListener.grpc({
                port: 8080,
                healthCheck: appmesh.HealthCheck.grpc({
                    healthyThreshold: 2,
                    interval: cdk.Duration.seconds(5),
                    timeout: cdk.Duration.seconds(2),
                    unhealthyThreshold: 3,
                }),
            })],
            accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
        });

        const service2 = new appmesh.VirtualService(this, 'Service2', {
            virtualServiceName: 'Service2',
            virtualServiceProvider: appmesh.VirtualServiceProvider.virtualNode(node2),
        });

      // Added afterwards via Aspect
      node1.addBackend(service2);
      node2.addBackend(service1)

What did you expect to happen?

I expected there to be a way to create a bidirectional connection between backend services.

What actually happened?

It always creates a circular dependency and I can’t see any escape hatch

CDK CLI Version

1.130.0

Framework Version

No response

Node.js Version

9.0.0

OS

MacOS BigSur

Language

Typescript

Language Version

No response

Other information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
wplucinskycommented, Jan 13, 2022

A new version of @aws-cdk/aws-appmesh has been published to NPM. Versions >= 1.139.0 contain the fix.

1reaction
ashanpwcommented, Nov 17, 2021

Thanks for the info. We are able to reproduce the issue and are now figuring out how to fix this or provide a workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Virtual nodes - AWS App Mesh
Any virtual service that a virtual node sends outbound traffic to is specified as a backend. The response metadata for your new virtual...
Read more >
awsappmesh - Go Packages
A CloudFormation `AWS::AppMesh::VirtualRouter`. Creates a virtual router within a service mesh. Specify a `listener` for any inbound traffic that your virtual ...
Read more >
Networking and Kubernetes: A Layered Approach [1&nbsp
The Link layer of the TCP/IP stack comprises two sublayers: the Media Access Control (MAC) sublayer and the Logical Link Control (LLC) sublayer....
Read more >
Deep Dive on Configuring AWS App Mesh - YouTube
In this talk, we cover an introduction to AWS App Mesh, why you might consider using a service mesh, and a demo on...
Read more >
AWS App Mesh Deep Dive with Amazon EKS - YouTube
Learn about AWS App Mesh capabilities as well as new features which enhance the security, observability and resilience of container services ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found