AWS CDK Tips: How to Centrally Apply Configurations to Multiple Resources
In this article, I will introduce a collection of tips for centrally and collectively applying configurations to the properties of multiple resources in AWS CDK. The tips for bulk property applicat...

Source: DEV Community
In this article, I will introduce a collection of tips for centrally and collectively applying configurations to the properties of multiple resources in AWS CDK. The tips for bulk property application covered in this article use the following four features: Aspects PropertyInjectors Mixins RemovalPolicies 1. Aspects The first feature I will introduce is Aspects. Aspects is a feature that allows you to apply the same operation to all resources within any given scope, such as a stack or construct. 1-1. How to Use Aspects You can apply properties to multiple resources at once by defining a class that implements the IAspect interface and writing property override logic for specific resource types in the visit method, as shown below. // Aspects are implemented by implementing the IAspect interface export class BucketVersioningUpdater implements cdk.IAspect { public visit(node: IConstruct): void { // The visit method is called for every resource within the construct passed to Aspects, // so