Module Naming and Scope⚓︎
Module Definition⚓︎
In LZA, a module represents a dedicated codebase that manages a specific AWS service. Each module is responsible for handling configurations and operations for its designated AWS service only. For example:
macie
module exclusively manages Amazon Macie configurations and operationscontrol-tower
module handles AWS Control Tower managementguardduty
module manages Amazon GuardDuty configurations
Module Scope Guidelines⚓︎
-
Single Service Responsibility
- One module corresponds to one AWS service
- Each module encapsulates various operations related to its specific service
- No cross-service operations within a single module
-
Naming Convention
- Module names should match their corresponding AWS service name
- Use lowercase, hyphen-separated names (e.g.,
control-tower
,security-hub
) - Names should be immediately identifiable with their AWS service
-
Service Boundaries
- Module should contain service-specific operations
- Configuration management for the service
- Service-specific API interactions
- Service-specific resource management
Example module structure:
source/packages/@aws-lza/lib/
├── macie/ # Amazon Macie operations
├── control-tower/ # AWS Control Tower operations
├── security-hub/ # AWS Security Hub operations
└── guard-duty/ # Amazon GuardDuty operations
Module Interface and Implementation Contract⚓︎
Each module must have its interface definition in interfaces/<module-name>.ts
Each interface must extends IModuleCommonParameter
interface
Interfaces define the contract that the module must implement
Example for Control Tower interface:
// interfaces/control-tower.ts
export interface IControlTowerLandingZoneModule {
handler(props: IControlTowerLandingZoneHandlerParameter): Promise<string>;
// Other required methods and types
}
Implementation must be in the module's index.ts:
// lib/control-tower/index.ts
export class AcceleratorControlTowerLandingZoneModule
implements IControlTowerLandingZoneModule {
public async handler(
props: IControlTowerLandingZoneHandlerParameter
): Promise<string> {
// Implementation logic
}
}