aws-data-landing-zone 0.0.40 → 0.0.42
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/.jsii +116 -123
- package/API.md +27 -17
- package/README.md +2 -3
- package/docs/astro.config.ts +33 -28
- package/docs/src/content/docs/components/account-management/accounts.mdx +139 -0
- package/docs/src/content/docs/components/account-management/budgets.mdx +149 -0
- package/docs/src/content/docs/components/account-management/imgs/account_factory_settings.png +0 -0
- package/docs/src/content/docs/components/account-management/imgs/aws_new_account_1.png +0 -0
- package/docs/src/content/docs/components/account-management/imgs/aws_new_account_2.png +0 -0
- package/docs/src/content/docs/components/account-management/imgs/aws_new_account_3.png +0 -0
- package/docs/src/content/docs/components/account-management/imgs/aws_new_account_4.png +0 -0
- package/docs/src/content/docs/components/account-management/imgs/aws_new_account_5.png +0 -0
- package/docs/src/content/docs/components/account-management/imgs/aws_organisation_ids_final.png +0 -0
- package/docs/src/content/docs/components/account-management/regions.mdx +66 -0
- package/docs/src/content/docs/components/account-management/service-deny-list.mdx +58 -0
- package/docs/src/content/docs/components/account-management/sop-account-setup.mdx +40 -0
- package/docs/src/content/docs/components/account-management/sop-add-account.mdx +118 -0
- package/docs/src/content/docs/components/account-management/sop-initial-control-tower-setup.mdx +202 -0
- package/docs/src/content/docs/components/account-management/tagging.mdx +127 -0
- package/docs/src/content/docs/components/build-system/ci-integration.mdx +7 -8
- package/docs/src/content/docs/components/data-services/lake-formation.mdx +423 -0
- package/docs/src/content/docs/getting-started.mdx +187 -159
- package/docs/src/content/docs/introduction.mdx +5 -11
- package/docs/src/content/docs/reference/api.md +27 -17
- package/docs/src/content/docs/reference/defaults.mdx +61 -0
- package/docs/src/content/docs/reference/imgs/grants_diagram.png +0 -0
- package/docs/src/content/docs/reference/imgs/tag_inheritance.png +0 -0
- package/docs/src/content/docs/reference/lake-formation-tbac-recommended-strategy.mdx +286 -0
- package/docs/src/content/docs/reference/scripts-commands.mdx +76 -39
- package/docs-old/rough-docs/default-notification/default-notification.md +14 -3
- package/lib/constructs/account-chatbots/index.d.ts +17 -0
- package/lib/constructs/account-chatbots/index.js +2 -2
- 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-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 +1 -1
- 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-types.d.ts +9 -0
- package/lib/data-landing-zone-types.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-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.d.ts +0 -2
- package/lib/stacks/organization/workloads/base/global-stack.js +13 -13
- 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 +1 -1
- package/docs/src/content/docs/components/account-management/introduction.mdx +0 -4
- package/docs/src/content/docs/components/build-system/overview.mdx +0 -37
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Defaults
|
|
3
|
+
description: Defaults
|
|
4
|
+
---
|
|
5
|
+
import DualCode from "../../../components/DualCode.astro";
|
|
6
|
+
|
|
7
|
+
The Data Landing Zone provides opinionated yet configurable setups by offering optional defaults for various
|
|
8
|
+
parts of the configuration. These defaults help streamline setup while remaining adaptable to specific requirements.
|
|
9
|
+
|
|
10
|
+
### Example: Using Defaults in Budgets
|
|
11
|
+
|
|
12
|
+
An example of applying defaults is demonstrated in the [Budgets](/components/account-management/budgets#defaults)
|
|
13
|
+
component, where the `Defaults.budgets` object is used to create two standard budgets.
|
|
14
|
+
|
|
15
|
+
Below is a code snippet illustrating how to configure a budget of $100 for the entire organization and $20 for
|
|
16
|
+
resources created by the DLZ:
|
|
17
|
+
|
|
18
|
+
<DualCode>
|
|
19
|
+
<Fragment slot="ts">
|
|
20
|
+
```ts
|
|
21
|
+
import {App} from 'aws-cdk-lib';
|
|
22
|
+
import { DataLandingZone } from 'aws-data-landing-zone';
|
|
23
|
+
|
|
24
|
+
const app = new App();
|
|
25
|
+
const dlz = new DataLandingZone(app, {
|
|
26
|
+
budgets: [
|
|
27
|
+
...Defaults.budgets(100, 20, {
|
|
28
|
+
emails: ['you@org.com'],
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
...
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
</Fragment>
|
|
35
|
+
<Fragment slot="python">
|
|
36
|
+
```python
|
|
37
|
+
import aws_cdk as cdk
|
|
38
|
+
import aws_data_landing_zone as dlz
|
|
39
|
+
|
|
40
|
+
app = cdk.App()
|
|
41
|
+
dlz.DataLandingZone(app,
|
|
42
|
+
budgets=[
|
|
43
|
+
*dlz.Defaults.budgets(
|
|
44
|
+
100,
|
|
45
|
+
20,
|
|
46
|
+
emails=["you@org.com"],
|
|
47
|
+
),
|
|
48
|
+
],
|
|
49
|
+
...
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
</Fragment>
|
|
54
|
+
</DualCode>
|
|
55
|
+
|
|
56
|
+
### List of Defaults
|
|
57
|
+
|
|
58
|
+
A comprehensive list of defaults referenced throughout the documentation:
|
|
59
|
+
|
|
60
|
+
- [Defaults.budgets](/components/account-management/budgets#defaults): Creates two budgets, one for the organization
|
|
61
|
+
and another for the DLZ-managed resources.
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Lake Formation TBAC strategy
|
|
3
|
+
description: References - Lake Formation TBAC strategy
|
|
4
|
+
---
|
|
5
|
+
import DualCode from '../../../components/DualCode.astro';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
We recommend adopting a Tag-Based Access Control (TBAC) strategy in Lake Formation and setting the `hybridMode` flag
|
|
9
|
+
to `false`, disabling IAM management.
|
|
10
|
+
|
|
11
|
+
Rather than directly assigning permissions to individual resources, this approach uses tags on resources,
|
|
12
|
+
and permissions are granted based on those tags to principals. This strategy simplifies data governance by significantly
|
|
13
|
+
reducing the effort required to set up and manage permissions, especially in large environments.
|
|
14
|
+
|
|
15
|
+
Here is a summary of the key concepts involved in Tag-Based Access Control (TBAC):
|
|
16
|
+
|
|
17
|
+
- **LF-Tags**: Key-value pairs that are attached to resources.
|
|
18
|
+
- **Resources**: These include databases, tables, and columns registered in Lake Formation.
|
|
19
|
+
- **Principals**: IAM entities (Users, Roles, AWS IAM Identity Center, SAML), AWS accounts, Organizations, and Organizational Units.
|
|
20
|
+
- **Grants**: Permissions given to principals for accessing resources based on their LF-tags.
|
|
21
|
+
|
|
22
|
+
## Tag-Based Access Control (TBAC)
|
|
23
|
+
|
|
24
|
+
Grants in TBAC are typically expressed as SQL statement pseudocode for easy conceptualization. These grants
|
|
25
|
+
ultimately translate into CloudFormation/CDK constructs. We will reason about permissions in this SQL format.
|
|
26
|
+
|
|
27
|
+
A typical Grant expression might look like this:
|
|
28
|
+
|
|
29
|
+
```sql
|
|
30
|
+
GRANT ACCESS ON TAGS foo=bar AND spam=eggs TO DataLakeUser
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Rules
|
|
34
|
+
|
|
35
|
+
LF-Tags follow a set of fundamental rules:
|
|
36
|
+
|
|
37
|
+
- Grants are applied **TO** principals **ON** specific tags. For example:
|
|
38
|
+
|
|
39
|
+
```sql
|
|
40
|
+
GRANT ACCESS ON TAGS foo=bar TO user
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- In a grant expression, all tag **keys** are evaluated using `AND` logic, while tag **values** are
|
|
44
|
+
evaluated using `OR` logic. For instance:
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
The user has access to resources tagged with both `foo=bar` AND `spam=eggs`
|
|
48
|
+
```sql
|
|
49
|
+
GRANT ACCESS ON TAGS foo=bar AND spam=eggs TO user
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The user has access to resources tagged with either `foo=bar` OR `foo=baz`
|
|
53
|
+
```sql
|
|
54
|
+
GRANT ACCESS ON TAGS foo=['bar', 'baz'] TO user
|
|
55
|
+
```
|
|
56
|
+
- Tags assigned to resources are **inherited**, unless specifically overridden.
|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
- Grants ensure access to resources where **ALL** conditions specified are true.
|
|
60
|
+
|
|
61
|
+

|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Limitations
|
|
65
|
+
|
|
66
|
+
There are a few limitations in designing flexible tag systems:
|
|
67
|
+
- Tags are assigned to data catalog resources (databases, tables and columns), and each resource can
|
|
68
|
+
have multiple tags, with a maximum of **50 tags** and **no duplicate keys**.
|
|
69
|
+
|
|
70
|
+
- A resource cannot have the same LF-tag key more than once. For example, you cannot apply both
|
|
71
|
+
`team=sales` and `team=marketing` to the same table.
|
|
72
|
+
|
|
73
|
+
One workaround is to embed the name inside the tag key, making the tag behave as a toggle, such as
|
|
74
|
+
`team:sales=true` and `team:marketing=true`.
|
|
75
|
+
|
|
76
|
+
- A `GRANT` statement cannot use an `OR` condition across different tag keys. The following statement is
|
|
77
|
+
**invalid**:
|
|
78
|
+
|
|
79
|
+
❌ Invalid
|
|
80
|
+
```sql
|
|
81
|
+
GRANT ACCESS ON TAGS foo=bar OR spam=eggs TO user
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
✅ Valid
|
|
85
|
+
```sql
|
|
86
|
+
GRANT ACCESS ON TAGS foo=bar TO user
|
|
87
|
+
GRANT ACCESS ON TAGS spam=eggs TO user
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Best Practices
|
|
92
|
+
|
|
93
|
+
Here are some best practices and recommendations to consider when designing your tagging system:
|
|
94
|
+
|
|
95
|
+
- LF-Tags are hierarchical. If you apply a `GRANT` statement to a high-level resource (like a database),
|
|
96
|
+
this inherently grants access to all child resources (like a table) that share the same tag value.
|
|
97
|
+
|
|
98
|
+
- When creating a `GRANT` statement, remember that tags are **AND-ed**, not **OR-ed**. For example:
|
|
99
|
+
|
|
100
|
+
```sql
|
|
101
|
+
GRANT ACCESS ON TAGS team:marketing=true TO executives
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This grants the `executives` group access to all resources tagged with `team:marketing=true`.
|
|
105
|
+
|
|
106
|
+
If the statement is modified to:
|
|
107
|
+
|
|
108
|
+
```sql
|
|
109
|
+
GRANT ACCESS ON TAGS team:marketing=true AND PII=true TO executives
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The `executives` group is granted access only to resources that are tagged with both `team:marketing=true`
|
|
113
|
+
and `PII=true`.
|
|
114
|
+
|
|
115
|
+
## Tag Strategy
|
|
116
|
+
|
|
117
|
+
There is no one-size-fits-all solution, the most effective strategy is the one that aligns best with an organization's
|
|
118
|
+
structure. The recommended strategies are a modified version of the
|
|
119
|
+
[AWS Recommended Common LF-Tag Ontologies](https://aws.github.io/aws-lakeformation-best-practices/lf-tags/common-ontologies/).
|
|
120
|
+
|
|
121
|
+
We suggest two strategies, pick the one that best fits your organization's structure:
|
|
122
|
+
|
|
123
|
+
- **Product-based tagging**: Tag resources based on the product/project they belong to and then create fine-grained
|
|
124
|
+
permission grants per principal/team. **Recommended for scenarios with many products and many teams**. This approach scales
|
|
125
|
+
with both products and team size but requires more effort in creating permission grants.
|
|
126
|
+
|
|
127
|
+
- **Team-based tagging**: Tag resources based on the team that needs access, assuming that it is acceptable that the same team tag will have
|
|
128
|
+
the same permission level to all resources they have access to. **Recommended for simplicity when you have many products but only a few
|
|
129
|
+
teams and can accept certain limitations.** This approach scales with the number of products but not the number of teams, due to the 50-tag limit on
|
|
130
|
+
resources.
|
|
131
|
+
|
|
132
|
+
Let's consider a scenario with the following teams and roles:
|
|
133
|
+
- `Admin` has the role `RoleAdmin`
|
|
134
|
+
- `DataEngineering` has the role `RoleDataEngineering`
|
|
135
|
+
- `DataScience` has the role `RoleDataScience`
|
|
136
|
+
|
|
137
|
+
We have the following products and their respective databases:
|
|
138
|
+
- `ProductA`: `Database1`, `Database2`
|
|
139
|
+
- `ProductB`: `Database3`
|
|
140
|
+
|
|
141
|
+
### Product-based tagging
|
|
142
|
+
|
|
143
|
+
This strategy involves tagging resources based on the product they belong to, followed by creating fine-grained
|
|
144
|
+
permission grants per team.
|
|
145
|
+
|
|
146
|
+
#### Suggested Tags
|
|
147
|
+
We suggest to start with a basic tagging strategy and limiting the number of tags:
|
|
148
|
+
- `product:<product_name> = true`: Tag resources belonging to a specific product.
|
|
149
|
+
- `sensitive = [true, false]`: Tag resources containing sensitive data (e.g., PII).
|
|
150
|
+
|
|
151
|
+
#### Resource Tagging
|
|
152
|
+
Start by tagging your resources, let's only apply them to Databases to keep things simple. Apply the following tags:
|
|
153
|
+
- `Database1`: `sensitive=false`, `product:productA=true`
|
|
154
|
+
- `Database2`: `sensitive=true`, `product:productA=true`
|
|
155
|
+
- `Database3`: `sensitive=false`, `product:productB=true`
|
|
156
|
+
|
|
157
|
+
#### Permissions
|
|
158
|
+
Admins need full access to all Databases, we don't have to specify the `senstive` tag as the value is irrelevant.
|
|
159
|
+
```sql
|
|
160
|
+
GRANT FULL ACCESS ON TAGS product:productA=true TO RoleAdmin
|
|
161
|
+
GRANT FULL ACCESS ON TAGS product:productB=true TO RoleAdmin
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The following grants will allow the `DataEngineering` team full access to all Databases of all products that are not
|
|
165
|
+
sensitive. They will only be able to access `Database1` and `Database3`.
|
|
166
|
+
```sql
|
|
167
|
+
GRANT FULL ACCESS ON TAGS product:productA=true AND sensitive=false TO RoleDataEngineering
|
|
168
|
+
GRANT FULL ACCESS ON TAGS product:productB=true AND sensitive=false TO RoleDataEngineering
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
The `DataScience` team requires read only access to ProductB. So they can only access `Database3`.
|
|
172
|
+
```sql
|
|
173
|
+
GRANT READ ACCESS ON TAGS product:productB=true AND sensitive=true TO RoleDataScience
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
#### Pros and Cons
|
|
177
|
+
|
|
178
|
+
This approach is effective when there are only a few products or databases that need to be shared across multiple teams.
|
|
179
|
+
In this model, you assign a product tag to each resource once and then configure permission grants for every team that
|
|
180
|
+
requires access to the product.
|
|
181
|
+
|
|
182
|
+
**Advantages**:
|
|
183
|
+
- You do not need to add additional tags to resources.
|
|
184
|
+
- Permission grants can be tailored to each team's requirements.
|
|
185
|
+
|
|
186
|
+
**Disadvantages**:
|
|
187
|
+
- Creating permission grants for every team and product can become time-consuming and complex as the number of teams
|
|
188
|
+
and products increases.
|
|
189
|
+
|
|
190
|
+
**Example Scenario**:
|
|
191
|
+
|
|
192
|
+
Assume you have 100 products or databases and 5 teams. If the SalesTeam requires access to 50 of these products, the
|
|
193
|
+
following grants would need to be created:
|
|
194
|
+
```sql
|
|
195
|
+
GRANT READ ONLY ACCESS ON TAGS product:productA=true AND sensitive=false TO RoleSales
|
|
196
|
+
GRANT READ ONLY ACCESS ON TAGS product:productB=true AND sensitive=false TO RoleSales
|
|
197
|
+
... repeat for remaining 48 products
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
If a new product is introduced, you must also grant permissions to each relevant team. For example:
|
|
201
|
+
```sql
|
|
202
|
+
GRANT FULL ACCESS ON TAGS product:productNEW=true AND sensitive=false TO RoleDataEngineering
|
|
203
|
+
GRANT READONLY ACCESS ON TAGS product:productNEW=true AND sensitive=false TO RoleDataScience
|
|
204
|
+
GRANT READONLY ACCESS ON TAGS product:productNEW=true AND sensitive=false TO RoleSales
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Team based tagging
|
|
208
|
+
|
|
209
|
+
This strategy involves tagging resources based on the team that requires access. However, it is important to note that
|
|
210
|
+
all resources associated with the same team tag will share the same permission level.
|
|
211
|
+
|
|
212
|
+
#### Suggested Tags
|
|
213
|
+
We suggest to start with a basic tagging strategy and limiting the number of tags:
|
|
214
|
+
Here are the basic tags:
|
|
215
|
+
- `team:<team_name> = true`: Assigned to resources that a specific team should access.
|
|
216
|
+
- `sensitive = [true, false]`: Indicates whether a resource contains sensitive data, such as Personally Identifiable
|
|
217
|
+
Information (PII).
|
|
218
|
+
|
|
219
|
+
#### Resource Tagging
|
|
220
|
+
Start by tagging your resources, let's only apply them to Databases to keep things simple. Apply the following tags,
|
|
221
|
+
assuming that we always have the `team:Admin=true` tag on all resources, as they must always have access to all
|
|
222
|
+
resources:
|
|
223
|
+
- `Database1` with tags (`sensitive=false`, `team:Admin=true`)
|
|
224
|
+
- `Database2` with tags (`sensitive=true`, `team:Admin=true`)
|
|
225
|
+
- `Database3` with tags (`sensitive=false`, `team:Admin=true`)
|
|
226
|
+
|
|
227
|
+
#### Permissions
|
|
228
|
+
Since Admins need full access to all Databases, we don't have to specify the `senstive` tag as the value is irrelevant.
|
|
229
|
+
```sql
|
|
230
|
+
GRANT FULL ACCESS ON TAGS team:Admin=true TO RoleAdmin
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
For the `DataEngineering` team to have full access to all Databases that are not sensitive, we need to specify their
|
|
234
|
+
grants as:
|
|
235
|
+
```sql
|
|
236
|
+
GRANT FULL ACCESS ON TAGS team:DataEngineering=true AND sensitive=false TO RoleDataEngineering
|
|
237
|
+
```
|
|
238
|
+
But now we have to add tags to our resources, our Databases now look like:
|
|
239
|
+
- `Database1` with tags (`sensitive=false`, `team:Admin=true`, `team:DataEngineering=true`)
|
|
240
|
+
- `Database2` with tags (`sensitive=true`, `team:Admin=true`, `team:DataEngineering=true`)
|
|
241
|
+
- `Database3` with tags (`sensitive=false`, `team:Admin=true`, `team:DataEngineering=true`)
|
|
242
|
+
|
|
243
|
+
The `DataScience` team requires read only access to Database3.
|
|
244
|
+
```sql
|
|
245
|
+
GRANT READ ACCESS ON TAGS team:DataScience=true AND sensitive=false TO RoleDataScience
|
|
246
|
+
```
|
|
247
|
+
But again, we have to add tags to our resources, our Databases now look like:
|
|
248
|
+
- `Database1` with tags (`sensitive=false`, `team:Admin=true`, `team:DataEngineering=true`)
|
|
249
|
+
- `Database2` with tags (`sensitive=true`, `team:Admin=true`, `team:DataEngineering=true`)
|
|
250
|
+
- `Database3` with tags (`sensitive=false`, `team:Admin=true`, `team:DataEngineering=true`, `team:DataScience=true`)
|
|
251
|
+
|
|
252
|
+
#### Pros and Cons
|
|
253
|
+
|
|
254
|
+
:::caution
|
|
255
|
+
This strategy has scalability limitations. AWS enforces a 50-tag limit per resource, which means you cannot exceed 50
|
|
256
|
+
teams. Additionally, other tags such as `sensitive` count toward this limit, reducing the number of team tags you can use.
|
|
257
|
+
:::
|
|
258
|
+
|
|
259
|
+
This approach is effective when you need to share **many products or databases** with **a small number of teams** and
|
|
260
|
+
can accommodate the restriction that all resources with the same team tag share identical permissions. You define the
|
|
261
|
+
permission grant once for the team's tag and apply it to all resources requiring access.
|
|
262
|
+
|
|
263
|
+
**Advantages**:
|
|
264
|
+
- Reduces the need for multiple permission grants.
|
|
265
|
+
- Straightforward to manage with a limited number of teams.
|
|
266
|
+
|
|
267
|
+
**Disadvantages**:
|
|
268
|
+
- Requires tagging resources for each team, which can become cumbersome.
|
|
269
|
+
- Teams with the same tag will have identical permissions for all tagged resources.
|
|
270
|
+
- Limited scalability due to the 50-tag resource limit.
|
|
271
|
+
|
|
272
|
+
**Example Scenario**:
|
|
273
|
+
|
|
274
|
+
Consider a situation with 100 products or databases and 5 teams. If the `SalesTeam` requires access to 50 of these
|
|
275
|
+
products, you would need to update the tags on each database:
|
|
276
|
+
- `Database1` with tags (`sensitive=false`, `team:Admin=true`, `team:DataEngineering=true`, `team:Sales=true`)
|
|
277
|
+
- `Database2` with tags (`sensitive=true`, `team:Admin=true`, `team:DataEngineering=true`, `team:Sales=true`)
|
|
278
|
+
- `Database3` with tags (`sensitive=false`, `team:Admin=true`, `team:DataEngineering=true`, `team:DataScience=true`, `team:Sales=true`)
|
|
279
|
+
- ... repeat for remaining 47 products/databases
|
|
280
|
+
|
|
281
|
+
When introducing a new product or database, you must also update its tags for each relevant team:
|
|
282
|
+
- `DatabaseNEW` with tags (`sensitive=false`, `team:Admin=true`, `team:DataEngineering=true`, `team:Sales=true`)
|
|
283
|
+
|
|
284
|
+
## Other Sources
|
|
285
|
+
- https://aws.github.io/aws-lakeformation-best-practices/
|
|
286
|
+
- https://docs.aws.amazon.com/lake-formation/latest/dg/lf-tag-considerations.html
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
title: Scripts and Commands
|
|
3
3
|
description: Reference - Scripts and Commands
|
|
4
4
|
---
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import DualCode from "../../../components/DualCode.astro";
|
|
6
7
|
|
|
7
8
|
## Scripts
|
|
8
9
|
|
|
@@ -41,7 +42,7 @@ These scripts do not require full administrative access, allowing for a more res
|
|
|
41
42
|
enhance security.
|
|
42
43
|
|
|
43
44
|
The `bootstrap` script, however, requires elevated permissions. The specified profile must have administrative access
|
|
44
|
-
to the
|
|
45
|
+
to the Management account and the ability to assume the `AWSControlTowerExecution` role created by AWS
|
|
45
46
|
Control Tower. These permissions are highly privileged and should be handled with caution.
|
|
46
47
|
|
|
47
48
|
### TypeScript Usage
|
|
@@ -49,8 +50,9 @@ Control Tower. These permissions are highly privileged and should be handled wit
|
|
|
49
50
|
A complete example is available in the [TypeScript Example GitHub Repo](https://github.com/DataChefHQ/aws-data-landing-zone-example-typescript)
|
|
50
51
|
|
|
51
52
|
The code snippets below are from:
|
|
53
|
+
|
|
52
54
|
- [/scripts](https://github.com/DataChefHQ/aws-data-landing-zone-example-typescript/tree/main/scripts)
|
|
53
|
-
- [
|
|
55
|
+
- [package.json](https://github.com/DataChefHQ/aws-data-landing-zone-example-typescript/tree/main/package.json)
|
|
54
56
|
|
|
55
57
|
There are many ways to run scripts in a TypeScript project. Here, we’ll explore a simple and straightforward approach.
|
|
56
58
|
Start by creating a `scripts` directory at the root of your project, and add individual TypeScript files, each
|
|
@@ -58,8 +60,8 @@ containing the specific DLZ `Scripts` you want to execute.
|
|
|
58
60
|
|
|
59
61
|
```ts
|
|
60
62
|
// scripts/bootstrap.ts
|
|
61
|
-
import { Scripts } from
|
|
62
|
-
import { config } from
|
|
63
|
+
import { Scripts } from "aws-data-landing-zone";
|
|
64
|
+
import { config } from "../bin/minimum_config";
|
|
63
65
|
|
|
64
66
|
(async () => {
|
|
65
67
|
await (new Scripts()).boostrapAll(config);
|
|
@@ -73,43 +75,83 @@ simplify the process, add a corresponding script to your `package.json`.
|
|
|
73
75
|
// package.json
|
|
74
76
|
{
|
|
75
77
|
"scripts": {
|
|
76
|
-
"bootstrap": "npx ts-node scripts/bootstrap.ts"
|
|
78
|
+
"bootstrap": "npx ts-node --prefer-ts-exts scripts/bootstrap.ts"
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
```
|
|
80
|
-
|
|
82
|
+
|
|
83
|
+
You can then execute the script with:
|
|
84
|
+
```
|
|
85
|
+
npm run bootstrap
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The `bootstrapAll` function reads the DLZ configuration,
|
|
81
89
|
including details such as AWS profiles, account IDs, and regions. It orchestrates the bootstrapping process for the
|
|
82
|
-
|
|
90
|
+
management, security audit, security log, and workload accounts, ensuring they all trust the Management account.
|
|
83
91
|
|
|
84
92
|
#### Available Scripts
|
|
85
93
|
|
|
86
|
-
- `
|
|
87
|
-
and workload accounts) in all regions.
|
|
88
|
-
- `
|
|
89
|
-
- `
|
|
90
|
-
- `
|
|
91
|
-
- `
|
|
92
|
-
- `
|
|
94
|
+
- `boostrapAll(props: DataLandingZoneProps)` - Bootstraps all accounts (management, security audit, security log,
|
|
95
|
+
and workload accounts) in all regions.
|
|
96
|
+
- `diffAll(props: DataLandingZoneProps)` - Runs `cdk diff "**"` to show differences for all stacks across all accounts and regions.
|
|
97
|
+
- `diffSelect(props: DataLandingZoneProps, id: string)` - Runs `cdk diff "${id}"` to show differences for a selected stack using its ID.
|
|
98
|
+
- `deployAll(props: DataLandingZoneProps)` - Deploys all stacks in all accounts and regions using `cdk deploy "**"`.
|
|
99
|
+
- `deploySelect(props: DataLandingZoneProps, id: string)` - Deploys a selected stack using `cdk deploy "${id}"`.
|
|
100
|
+
- `configureCostAllocationTags(props: DataLandingZoneProps)` - Sets the `mandatoryTags` and
|
|
93
101
|
`additionalMandatoryTags` properties as cost allocation tags.
|
|
94
102
|
|
|
95
|
-
|
|
96
103
|
More examples and pre-configured scripts are available in the
|
|
97
104
|
[TypeScript Example GitHub Repo](https://github.com/DataChefHQ/aws-data-landing-zone-example-typescript). These can
|
|
98
105
|
be copied and reused in your project. They contain pre-configured scripts for the most common stack
|
|
99
|
-
selecting ids for the `
|
|
106
|
+
selecting ids for the `diffSelect` and `deploySelect` functions.
|
|
100
107
|
|
|
101
108
|
Refer to the [Stack Patterns](/components/build-system/deployment-order#stacks-patterns) section for a full list of stack selecting IDs.
|
|
102
109
|
|
|
103
110
|
### Python Usage
|
|
104
111
|
|
|
105
|
-
|
|
106
|
-
The log lines are out of order when using the scripts in Python. This is a known issue and requires further
|
|
107
|
-
investigation.
|
|
112
|
+
A complete example is available in the [Python Example GitHub Repo](https://github.com/DataChefHQ/aws-data-landing-zone-example-python)
|
|
108
113
|
|
|
109
|
-
|
|
110
|
-
:::
|
|
114
|
+
The code snippets below are from:
|
|
111
115
|
|
|
112
|
-
|
|
116
|
+
- [/scripts](https://github.com/DataChefHQ/aws-data-landing-zone-example-python/tree/main/scripts)
|
|
117
|
+
|
|
118
|
+
Here, we’ll explore a simple and straightforward approach to run the DLZ scripts in Python.
|
|
119
|
+
Start by creating a `scripts` directory at the root of your project, and add individual Python files, each
|
|
120
|
+
containing the specific DLZ `Scripts` you want to execute.
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
// scripts/bootstrap.py
|
|
124
|
+
from aws_data_landing_zone import Scripts
|
|
125
|
+
from data_landing_zone_example_python.config_minimum import config
|
|
126
|
+
|
|
127
|
+
scripts = Scripts()
|
|
128
|
+
scripts.deploy_all(props=config)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
You can then execute the script with:
|
|
132
|
+
```
|
|
133
|
+
python scripts/bootstrap.py
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The `bootstrapAll` function reads the DLZ configuration,
|
|
137
|
+
including details such as AWS profiles, account IDs, and regions. It orchestrates the bootstrapping process for the
|
|
138
|
+
management, security audit, security log, and workload accounts, ensuring they all trust the Management account.
|
|
139
|
+
|
|
140
|
+
#### Available Scripts
|
|
141
|
+
|
|
142
|
+
- `boostrap_all(props: DataLandingZoneProps)` - Bootstraps all accounts (management, security audit, security log,
|
|
143
|
+
and workload accounts) in all regions.
|
|
144
|
+
- `diff_all(props: DataLandingZoneProps)` - Runs `cdk diff "**"` to show differences for all stacks across all accounts and regions.
|
|
145
|
+
- `diff_select(props: DataLandingZoneProps, id: string)` - Runs `cdk diff "${id}"` to show differences for a selected stack using its ID.
|
|
146
|
+
- `deploy_all(props: DataLandingZoneProps)` - Deploys all stacks in all accounts and regions using `cdk deploy "**"`.
|
|
147
|
+
- `deploy_select(props: DataLandingZoneProps, id: string)` - Deploys a selected stack using `cdk deploy "${id}"`.
|
|
148
|
+
- `configure_cost_allocation_tags(props: DataLandingZoneProps)` - Sets the `mandatoryTags` and
|
|
149
|
+
`additionalMandatoryTags` properties as cost allocation tags.
|
|
150
|
+
|
|
151
|
+
More examples and pre-configured scripts are available in the
|
|
152
|
+
[Python Example GitHub Repo](https://github.com/DataChefHQ/aws-data-landing-zone-example-python). These can
|
|
153
|
+
be copied and reused in your project. They contain pre-configured scripts for the most common stack
|
|
154
|
+
selecting ids for the `diffSelect` and `deploySelect` functions.
|
|
113
155
|
|
|
114
156
|
## Commands (manual)
|
|
115
157
|
|
|
@@ -123,11 +165,12 @@ commands are detailed below for reference or troubleshooting purposes.
|
|
|
123
165
|
### Bootstrap
|
|
124
166
|
|
|
125
167
|
Each account and region defined in the DLZ configuration must be CDK bootstrapped. This process is automated by the
|
|
126
|
-
`
|
|
168
|
+
`boostrapAll` function. For manual execution, use the following steps:
|
|
127
169
|
|
|
128
170
|
Script replacements:
|
|
171
|
+
|
|
129
172
|
- `YOUR_PROFILE` - The AWS CLI profile to use. See required permission as mentioned in [Scripts permission](#scripts-permission).
|
|
130
|
-
- `
|
|
173
|
+
- `MANAGMENT_ACCOUNT_ID` - The AWS Account ID of the management account. All other accounts will trust this account.
|
|
131
174
|
- `SECURITY_LOG_ACCOUNT_ID` - The AWS Account ID of the security log account.
|
|
132
175
|
- `SECURITY_AUDIT_ACCOUNT_ID` - The AWS Account ID of the security log account.
|
|
133
176
|
- `GLOBAL_REGION` - The region where the management account is located.
|
|
@@ -144,7 +187,7 @@ ACCOUNTS=(
|
|
|
144
187
|
"SECURITY_AUDIT_ACCOUNT_ID"
|
|
145
188
|
"WORKLOAD_ACCOUNT_IDS")
|
|
146
189
|
|
|
147
|
-
cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess --profile $YOUR_PROFILE --tags Owner=infra --tags Project=dlz --tags Environment=dlz aws://$
|
|
190
|
+
cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess --profile $YOUR_PROFILE --tags Owner=infra --tags Project=dlz --tags Environment=dlz aws://$MANAGMENT_ACCOUNT_ID/$GLOBAL_REGION
|
|
148
191
|
|
|
149
192
|
for account in "${ACCOUNTS[@]}"; do
|
|
150
193
|
|
|
@@ -159,21 +202,21 @@ for account in "${ACCOUNTS[@]}"; do
|
|
|
159
202
|
export AWS_SECRET_ACCESS_KEY
|
|
160
203
|
export AWS_SESSION_TOKEN
|
|
161
204
|
|
|
162
|
-
cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess --trust $
|
|
205
|
+
cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess --trust $MANAGMENT_ACCOUNT_ID --tags Owner=infra --tags Project=dlz --tags Environment=dlz aws://$account/$GLOBAL_REGION
|
|
163
206
|
for region in "${REGIONS[@]}"; do
|
|
164
|
-
cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess --trust $
|
|
207
|
+
cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess --trust $MANAGMENT_ACCOUNT_ID --tags Owner=infra --tags Project=dlz --tags Environment=dlz aws://$account/$region
|
|
165
208
|
done
|
|
166
209
|
done
|
|
167
210
|
```
|
|
168
211
|
|
|
169
|
-
|
|
170
212
|
### Diff
|
|
171
213
|
|
|
172
214
|
The cdk diff command compares the current state of stacks with the code definition.
|
|
173
|
-
This process is automated by the `
|
|
215
|
+
This process is automated by the `diffAll` and `diffSelect` functions.
|
|
174
216
|
For manual execution, see the following examples:
|
|
175
217
|
|
|
176
218
|
Below are a few examples of how to run the diff command manually.
|
|
219
|
+
|
|
177
220
|
```bash
|
|
178
221
|
# To diff all the stacks in all accounts and regions.
|
|
179
222
|
cdk diff "**" --profile YOUR_PROFILE
|
|
@@ -188,7 +231,7 @@ Refer to the [Stack Patterns](/components/build-system/deployment-order#stacks-p
|
|
|
188
231
|
### Deploy
|
|
189
232
|
|
|
190
233
|
The CDK deploy command deploys the stacks defined in the CDK code.
|
|
191
|
-
This process is automated by the `
|
|
234
|
+
This process is automated by the `deployAll` and `deploySelect` functions.
|
|
192
235
|
For manual execution, see the following examples:
|
|
193
236
|
|
|
194
237
|
```bash
|
|
@@ -204,7 +247,7 @@ Refer to the [Stack Patterns](/components/build-system/deployment-order#stacks-p
|
|
|
204
247
|
|
|
205
248
|
### Configure Cost Allocation Tags
|
|
206
249
|
|
|
207
|
-
Manually set cost allocation tags using the following script:
|
|
250
|
+
Manually set cost allocation tags for the Management account's global region using the following script:
|
|
208
251
|
|
|
209
252
|
```bash
|
|
210
253
|
TAGS=("Tag1" "Tag2")
|
|
@@ -213,11 +256,5 @@ TAGS_JSON="[${TAGS_JSON:1}]"
|
|
|
213
256
|
aws ce update-cost-allocation-tags-status --cost-allocation-tags-statuses "$TAGS_JSON"
|
|
214
257
|
```
|
|
215
258
|
|
|
216
|
-
The `
|
|
259
|
+
The `configureCostAllocationTags` script sets the `mandatoryTags` and `additionalMandatoryTags`
|
|
217
260
|
properties as cost allocation tags.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
# Default notifications in Slack
|
|
2
2
|
|
|
3
|
-
To facilitate communication regarding the **Data Landing Zone** there are default "channels" that can send notifications
|
|
3
|
+
To facilitate communication regarding the **Data Landing Zone** there are default "channels" that can send notifications
|
|
4
|
+
to be delivered to the application's team. The "channels" are configured to use **email** or **Slack notification**.
|
|
5
|
+
For Slack messages these are sent to an **SNS topic** that is delivered to a **ChatBot** and then it gets sent to
|
|
6
|
+
**Slack Channels**. These channels are created and configured by the user first. The notfication settings are then
|
|
7
|
+
configured in the **DLZ** using default notification settings at the organization level, or can be set and overridden
|
|
8
|
+
at the account level.
|
|
4
9
|
|
|
5
10
|
## To use email notifications
|
|
6
11
|
|
|
7
|
-
If you want to use email notifications, you need to create a configuration in the **DLZ** that creates these "channels"
|
|
12
|
+
If you want to use email notifications, you need to create a configuration in the **DLZ** that creates these "channels"
|
|
13
|
+
for teams so that they can get notified by just sending a message to an **SNS topic**. This will then be delivered to
|
|
14
|
+
the email subscriptions for the **SNS topic**. To setup email notfication using AWS guide use this link:
|
|
15
|
+
[setting up email notifications](https://docs.aws.amazon.com/sns/latest/dg/sns-email-notifications.html). Its important to note that the email address must be verified before it can
|
|
16
|
+
be used in the **DLZ**.
|
|
8
17
|
|
|
9
18
|
## To use Slack notifications
|
|
10
19
|
|
|
11
|
-
For the Data Landing Zone, each account will need to be configured with a Slack channel. For an AWS account to be able
|
|
20
|
+
For the Data Landing Zone, each account will need to be configured with a Slack channel. For an AWS account to be able
|
|
21
|
+
to send notifications to Slack, it must be approved in the Slack workspace. You must manually connect Slack and the
|
|
22
|
+
aws account(s) before deploying the DLZ.
|
|
12
23
|
|
|
13
24
|
To follow along using AWS guide use this link: [setting up Slack](https://docs.aws.amazon.com/chatbot/latest/adminguide/Slack-setup.html)
|
|
14
25
|
|
|
@@ -2,8 +2,25 @@ import * as chatbot from 'aws-cdk-lib/aws-chatbot';
|
|
|
2
2
|
import { SlackChannelConfigurationProps } from 'aws-cdk-lib/aws-chatbot/lib/slack-channel-configuration';
|
|
3
3
|
import { Construct } from 'constructs';
|
|
4
4
|
export interface SlackChannel {
|
|
5
|
+
/**
|
|
6
|
+
* The name of Slack channel configuration
|
|
7
|
+
*/
|
|
5
8
|
readonly slackChannelConfigurationName: string;
|
|
9
|
+
/**
|
|
10
|
+
* The ID of the Slack workspace authorized with AWS Chatbot.
|
|
11
|
+
*
|
|
12
|
+
* To get the workspace ID, you must perform the initial authorization flow with Slack in the AWS Chatbot console.
|
|
13
|
+
* Then you can copy and paste the workspace ID from the console.
|
|
14
|
+
* For more details, see steps 1-4 in Setting Up AWS Chatbot with Slack in the AWS Chatbot User Guide.
|
|
15
|
+
* @see https://docs.aws.amazon.com/chatbot/latest/adminguide/setting-up.html#Setup_intro
|
|
16
|
+
*/
|
|
6
17
|
readonly slackWorkspaceId: string;
|
|
18
|
+
/**
|
|
19
|
+
* The ID of the Slack channel.
|
|
20
|
+
*
|
|
21
|
+
* To get the ID, open Slack, right click on the channel name in the left pane, then choose Copy Link.
|
|
22
|
+
* The channel ID is the 9-character string at the end of the URL. For example, ABCBBLZZZ.
|
|
23
|
+
*/
|
|
7
24
|
readonly slackChannelId: string;
|
|
8
25
|
}
|
|
9
26
|
export declare class AccountChatbots {
|
|
@@ -39,6 +39,6 @@ class AccountChatbots {
|
|
|
39
39
|
}
|
|
40
40
|
exports.AccountChatbots = AccountChatbots;
|
|
41
41
|
_a = JSII_RTTI_SYMBOL_1;
|
|
42
|
-
AccountChatbots[_a] = { fqn: "aws-data-landing-zone.AccountChatbots", version: "0.0.
|
|
42
|
+
AccountChatbots[_a] = { fqn: "aws-data-landing-zone.AccountChatbots", version: "0.0.42" };
|
|
43
43
|
AccountChatbots.slackChatBots = {};
|
|
44
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
44
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29uc3RydWN0cy9hY2NvdW50LWNoYXRib3RzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsNkN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