aws-cdk-project-template-for-devops
aws-cdk-project-template-for-devops copied to clipboard
Using the BaseConstruct
Hi, I see that in your patterns lib/template/patterns
folder, all the patterns extend the BaseConstruct
. Each pattern's props also extend the ConstructCommonProps
. What is the best way to create an instance of something like the LambdaSimplePatternProps
to pass in to the lambda pattern? If i had to instantiate a LambdaSimplePatternProps
by assigning all the fields from ConstructCommonProps
, it would lead to a lot of boilerplate code.
I've also noticed in other projects that follow this devops setup, you don't extend BaseConstruct
at all, which simplifies the usage of the pattern i think.
Thanks for contacting our repository.
In facts, pattern constructs in lib/template/patterns
is a set of pre-defined common constructs. It takes a lot of arguments because it does something more for us. So you may feel tired of object creation. But once you learn how to use it, you will be able to use it easily. And since these patterns aren't required, you don't have to use them if you don't need them.
These are examples for creating the construct pattern:
- pre-defined pattern case: 39 line, https://github.com/aws-samples/aws-serverless-nlp-comprehend-using-aws-cdk/blob/main/infra/stack/review-dashboard-stack.ts
- custom pattern case: 39 line: https://github.com/aws-samples/aws-ecs-devops-using-aws-cdk/blob/main/infra/ecs-service/ecs-cicd-stack.ts