aws-samples / aws-cdk-project-template-for-devops

This repository provides best practices and template framework for developing AWS Cloud Development Kit(CDK)-based applications effectively, quickly and collaboratively.
MIT No Attribution
155 stars 32 forks source link

Using the BaseConstruct #10

Open ukayani opened 1 year ago

ukayani commented 1 year ago

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.

kwonyulchoi commented 1 year ago

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: