Aws-cdk: (AppMesh): Create L2 Construct for AWS AppMesh

Created on 15 Apr 2019  路  5Comments  路  Source: aws/aws-cdk

The current implementation only has an L1 construct for AWS AppMesh. I'm currently working on an L2 construct for this.

At a high-level one should be able to.

  • Create a service mesh
  • Create virtual services and add them too the mesh
  • Add virtual nodes to the mesh
  • Add virtual routers to the mesh
  • Add virtual routes pointing to these nodes

    • Should be able to add HTTP and TCP routes

  • Know which mesh a route(r) is attached to
  • Know which router a Node is attached to
  • Know which backends nodes talk to

I'm submitting a PR for this, looking forward to the comments and review.

Most helpful comment

Are you planning on adding support to ECS constructs also?

I've not looked into it too much but it seems like support needs to be added in order to configure the proxy.

https://docs.aws.amazon.com/app-mesh/latest/userguide/mesh-getting-started-ecs.html

I was looking into making those changes as well, though CDK today doesn't seem to have support even for the L1 ProxyConfiguration. Until that's added to the CFN layer the L2 ECS construct can't be updated.

You can get around this today by adding property overrides..

const taskDefinition =  new ecs.FargateTaskDefinition(this, 'TaskDefinition', {
  ...props,
  executionRole: this.executionRole,
});

const cfnTaskDef = taskDefinition.node.findChild('Resource') as ecs.CfnTaskDefinition;
    cfnTaskDef.addPropertyOverride('ProxyConfiguration', {
      Type: 'APPMESH',
      ContainerName: 'envoy',
      ProxyConfigurationProperties: [
        {
          Name: 'IgnoredUID',
          Value: '1337',
        },
        {
          Name: 'ProxyIngressPort',
          Value: '15000',
        },
        {
          Name: 'ProxyEgressPort',
          Value: '15001',
        },
        {
          Name: 'AppPorts',
          Value: [YOUR-APP-PORTS],
        },
        {
          Name: 'EgressIgnoredIPs',
          Value: '169.254.170.2,169.254.169.254',
        },
      ],
    });

All 5 comments

Are you planning on adding support to ECS constructs also?

I've not looked into it too much but it seems like support needs to be added in order to configure the proxy.

https://docs.aws.amazon.com/app-mesh/latest/userguide/mesh-getting-started-ecs.html

Are you planning on adding support to ECS constructs also?

I've not looked into it too much but it seems like support needs to be added in order to configure the proxy.

https://docs.aws.amazon.com/app-mesh/latest/userguide/mesh-getting-started-ecs.html

I was looking into making those changes as well, though CDK today doesn't seem to have support even for the L1 ProxyConfiguration. Until that's added to the CFN layer the L2 ECS construct can't be updated.

You can get around this today by adding property overrides..

const taskDefinition =  new ecs.FargateTaskDefinition(this, 'TaskDefinition', {
  ...props,
  executionRole: this.executionRole,
});

const cfnTaskDef = taskDefinition.node.findChild('Resource') as ecs.CfnTaskDefinition;
    cfnTaskDef.addPropertyOverride('ProxyConfiguration', {
      Type: 'APPMESH',
      ContainerName: 'envoy',
      ProxyConfigurationProperties: [
        {
          Name: 'IgnoredUID',
          Value: '1337',
        },
        {
          Name: 'ProxyIngressPort',
          Value: '15000',
        },
        {
          Name: 'ProxyEgressPort',
          Value: '15001',
        },
        {
          Name: 'AppPorts',
          Value: [YOUR-APP-PORTS],
        },
        {
          Name: 'EgressIgnoredIPs',
          Value: '169.254.170.2,169.254.169.254',
        },
      ],
    });

Thanks for showing me how to do property overrides. Much appreciated.

Can you show me where to check for L1 support. I had a scan around but didn't spot it in the codebase. Just in the docs. I presume L1 is cfn* classes and auto generated form the cloud formation schema?

Yes the L1 is the CfnXZY stuff, I usually take a look at the *.generated.ts files in the corresponding lib folders, also search through sourcegraph as it makes it easier.

Thanks for the AppMesh L2 constructs support. It enabled me to create all the AppMesh nodes, routers, routes and services that I needed. Last bit is to integrate it with ECS/Fargate. For that I'd need to be able to do proxyConfiguration. Is there any timeline when this will be available? Or should we stick to the cfnTaskDef.addPropertyOverride workaround?

PS: the official envoy proxy image doesn't seem to be available outside the us-west-2 region.

Was this page helpful?
0 / 5 - 0 ratings