aws-data-landing-zone 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/CLAUDE.md +622 -0
- package/.claude/ROADMAP.md +353 -0
- package/.claude/settings.json +13 -0
- package/.jsii +5188 -75
- package/.nvmrc +1 -1
- package/API.md +1012 -164
- package/docs/src/content/docs/reference/api.md +1012 -164
- package/lib/constructs/account-chatbots/index.js +1 -1
- package/lib/constructs/dlz-budget/index.js +1 -1
- package/lib/constructs/dlz-control-tower-control/control-tower-control.js +1 -1
- package/lib/constructs/dlz-lake-formation/dlz-lake-formation.js +1 -1
- package/lib/constructs/dlz-ssm-reader/dlz-ssm-reader-stack-cache.js +1 -1
- package/lib/constructs/dlz-ssm-reader/dlz-ssm-reader.js +1 -1
- package/lib/constructs/dlz-stack/index.js +1 -1
- package/lib/constructs/dlz-vpc/dlz-account-networks.js +1 -1
- package/lib/constructs/dlz-vpc/dlz-vpc.js +1 -1
- package/lib/constructs/dlz-vpc/network-address.js +1 -1
- package/lib/constructs/iam/iam-account-alias.js +3 -3
- package/lib/constructs/iam/iam-password-policy.js +1 -1
- package/lib/constructs/iam-identity-center/iam-identity-center-group.js +1 -1
- package/lib/constructs/iam-identity-center/iam-identity-center.js +1 -1
- package/lib/constructs/iam-identity-center/identity-store-user.js +3 -3
- package/lib/constructs/organization-policies/service-control-policy.js +1 -1
- package/lib/constructs/organization-policies/tag-policy.js +1 -1
- package/lib/data-landing-zone-client.js +1 -1
- package/lib/data-landing-zone.js +1 -1
- package/lib/defaults.js +1 -1
- package/lib/lib/report/index.js +1 -1
- package/lib/scripts/index.js +1 -1
- package/lib/stacks/organization/management/management-global-iam-identity-center-stack.js +1 -1
- package/lib/stacks/organization/management/management-global-stack.js +1 -1
- package/lib/stacks/organization/security/audit/global-stack.js +1 -1
- package/lib/stacks/organization/security/audit/regional-stack.js +1 -1
- package/lib/stacks/organization/security/log/global-stack.js +1 -1
- package/lib/stacks/organization/security/log/regional-stack.js +1 -1
- package/lib/stacks/organization/workloads/base/global-stack.js +1 -1
- package/lib/stacks/organization/workloads/base/regional-stack.js +1 -1
- package/lib/stacks/organization/workloads/data-services-phase-1-stack/global-stack.js +1 -1
- package/lib/stacks/organization/workloads/data-services-phase-1-stack/regional-stack.js +1 -1
- package/lib/stacks/organization/workloads/network-connections-phase-1-stack/global-stack.js +1 -1
- package/lib/stacks/organization/workloads/network-connections-phase-2-stack/global-stack.js +1 -1
- package/lib/stacks/organization/workloads/network-connections-phase-2-stack/regional-stack.js +1 -1
- package/lib/stacks/organization/workloads/network-connections-phase-3-stack/global-stack.js +1 -1
- package/lib/stacks/organization/workloads/network-connections-phase-3-stack/regional-stack.js +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
## Purpose
|
|
2
|
+
|
|
3
|
+
This repository provides a landing-zone capability for AWS data platforms.
|
|
4
|
+
|
|
5
|
+
The goal is to deliver an opinionated, enterprise-ready foundation for data and AI workloads without collapsing all concerns into one permanently coupled implementation.
|
|
6
|
+
|
|
7
|
+
This document defines how contributors should think about:
|
|
8
|
+
- architecture boundaries
|
|
9
|
+
- code quality
|
|
10
|
+
- testing
|
|
11
|
+
- extensibility
|
|
12
|
+
- deployment safety
|
|
13
|
+
- long-term maintainability
|
|
14
|
+
|
|
15
|
+
It is intentionally stricter than a normal contributor guide. When making changes, optimize for clarity of boundaries and ease of future decomposition.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Core architectural stance
|
|
20
|
+
|
|
21
|
+
We assume this project may continue to evolve as a single deployable product for some time.
|
|
22
|
+
|
|
23
|
+
However, we do **not** treat that as permission to mix concerns freely.
|
|
24
|
+
|
|
25
|
+
We design as though the system will eventually separate into clearer layers, even if those layers are not yet separate packages or repositories.
|
|
26
|
+
|
|
27
|
+
### Boundary rule
|
|
28
|
+
|
|
29
|
+
Use this decision rule for every new capability:
|
|
30
|
+
|
|
31
|
+
- **If it would still exist without the data platform, it belongs in the foundation layer**
|
|
32
|
+
- **If it exists only because we run a shared data platform, it belongs in the data platform overlay**
|
|
33
|
+
- **If it is only needed by one team, domain, or product, it belongs in the workload layer**
|
|
34
|
+
|
|
35
|
+
If a change does not clearly fit one of those layers, stop and redesign the abstraction before adding more logic.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Target conceptual layers
|
|
40
|
+
|
|
41
|
+
### 1. Foundation / governance layer
|
|
42
|
+
|
|
43
|
+
This layer represents the shared AWS estate baseline.
|
|
44
|
+
|
|
45
|
+
Examples:
|
|
46
|
+
- account structure and organizational primitives
|
|
47
|
+
- guardrails
|
|
48
|
+
- security baselines
|
|
49
|
+
- logging and audit baselines
|
|
50
|
+
- identity and access baseline patterns
|
|
51
|
+
- network primitives shared across the estate
|
|
52
|
+
- deployment orchestration primitives that are generic and not data-platform-specific
|
|
53
|
+
|
|
54
|
+
This layer should remain usable even if the data platform overlay did not exist.
|
|
55
|
+
|
|
56
|
+
### 2. Data platform overlay
|
|
57
|
+
|
|
58
|
+
This layer contains shared capabilities that exist specifically because we operate a data platform.
|
|
59
|
+
|
|
60
|
+
Examples:
|
|
61
|
+
- shared data platform accounts and roles
|
|
62
|
+
- lakehouse or analytics platform infrastructure
|
|
63
|
+
- data ingress/egress controls specific to platform operation
|
|
64
|
+
- data platform networking overlays
|
|
65
|
+
- platform-wide integrations needed only for data and AI use cases
|
|
66
|
+
|
|
67
|
+
This layer may depend on foundation primitives, but should not redefine them.
|
|
68
|
+
|
|
69
|
+
### 3. Workload / domain layer
|
|
70
|
+
|
|
71
|
+
This layer is for team-specific or product-specific implementation.
|
|
72
|
+
|
|
73
|
+
Examples:
|
|
74
|
+
- domain-specific accounts or account customizations
|
|
75
|
+
- team-specific pipelines
|
|
76
|
+
- workload-specific IAM roles
|
|
77
|
+
- product-specific services, exceptions, and integrations
|
|
78
|
+
|
|
79
|
+
This layer should be thin. It should compose existing primitives rather than reimplement shared policy or platform behavior.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## What we optimize for
|
|
84
|
+
|
|
85
|
+
When making decisions, prefer the option that improves the following:
|
|
86
|
+
|
|
87
|
+
1. **Separation of concerns**
|
|
88
|
+
2. **Predictable deployments**
|
|
89
|
+
3. **Safe upgrades**
|
|
90
|
+
4. **Fast feedback in tests**
|
|
91
|
+
5. **Small, composable abstractions**
|
|
92
|
+
6. **Clear ownership boundaries**
|
|
93
|
+
7. **Ability to split later without a rewrite**
|
|
94
|
+
|
|
95
|
+
Do not optimize for short-term convenience if it deepens coupling across layers.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Non-goals
|
|
100
|
+
|
|
101
|
+
The following are explicitly out of scope unless the repository direction changes deliberately:
|
|
102
|
+
|
|
103
|
+
- becoming a monolithic platform control plane for every AWS concern
|
|
104
|
+
- embedding team-specific business logic in shared foundation code
|
|
105
|
+
- introducing bespoke abstractions where CDK, AWS-native services, or configuration-driven composition are sufficient
|
|
106
|
+
- hiding important deployment ordering or side effects behind “magic”
|
|
107
|
+
- solving governance, orchestration, and data-platform behavior in the same class unless there is no practical alternative
|
|
108
|
+
- public DNS management (different lifecycle and risk profile from private DNS resolution)
|
|
109
|
+
- auto-remediation of security findings (detection and notification only; remediation is a separate product decision)
|
|
110
|
+
- account closure, suspension, or decommissioning (out of scope; the planned account factory will support create and adopt only)
|
|
111
|
+
- SIEM integration or custom log forwarding (when centralized logging is implemented, DLZ will deliver logs to S3; downstream consumption is deployment-specific)
|
|
112
|
+
- FinOps dashboards, chargeback models, or optimization recommendations (when CUR is implemented, DLZ will deliver raw cost data; visualization belongs in a separate layer)
|
|
113
|
+
- behavioral SCP evaluation simulation at build time (structural validation of syntax and limits is planned; simulating AWS runtime SCP evaluation is not)
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Repository design principles
|
|
118
|
+
|
|
119
|
+
### Prefer module boundaries over giant constructs
|
|
120
|
+
|
|
121
|
+
Avoid “god constructs” that:
|
|
122
|
+
- own governance
|
|
123
|
+
- create accounts
|
|
124
|
+
- sequence all deployment waves
|
|
125
|
+
- configure platform services
|
|
126
|
+
- inject workload behavior
|
|
127
|
+
- expose dozens of cross-cutting flags
|
|
128
|
+
|
|
129
|
+
Instead:
|
|
130
|
+
- isolate domain logic into focused modules
|
|
131
|
+
- expose narrow interfaces
|
|
132
|
+
- compose at the edges
|
|
133
|
+
|
|
134
|
+
### Keep constructs honest
|
|
135
|
+
|
|
136
|
+
A construct should have one clear responsibility.
|
|
137
|
+
|
|
138
|
+
Good examples:
|
|
139
|
+
- manages a network primitive
|
|
140
|
+
- configures a shared bucket policy model
|
|
141
|
+
- creates baseline IAM roles for a defined concern
|
|
142
|
+
- synthesizes a specific deployment wave from validated input
|
|
143
|
+
|
|
144
|
+
Bad examples:
|
|
145
|
+
- “platform manager”
|
|
146
|
+
- “organization engine”
|
|
147
|
+
- “global config processor”
|
|
148
|
+
- anything that both interprets policy and also provisions a broad mix of unrelated infrastructure
|
|
149
|
+
|
|
150
|
+
### Configuration should declare intent, not encode program flow
|
|
151
|
+
|
|
152
|
+
Configuration is for desired state.
|
|
153
|
+
|
|
154
|
+
Do not push hidden control flow, branching, sequencing, or imperative orchestration into configuration formats.
|
|
155
|
+
|
|
156
|
+
If a config shape requires readers to understand execution order to use it safely, the abstraction is too implicit.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Package and folder guidance
|
|
161
|
+
|
|
162
|
+
### Current structure
|
|
163
|
+
|
|
164
|
+
The repository is organized as follows:
|
|
165
|
+
|
|
166
|
+
- `src/constructs/` — reusable CDK constructs with narrow responsibilities (e.g., `dlz-guardduty/`, `dlz-vpc/`, `organization-policies/`, `iam/`)
|
|
167
|
+
- `src/stacks/organization/` — CDK stacks organized by organizational structure:
|
|
168
|
+
- `root/management/` — management account stacks (foundation layer)
|
|
169
|
+
- `security/audit/` — audit account stacks (foundation layer)
|
|
170
|
+
- `security/log/` — log account stacks (foundation layer)
|
|
171
|
+
- `workloads/` — workload account stacks, organized by deployment phase (base, network-connections-phase-1/2/3, data-services-phase-1)
|
|
172
|
+
- `src/lib/` — shared utilities (reporting, logging)
|
|
173
|
+
- `src/scripts/` — CLI scripts for deployment, diff, synth, bootstrap
|
|
174
|
+
- `test/` — test files (unit, snapshot, contract)
|
|
175
|
+
|
|
176
|
+
### Conceptual layer mapping
|
|
177
|
+
|
|
178
|
+
The target conceptual layers (foundation, platform, workload) map to the current structure as follows:
|
|
179
|
+
|
|
180
|
+
- **Foundation layer**: `src/stacks/organization/root/` + `src/stacks/organization/security/` + most constructs in `src/constructs/`
|
|
181
|
+
- **Platform layer**: `src/stacks/organization/workloads/data-services-phase-1/` + `src/constructs/dlz-lake-formation/`
|
|
182
|
+
- **Workload layer**: `src/stacks/organization/workloads/base/` + network-connections phases
|
|
183
|
+
|
|
184
|
+
### Future direction
|
|
185
|
+
|
|
186
|
+
As the project grows, code may migrate toward a more explicit layer-based layout (e.g., `foundation/`, `platform/`, `workloads/` as top-level source directories). For now, use the conceptual layer mapping above when deciding where new code belongs.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Dependency rules
|
|
191
|
+
|
|
192
|
+
These rules are mandatory.
|
|
193
|
+
|
|
194
|
+
### Allowed direction
|
|
195
|
+
|
|
196
|
+
- `foundation` must not depend on `platform` or `workloads`
|
|
197
|
+
- `platform` may depend on `foundation`
|
|
198
|
+
- `workloads` may depend on `foundation` and `platform`
|
|
199
|
+
- `deployment` may depend on typed interfaces from other layers, but should avoid embedding business logic from them
|
|
200
|
+
- `validation` should be as pure and dependency-light as possible
|
|
201
|
+
|
|
202
|
+
### Forbidden direction
|
|
203
|
+
|
|
204
|
+
- no circular dependencies
|
|
205
|
+
- no workload-specific imports inside foundation modules
|
|
206
|
+
- no platform-specific behavior hardcoded in generic deployment primitives
|
|
207
|
+
- no runtime reach-through where one layer mutates internal state of another layer
|
|
208
|
+
|
|
209
|
+
### Rule of thumb
|
|
210
|
+
|
|
211
|
+
If removing the data platform would break the module, it is not foundation code.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Code style expectations
|
|
216
|
+
|
|
217
|
+
### General
|
|
218
|
+
|
|
219
|
+
- Prefer clear, boring code over clever code
|
|
220
|
+
- Prefer explicit names over abbreviations
|
|
221
|
+
- Keep functions and methods small
|
|
222
|
+
- Make side effects obvious
|
|
223
|
+
- Avoid hidden mutation
|
|
224
|
+
- Fail early with useful error messages
|
|
225
|
+
- Use types to narrow invalid states before synthesis or deployment
|
|
226
|
+
|
|
227
|
+
### TypeScript
|
|
228
|
+
|
|
229
|
+
- Use strict typing
|
|
230
|
+
- Avoid `any`
|
|
231
|
+
- Prefer discriminated unions and typed interfaces over loose objects
|
|
232
|
+
- Keep public interfaces intentionally small
|
|
233
|
+
- Export the minimum necessary surface area
|
|
234
|
+
- Do not leak internal implementation types unless they are part of the supported API
|
|
235
|
+
|
|
236
|
+
### CDK-specific
|
|
237
|
+
|
|
238
|
+
- Keep constructs deterministic
|
|
239
|
+
- Avoid context-dependent behavior unless clearly documented
|
|
240
|
+
- Minimize custom resources; use them only when AWS-native or CDK-native options do not exist
|
|
241
|
+
- Isolate custom-resource logic from business logic
|
|
242
|
+
- Do not bury security-sensitive behavior inside helper utilities
|
|
243
|
+
- Prefer composition of constructs over inheritance-heavy hierarchies
|
|
244
|
+
|
|
245
|
+
### Configuration and defaults
|
|
246
|
+
|
|
247
|
+
- Every default should be explicit and documented
|
|
248
|
+
- Defaults should be safe, conservative, and production-aware
|
|
249
|
+
- Avoid defaults that silently create expensive or hard-to-reverse infrastructure
|
|
250
|
+
- If a default has security, cost, or operational impact, document it next to the type and in user-facing docs
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Testing standards
|
|
255
|
+
|
|
256
|
+
Testing is not optional.
|
|
257
|
+
|
|
258
|
+
Every meaningful change should improve one or more of:
|
|
259
|
+
- correctness confidence
|
|
260
|
+
- regression detection
|
|
261
|
+
- upgrade safety
|
|
262
|
+
- refactorability
|
|
263
|
+
|
|
264
|
+
### Test pyramid
|
|
265
|
+
|
|
266
|
+
#### 1. Unit tests
|
|
267
|
+
Required for:
|
|
268
|
+
- config validation
|
|
269
|
+
- synthesis planning
|
|
270
|
+
- naming and mapping logic
|
|
271
|
+
- boundary rules
|
|
272
|
+
- policy generation
|
|
273
|
+
- helper utilities
|
|
274
|
+
- custom-resource handlers
|
|
275
|
+
|
|
276
|
+
These tests should be fast and isolated.
|
|
277
|
+
|
|
278
|
+
#### 2. Snapshot / synthesis tests
|
|
279
|
+
Use for:
|
|
280
|
+
- CloudFormation template shape
|
|
281
|
+
- IAM policy documents
|
|
282
|
+
- resource counts
|
|
283
|
+
- expected stack boundaries
|
|
284
|
+
- deployment-wave planning
|
|
285
|
+
|
|
286
|
+
Snapshots must be reviewed carefully. Do not approve snapshot churn blindly.
|
|
287
|
+
|
|
288
|
+
#### 3. Contract tests
|
|
289
|
+
Use where a module guarantees a stable interface to another layer.
|
|
290
|
+
|
|
291
|
+
Examples:
|
|
292
|
+
- foundation module output consumed by platform overlay
|
|
293
|
+
- config schema compatibility across versions
|
|
294
|
+
- deployment planner consuming validated layer definitions
|
|
295
|
+
|
|
296
|
+
#### 4. Integration tests
|
|
297
|
+
Use selectively for:
|
|
298
|
+
- multi-stack interactions
|
|
299
|
+
- deployment ordering assumptions
|
|
300
|
+
- custom-resource behavior
|
|
301
|
+
- generated infrastructure contracts that cannot be validated well in unit tests
|
|
302
|
+
|
|
303
|
+
Keep integration coverage focused and valuable.
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## What to test for every PR
|
|
308
|
+
|
|
309
|
+
At minimum, contributors should think through:
|
|
310
|
+
|
|
311
|
+
- Did this change alter the public config shape?
|
|
312
|
+
- Did this change alter synthesized resources?
|
|
313
|
+
- Did this change increase cross-layer coupling?
|
|
314
|
+
- Did this change increase deployment blast radius?
|
|
315
|
+
- Did this change introduce a hidden dependency on deployment ordering?
|
|
316
|
+
- Did this change preserve upgrade behavior from previous versions?
|
|
317
|
+
|
|
318
|
+
If the answer to any of these is yes, add or update tests.
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## Extensibility rules
|
|
323
|
+
|
|
324
|
+
Extensibility matters, but not all extensibility is good.
|
|
325
|
+
|
|
326
|
+
### Good extensibility
|
|
327
|
+
|
|
328
|
+
- narrow extension points
|
|
329
|
+
- typed hooks
|
|
330
|
+
- explicit interfaces
|
|
331
|
+
- composition over override
|
|
332
|
+
- adding new modules without editing unrelated modules
|
|
333
|
+
- feature flags that are localized and temporary
|
|
334
|
+
|
|
335
|
+
### Bad extensibility
|
|
336
|
+
|
|
337
|
+
- global escape hatches
|
|
338
|
+
- untyped callback bags
|
|
339
|
+
- “misc options” objects
|
|
340
|
+
- boolean explosions
|
|
341
|
+
- inheritance trees to support one-off behavior
|
|
342
|
+
- extension points that allow skipping validation or safety controls
|
|
343
|
+
|
|
344
|
+
### Preferred model
|
|
345
|
+
|
|
346
|
+
Design extension points at the layer boundaries.
|
|
347
|
+
|
|
348
|
+
Examples:
|
|
349
|
+
- foundation emits typed outputs
|
|
350
|
+
- platform consumes those outputs through stable interfaces
|
|
351
|
+
- workloads compose the resulting modules without mutating shared internals
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## Deployment and orchestration guidance
|
|
356
|
+
|
|
357
|
+
Deployment logic is architecture.
|
|
358
|
+
|
|
359
|
+
Treat long deployment times and broad deployment waves as signals worth investigating, not merely operational trivia.
|
|
360
|
+
|
|
361
|
+
### Rules
|
|
362
|
+
|
|
363
|
+
- Keep deployment units as small as is practical
|
|
364
|
+
- Separate deployment sequencing logic from resource intent where possible
|
|
365
|
+
- Avoid rebuilding or redeploying unrelated concerns together
|
|
366
|
+
- Make wave boundaries explicit in code and tests
|
|
367
|
+
- Track which changes require global coordination versus regional or workload-only rollout
|
|
368
|
+
|
|
369
|
+
### CI/CD integration
|
|
370
|
+
|
|
371
|
+
- Prefer OIDC federation over long-lived credentials for all CI/CD integrations
|
|
372
|
+
- Currently: GitHub OIDC is configured in the management account only, for DLZ deployment
|
|
373
|
+
- Planned (see ROADMAP.md Cycle 1): per-workload-account OIDC providers, role trust policy scoped to specific repos/branches, role ARN exposed via SSM parameter
|
|
374
|
+
- OIDC provider is a foundation-layer concern (it exists without the data platform)
|
|
375
|
+
|
|
376
|
+
### Design smell indicators
|
|
377
|
+
|
|
378
|
+
Investigate refactoring when:
|
|
379
|
+
- unrelated changes trigger the same deployment path
|
|
380
|
+
- a small feature change requires touching multiple layers
|
|
381
|
+
- tests need large fixture setups to validate simple behavior
|
|
382
|
+
- synthesis or deployment time grows faster than system size
|
|
383
|
+
- teams need internal knowledge of multiple layers to make a local change
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Upgradeability and compatibility
|
|
388
|
+
|
|
389
|
+
We expect this codebase to evolve.
|
|
390
|
+
|
|
391
|
+
That means upgrades must be treated as a first-class engineering concern.
|
|
392
|
+
|
|
393
|
+
### Requirements
|
|
394
|
+
|
|
395
|
+
- preserve backward compatibility where practical
|
|
396
|
+
- version config intentionally
|
|
397
|
+
- provide migration notes for breaking changes
|
|
398
|
+
- isolate deprecated behavior behind clear boundaries
|
|
399
|
+
- add regression tests before large upgrades
|
|
400
|
+
- test library and runtime upgrades independently from feature changes when possible
|
|
401
|
+
|
|
402
|
+
### Upgrade workflow
|
|
403
|
+
|
|
404
|
+
For major upgrades:
|
|
405
|
+
1. add characterization tests for current behavior
|
|
406
|
+
2. upgrade one dependency group at a time
|
|
407
|
+
3. validate synthesis diffs
|
|
408
|
+
4. validate custom-resource behavior
|
|
409
|
+
5. document known behavior changes
|
|
410
|
+
6. remove temporary compatibility code only after adoption is proven
|
|
411
|
+
|
|
412
|
+
Do not combine infrastructure behavior changes and dependency upgrades in the same PR unless there is a strong reason.
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## Security and governance expectations
|
|
417
|
+
|
|
418
|
+
This project touches foundational AWS infrastructure. Security decisions must be explicit.
|
|
419
|
+
|
|
420
|
+
### Mandatory principles
|
|
421
|
+
|
|
422
|
+
- least privilege by default
|
|
423
|
+
- secure-by-default configuration
|
|
424
|
+
- encryption defaults where applicable
|
|
425
|
+
- auditability of privileged actions
|
|
426
|
+
- no implicit privilege escalation between layers
|
|
427
|
+
- avoid custom IAM wildcards unless justified and documented
|
|
428
|
+
|
|
429
|
+
### Review expectations
|
|
430
|
+
|
|
431
|
+
Any PR affecting:
|
|
432
|
+
- IAM
|
|
433
|
+
- KMS
|
|
434
|
+
- Organizations
|
|
435
|
+
- Control Tower interactions
|
|
436
|
+
- networking
|
|
437
|
+
- logging
|
|
438
|
+
- cross-account roles
|
|
439
|
+
- custom resources
|
|
440
|
+
|
|
441
|
+
must include a short review note explaining:
|
|
442
|
+
- what changed
|
|
443
|
+
- why it is safe
|
|
444
|
+
- blast radius
|
|
445
|
+
- rollback considerations
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## AWS organization-level security services — reference pattern (from GuardDuty)
|
|
450
|
+
|
|
451
|
+
The following pattern was extracted from the GuardDuty implementation. When adding the next org-level security service, use the GuardDuty constructs in `src/constructs/dlz-guardduty/` as the reference template.
|
|
452
|
+
|
|
453
|
+
### Delegated administrator pattern
|
|
454
|
+
|
|
455
|
+
- **Management account**: only delegates admin, does not run the service itself. Use a custom resource to call the delegation API (e.g., `EnableOrganizationAdminAccount`). Keep the management account minimal.
|
|
456
|
+
- **Audit account**: acts as the delegated administrator. Creates the service detector/hub and manages organization-wide configuration. This is where findings aggregate and notifications route from.
|
|
457
|
+
- **Deployment ordering**: management stack (wave 1) delegates before audit stack (wave 2) creates the detector. The existing pipeline wave ordering guarantees this.
|
|
458
|
+
|
|
459
|
+
### Feature configuration hierarchy
|
|
460
|
+
|
|
461
|
+
Organization-level services should follow a two-tier configuration model:
|
|
462
|
+
|
|
463
|
+
1. **Org baseline** (`DataLandingZoneProps`): sets the mandatory floor for all accounts. Configured via optional props on the top-level config (e.g., `guardDuty?: DlzGuardDutyProps`).
|
|
464
|
+
2. **Per-account additive overrides** (`DLzAccount`): individual accounts can enable additional features on top of the org baseline, but cannot disable org-level features. Merge logic is always OR: `enabled = orgBaseline || accountOverride`.
|
|
465
|
+
|
|
466
|
+
This eliminates precedence conflicts between org-level auto-enable and per-account settings.
|
|
467
|
+
|
|
468
|
+
### Defaults
|
|
469
|
+
|
|
470
|
+
- All optional features default to `false` (disabled). Users opt in explicitly.
|
|
471
|
+
- Auto-enable for member accounts defaults to `'NONE'`. Users choose `'ALL'` or `'NEW'` explicitly.
|
|
472
|
+
- The `Defaults` class provides a static method returning the default feature set (e.g., `Defaults.guardDutyFeatures()`), and `PropsOrDefaults` resolves user config vs defaults.
|
|
473
|
+
|
|
474
|
+
### Custom resources
|
|
475
|
+
|
|
476
|
+
Use custom resources only when no native CloudFormation resource exists (e.g., `EnableOrganizationAdminAccount`, `UpdateMemberDetectors`). Follow the established pattern:
|
|
477
|
+
|
|
478
|
+
- Construct: `CustomResourceProvider.getOrCreateProvider()` with `NODEJS_22_X`
|
|
479
|
+
- Lambda handler: in `src/constructs/<service>/lambda/<handler>/index.ts`
|
|
480
|
+
- `fetchCodeDirectory()`: use `fs.existsSync` fallback to `assets/` for test compatibility (jsii compiles to `lib/`, but tests run from `src/` via ts-jest)
|
|
481
|
+
- Make operations idempotent (check current state before mutating)
|
|
482
|
+
- On delete: only reverse the specific action, do not disable shared service access
|
|
483
|
+
|
|
484
|
+
### Construct organization
|
|
485
|
+
|
|
486
|
+
- Types in `src/constructs/<service>/<service>-types.ts`, separate from `data-landing-zone-types.ts`
|
|
487
|
+
- Shared utilities (feature mapping, merge logic) live in the types file, not duplicated across constructs
|
|
488
|
+
- Barrel export via `src/constructs/<service>/index.ts`
|
|
489
|
+
- Bundle entry in `.projenrc.ts` for each Lambda handler
|
|
490
|
+
|
|
491
|
+
### Notification routing
|
|
492
|
+
|
|
493
|
+
Security service findings flow through existing DLZ notification channels automatically:
|
|
494
|
+
- Service findings → Security Hub → EventBridge rule (`aws.securityhub` source) → SNS → Slack/Email
|
|
495
|
+
- No additional notification plumbing needed per service — configure `securityHubNotifications` to filter by severity/workflow status
|
|
496
|
+
|
|
497
|
+
### Adding new org-level services
|
|
498
|
+
|
|
499
|
+
Each new org-level security service (Macie, Inspector, etc.) should reuse the same pattern:
|
|
500
|
+
|
|
501
|
+
- Reuse the delegated-admin custom resource pattern, construct organization (`src/constructs/<service>/`), and feature-configuration hierarchy
|
|
502
|
+
- Do not invent new patterns — compose from the existing GuardDuty construct template
|
|
503
|
+
- All org-level services route findings through Security Hub → EventBridge → SNS. No per-service notification plumbing.
|
|
504
|
+
|
|
505
|
+
---
|
|
506
|
+
|
|
507
|
+
## Documentation expectations
|
|
508
|
+
|
|
509
|
+
Every meaningful architectural change should leave the codebase easier to understand.
|
|
510
|
+
|
|
511
|
+
### Required when relevant
|
|
512
|
+
|
|
513
|
+
Update documentation for:
|
|
514
|
+
- new extension points
|
|
515
|
+
- new config fields
|
|
516
|
+
- changed defaults
|
|
517
|
+
- changed deployment boundaries
|
|
518
|
+
- changed ownership assumptions
|
|
519
|
+
- breaking changes
|
|
520
|
+
- new operational runbooks
|
|
521
|
+
|
|
522
|
+
### ADRs
|
|
523
|
+
|
|
524
|
+
Create an Architecture Decision Record when:
|
|
525
|
+
- introducing a new cross-cutting abstraction
|
|
526
|
+
- changing layer boundaries
|
|
527
|
+
- adding a new deployment orchestration model
|
|
528
|
+
- introducing a custom resource for a foundational capability
|
|
529
|
+
- making a decision specifically to defer separation for now
|
|
530
|
+
|
|
531
|
+
ADRs should explain both:
|
|
532
|
+
- why the decision was taken
|
|
533
|
+
- what signals would trigger revisiting it later
|
|
534
|
+
|
|
535
|
+
---
|
|
536
|
+
|
|
537
|
+
## PR review checklist
|
|
538
|
+
|
|
539
|
+
Before merging, reviewers should ask:
|
|
540
|
+
|
|
541
|
+
### Boundary clarity
|
|
542
|
+
- Does this belong in foundation, platform, or workload?
|
|
543
|
+
- Is that boundary obvious from the code?
|
|
544
|
+
|
|
545
|
+
### Coupling
|
|
546
|
+
- Did this increase coupling across governance, deployment, and platform logic?
|
|
547
|
+
- Could this change be moved into a narrower module?
|
|
548
|
+
|
|
549
|
+
### Blast radius
|
|
550
|
+
- What deploys because of this?
|
|
551
|
+
- Is the blast radius proportional to the change?
|
|
552
|
+
|
|
553
|
+
### Test quality
|
|
554
|
+
- Are there fast tests?
|
|
555
|
+
- Are critical synthesis or contract assumptions covered?
|
|
556
|
+
|
|
557
|
+
### Extensibility
|
|
558
|
+
- Does this create a clean extension point or a future maintenance trap?
|
|
559
|
+
|
|
560
|
+
### Operations
|
|
561
|
+
- Will this make deployments, upgrades, or troubleshooting harder?
|
|
562
|
+
|
|
563
|
+
If the answer is “harder,” the PR should explain why that trade-off is worth it.
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
## Practical decision guide
|
|
568
|
+
|
|
569
|
+
When under time pressure:
|
|
570
|
+
|
|
571
|
+
### Accept now
|
|
572
|
+
- small, well-contained changes
|
|
573
|
+
- local improvements with clear ownership
|
|
574
|
+
- tactical additions that preserve layer boundaries
|
|
575
|
+
- limited compatibility shims with an exit plan
|
|
576
|
+
|
|
577
|
+
### Defer or redesign
|
|
578
|
+
- broad abstractions with unclear ownership
|
|
579
|
+
- shortcuts that mix foundation and data-platform logic
|
|
580
|
+
- config additions that encode orchestration complexity
|
|
581
|
+
- new global flags to support one-off behavior
|
|
582
|
+
- changes that make future decomposition materially harder
|
|
583
|
+
|
|
584
|
+
---
|
|
585
|
+
|
|
586
|
+
## What “good” looks like
|
|
587
|
+
|
|
588
|
+
A healthy contribution usually has these traits:
|
|
589
|
+
|
|
590
|
+
- one clear responsibility
|
|
591
|
+
- explicit layer placement
|
|
592
|
+
- typed inputs and outputs
|
|
593
|
+
- fast unit tests
|
|
594
|
+
- stable synth behavior
|
|
595
|
+
- low blast radius
|
|
596
|
+
- easy rollback
|
|
597
|
+
- clear docs
|
|
598
|
+
- obvious future extraction path
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
## What “bad” looks like
|
|
603
|
+
|
|
604
|
+
Reject or redesign changes that look like:
|
|
605
|
+
|
|
606
|
+
- “just add it to the main construct”
|
|
607
|
+
- layer-violating imports because it is “more convenient”
|
|
608
|
+
- hidden orchestration in config parsing
|
|
609
|
+
- custom resources doing too much
|
|
610
|
+
- helpers that mix validation, defaulting, synthesis, and deployment concerns
|
|
611
|
+
- feature work bundled with upgrades and refactors
|
|
612
|
+
- PRs that change critical infrastructure behavior without tests
|
|
613
|
+
|
|
614
|
+
---
|
|
615
|
+
|
|
616
|
+
## Roadmap context
|
|
617
|
+
|
|
618
|
+
For current implementation priorities and cycle planning, see `.claude/ROADMAP.md`.
|
|
619
|
+
|
|
620
|
+
That document contains time-bound planning details (problem statements, appetite, scope boundaries) for upcoming work, including design specs for planned features. Only patterns extracted from **implemented** features are captured in this governance document (currently: the org-level security services pattern from GuardDuty).
|
|
621
|
+
|
|
622
|
+
When a cycle completes and a feature ships, extract any durable architectural patterns into the relevant sections above. Do not extract patterns for features that have not been implemented yet.
|