AWS CDK (TypeScript) - VPC, subnets and routing tables

0

Hello,

I am new to using AWS CDK, I need to set up the network infrastructure in code using AWS CDK(Typescript). I have tried setting some basic infrastructure and at it seems to work, however, I don't seem to have any control over being able to rename any of the stacks I have created to something simple like test-vpc instead of being given [STACK/STACKNAME/TEST-VPC/subnet. Also when creating the routing table for the VPC it created multiple extra tables that I did not define, almost like its creating default tables in addition to my code.

It seems to me anyway that its a lot easier to create this via cloud formation (more control of resource names and referencing)

My question - is there any tips or guides to help define the CDK code for networking, I have only got as far as the basics and still got a long way to go with the likes of creating TGWs, NFWs

Any good example of a VPC, subnet and route table association CDK stacks that I could use?

Thanks

1개 답변
0

Hi,

On your question about choosing physical stack names with CDK, look at https://docs.aws.amazon.com/cdk/v2/guide/stacks.html at end of section preceding section 'Stack API', you have examples in all languages

The physical names of the AWS CloudFormation stacks are automatically determined 
by the AWS CDK based on the stack's construct path in the tree. By default, a stack's 
name is derived from the construct ID of the Stack object. However, you can specify 
an explicit name by using the stackName prop (in Python, stack_name), as follows.

On good sample, see for example https://github.com/sebsto/cdk-vpc-example/blob/master/bin/vpc-ingress-routing.ts

class VpcIngressRoutingStack is a good example

Hope it helps!

Didier

profile pictureAWS
전문가
답변함 10달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠