aws-data-landing-zone 0.0.42 → 0.0.44
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 +3 -3
- package/README.md +85 -19
- package/docs/astro.config.ts +47 -36
- package/docs/public/favicon.png +0 -0
- package/docs/src/content/docs/components/account-management/accounts.mdx +1 -1
- package/docs/src/content/docs/components/identity/iam-identity-center.mdx +148 -0
- package/docs/src/content/docs/components/networking/bastion-hosts.mdx +189 -0
- package/docs/src/content/docs/components/networking/imgs/nat_1.png +0 -0
- package/docs/src/content/docs/components/networking/imgs/nat_2.png +0 -0
- package/docs/src/content/docs/components/networking/imgs/vpt_1.png +0 -0
- package/docs/src/content/docs/components/networking/imgs/vpt_2.png +0 -0
- package/docs/src/content/docs/components/networking/imgs/vpt_3.png +0 -0
- package/docs/src/content/docs/components/networking/imgs/vpt_4.png +0 -0
- package/docs/src/content/docs/components/networking/imgs/vpt_5.png +0 -0
- package/docs/src/content/docs/components/networking/nats.mdx +462 -0
- package/docs/src/content/docs/components/networking/vpc-peering.mdx +313 -0
- package/docs/src/content/docs/components/networking/vpcs.mdx +284 -0
- package/docs/src/content/docs/components/security/control-tower-controls.mdx +66 -0
- package/docs/src/content/docs/components/security/iam-permission-boundary.mdx +70 -0
- package/docs/src/content/docs/components/security/security-hub.mdx +123 -0
- package/docs/src/content/docs/components/security/service-deny-list.mdx +59 -0
- package/docs/src/content/docs/getting-started.mdx +2 -2
- package/docs/src/content/docs/index.mdx +2 -2
- package/docs/src/content/docs/introduction.mdx +134 -49
- package/docs/src/content/docs/reference/defaults.mdx +9 -0
- package/docs/src/content/docs/reference/extending-and-escape-hatches.mdx +50 -0
- package/docs/src/content/docs/reference/integration/cdk-client.mdx +122 -0
- package/docs/src/content/docs/reference/integration/exported-ssm-parameters.mdx +28 -0
- package/docs/src/content/docs/reference/network-address.mdx +54 -0
- package/docs/src/content/docs/{components/account-management/sop-account-setup.mdx → sop/account-setup.mdx} +2 -2
- package/docs/src/content/docs/{components/account-management/sop-add-account.mdx → sop/add-account.mdx} +3 -3
- package/docs/src/content/docs/sop/iam-identity-center-setup-external.mdx +46 -0
- package/docs/src/content/docs/sop/iam-identity-center-setup-internal.mdx +23 -0
- package/docs/src/content/docs/sop/iam-identity-center.mdx +43 -0
- package/docs/src/content/docs/sop/imgs/aws_sso_enable_iam_identity_center.png +0 -0
- package/docs/src/content/docs/sop/imgs/aws_sso_external_change.png +0 -0
- package/docs/src/content/docs/sop/imgs/aws_sso_external_disable_provisioning_1.png +0 -0
- package/docs/src/content/docs/sop/imgs/aws_sso_external_disable_provisioning_2.png +0 -0
- package/docs/src/content/docs/sop/imgs/aws_sso_external_idp_config.png +0 -0
- package/docs/src/content/docs/sop/imgs/aws_sso_external_select.png +0 -0
- package/docs/src/content/docs/sop/imgs/aws_sso_external_trusted_token_1.png +0 -0
- package/docs/src/content/docs/sop/imgs/aws_sso_external_trusted_token_2.png +0 -0
- package/docs/src/content/docs/sop/imgs/aws_sso_internal_select_identity_source.png +0 -0
- package/docs/src/content/docs/sop/imgs/aws_sso_settings_configure.png +0 -0
- package/docs/src/content/docs/sop/imgs/select_settings.png +0 -0
- package/docs/src/content/docs/{components/account-management/sop-initial-control-tower-setup.mdx → sop/initial-control-tower-setup.mdx} +7 -4
- package/docs-old/sop/Setting Up IAM Identity Center External/README.md +1 -1
- package/docs-old/sop/Setting Up IAM Identity Center Internal/README.md +1 -1
- 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-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.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.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 +1 -1
- package/docs/public/favicon.svg +0 -1
- package/docs/src/assets/houston.webp +0 -0
- package/docs/src/content/docs/components/account-management/service-deny-list.mdx +0 -58
- package/docs/src/content/docs/components/identity/introduction.mdx +0 -4
- /package/docs/src/content/docs/{components/account-management → sop}/imgs/account_factory_settings.png +0 -0
- /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_new_account_1.png +0 -0
- /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_new_account_2.png +0 -0
- /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_new_account_3.png +0 -0
- /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_new_account_4.png +0 -0
- /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_new_account_5.png +0 -0
- /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_organisation_ids_final.png +0 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Bastion Hosts
|
|
3
|
+
description: Bastion Hosts
|
|
4
|
+
---
|
|
5
|
+
import DualCode from '../../../../components/DualCode.astro';
|
|
6
|
+
|
|
7
|
+
The Data Landing Zone provides Bastion Hosts that can be accessed via AWS SSM Session Manager. This ensures secure
|
|
8
|
+
access without the need for SSH keys or an open inbound port in security group rules.
|
|
9
|
+
|
|
10
|
+
To add a Bastion Host to the `network` section of the configuration, the following properties are important:
|
|
11
|
+
- `name`: This is optional. If not specified, it defaults to `default`. You only need to provide a name if you have
|
|
12
|
+
multiple bastion hosts in the same stack (account and region combination).
|
|
13
|
+
- `location`: Specifies the **Subnet** [Network Address](/reference/network-address) to deploy the Bastion host in.
|
|
14
|
+
We recommend using a private subnet to reduce the attack surface. Ensure the private subnet has internet access
|
|
15
|
+
through a [NAT](nats).
|
|
16
|
+
- `instanceType`: Defines the size of the EC2 instance. The image used will be Amazon Linux 2023.
|
|
17
|
+
|
|
18
|
+
<DualCode>
|
|
19
|
+
<Fragment slot="ts">
|
|
20
|
+
```ts {24-30}
|
|
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
|
+
organization: {
|
|
27
|
+
...
|
|
28
|
+
ous: {
|
|
29
|
+
workloads: {
|
|
30
|
+
accounts: [{
|
|
31
|
+
name: 'development',
|
|
32
|
+
vpcs: [
|
|
33
|
+
Defaults.vpcClassB3Private3Public(0, Region.EU_WEST_1),
|
|
34
|
+
Defaults.vpcClassB3Private3Public(1, Region.US_EAST_1),
|
|
35
|
+
],
|
|
36
|
+
}
|
|
37
|
+
...
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
...
|
|
42
|
+
},
|
|
43
|
+
network: {
|
|
44
|
+
bastionHosts: [
|
|
45
|
+
{
|
|
46
|
+
name: 'default',
|
|
47
|
+
location: new NetworkAddress('development', Region.EU_WEST_1, 'default', 'private', 'private-1'),
|
|
48
|
+
instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.MICRO),
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
````
|
|
54
|
+
|
|
55
|
+
</Fragment>
|
|
56
|
+
<Fragment slot="python">
|
|
57
|
+
```python {24-34}
|
|
58
|
+
import aws_cdk as cdk
|
|
59
|
+
import aws_data_landing_zone as dlz
|
|
60
|
+
|
|
61
|
+
app = cdk.App()
|
|
62
|
+
dlz.DataLandingZone(app,
|
|
63
|
+
...
|
|
64
|
+
organization=dlz.DLzOrganization(
|
|
65
|
+
ous=dlz.OrgOus(
|
|
66
|
+
...
|
|
67
|
+
workloads=dlz.OrgOuWorkloads(
|
|
68
|
+
accounts=[
|
|
69
|
+
dlz.DLzAccount(
|
|
70
|
+
name='development',
|
|
71
|
+
vpcs: [
|
|
72
|
+
dlz.Defaults.vpc_class_b3_private3_public(0, dlz.Region.EU_WEST_1),
|
|
73
|
+
dlz.Defaults.vpc_class_b3_private3_public(1, dlz.Region.US_EAST_1),
|
|
74
|
+
]
|
|
75
|
+
...
|
|
76
|
+
),
|
|
77
|
+
],
|
|
78
|
+
),
|
|
79
|
+
),
|
|
80
|
+
network={
|
|
81
|
+
"bastion_hosts": [
|
|
82
|
+
{
|
|
83
|
+
"name": "default",
|
|
84
|
+
"location": NetworkAddress(
|
|
85
|
+
"development", str(Region.EU_WEST_1), "default", "public", "public-1",
|
|
86
|
+
),
|
|
87
|
+
"instance_type": ec2.InstanceType.of(
|
|
88
|
+
ec2.InstanceClass.T3, ec2.InstanceSize.MICRO
|
|
89
|
+
),
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
)
|
|
95
|
+
````
|
|
96
|
+
</Fragment>
|
|
97
|
+
</DualCode>
|
|
98
|
+
|
|
99
|
+
## Allowing a resource to be accessed via the Bastion Host
|
|
100
|
+
|
|
101
|
+
The Bastion Host restricts inbound traffic to its own security group. To allow a resource to be accessed through the
|
|
102
|
+
Bastion Host, you must add the Bastion Host’s security group to the security group of the resource you wish to access.
|
|
103
|
+
|
|
104
|
+
For example, to access a private RDS instance through the Bastion Host, you must include the Bastion Host’s security
|
|
105
|
+
group in the RDS instance’s security groups.
|
|
106
|
+
|
|
107
|
+
The Bastion host security group ID can be found in the AWS SSM Parameter Store under the following path:
|
|
108
|
+
```
|
|
109
|
+
dlz/bastion/${name}/security-group/id
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Here is an example of how this would look in CDK, as used in a Workload team's repository:
|
|
113
|
+
```typescript
|
|
114
|
+
// Create a security group for the RDS instance
|
|
115
|
+
const rdsSecurityGroup = new ec2.SecurityGroup(this, 'RdsSecurityGroup', {
|
|
116
|
+
description: 'Security group for RDS instance',
|
|
117
|
+
});
|
|
118
|
+
rdsSecurityGroup.addIngressRule(c2.Peer.anyIpv4(), ec2.Port.tcp(5432));
|
|
119
|
+
|
|
120
|
+
// Retrieve the Bastion security group ID from SSM Parameter Store, given its name is `default`
|
|
121
|
+
const bastionSecurityGroupId = ssm.StringParameter.valueForStringParameter(this, 'dlz/networking-entity/bastion/default/security-group/id');
|
|
122
|
+
|
|
123
|
+
// Import a construct of the Bastion Security group
|
|
124
|
+
const bastionSecurityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, 'BastionSecurityGroup', bastionSecurityGroupId);
|
|
125
|
+
|
|
126
|
+
// Attach the Bastion security group to the RDS instance
|
|
127
|
+
new rds.DatabaseInstance(this, 'MyRDS', {
|
|
128
|
+
...
|
|
129
|
+
securityGroups: [
|
|
130
|
+
rdsSecurityGroup,
|
|
131
|
+
bastionSecurityGroup <<<
|
|
132
|
+
],
|
|
133
|
+
...
|
|
134
|
+
});
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Accessing the Bastion Host
|
|
138
|
+
|
|
139
|
+
:::tip
|
|
140
|
+
Ensure the Bastion host can access AWS endpoints to use AWS SSM Session Manager. This can be achieved by allowing
|
|
141
|
+
communication over the internet (default). Alternatively, you can configure VPC endpoints for private VPC communication
|
|
142
|
+
and modify the security group of the Bastion Host to allow only traffic from within the VPC.
|
|
143
|
+
:::
|
|
144
|
+
|
|
145
|
+
You can access the Bastion host through the [AWS SSM Session Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html).
|
|
146
|
+
|
|
147
|
+
The following parameters are used in the scripts:
|
|
148
|
+
- `PROFILE` - The AWS CLI profile to use. Omit this if you are using environment variables instead (also remove --profile).
|
|
149
|
+
- `EC2_BASTION_ID` - The EC2 instance ID of the bastion host. This can be found manually using the CLI or Console.
|
|
150
|
+
- `RDS_ENDPOINT` - The RDS endpoint to connect to.
|
|
151
|
+
|
|
152
|
+
To open an SSH session to the Bastion host:
|
|
153
|
+
```bash
|
|
154
|
+
PROFILE=""
|
|
155
|
+
EC2_BASTION_ID=""
|
|
156
|
+
|
|
157
|
+
aws ssm start-session \
|
|
158
|
+
--profile "$PROFILE" \
|
|
159
|
+
--target "EC2_BASTION_ID"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
While accessing the Bastion host directly is useful for running commands on the host, it is typically more effective
|
|
163
|
+
for port forwarding to access resources within the VPC. The following command forwards local port 5432 to the RDS
|
|
164
|
+
port 5432, which is located in a private subnet.
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
PROFILE=""
|
|
168
|
+
INSTANCE_ID=""
|
|
169
|
+
RDS_ENDPOINT=""
|
|
170
|
+
PORT=5432
|
|
171
|
+
|
|
172
|
+
aws ssm start-session \
|
|
173
|
+
--profile "$PROFILE" \
|
|
174
|
+
--target "$INSTANCE_ID" \
|
|
175
|
+
--document-name AWS-StartPortForwardingSessionToRemoteHost \
|
|
176
|
+
--parameters "{\"host\":[\"$RDS_ENDPOINT\"],\"portNumber\":[\"$PORT\"],\"localPortNumber\":[\"$PORT\"]}"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
You can now connect to the RDS instance with a local GUI by specifying `localhost` as the address and `5432` as the port.
|
|
180
|
+
|
|
181
|
+
## Exported SSM Parameters
|
|
182
|
+
|
|
183
|
+
Each Bastion Host creates the following parameters in the SSM Parameter Store:
|
|
184
|
+
- `/dlz/networking-entity/bastion/<bastion-name>/security-group/id`: This is the Security Group ID associated with the
|
|
185
|
+
Security Group created for the Bastion Host.
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
## API References
|
|
189
|
+
- [BastionHost](/reference/api/#bastionhost)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: NATs
|
|
3
|
+
description: NATs
|
|
4
|
+
---
|
|
5
|
+
import DualCode from '../../../../components/DualCode.astro';
|
|
6
|
+
|
|
7
|
+
The Data Landing Zone offers support for creating Gateway and Instance Network Address Translators (NATs) within
|
|
8
|
+
a VPC. To create a NAT, specify the following parameters:
|
|
9
|
+
|
|
10
|
+
- `location`: The **Subnet** [Network Address](/reference/network-address) that defines where the NAT will be deployed.
|
|
11
|
+
- `allowAccessFrom`: The **Route Table** [Network Address](/reference/network-address) specifies what should route
|
|
12
|
+
traffic through the NAT.
|
|
13
|
+
- `type`: The type of NAT (Gateway or Instance), including any additional properties needed for the selected NAT type.
|
|
14
|
+
For example, the `instanceType` for NAT instances.
|
|
15
|
+
|
|
16
|
+
The following example configures:
|
|
17
|
+
- One account named `development` with two VPCs: one in the `eu-west-1` region and the other in the `us-east-1` region.
|
|
18
|
+
- One NAT **Gateway** in the `eu-west-1` region public subnet of the development account, routing all outbound private
|
|
19
|
+
subnet traffic through it.
|
|
20
|
+
- One NAT **Instance** in the `us-east-1` region public subnet of the development account, routing all outbound private
|
|
21
|
+
subnet traffic through it.
|
|
22
|
+
|
|
23
|
+
:::note
|
|
24
|
+
The `allowAccessFrom` Network Address must be within the same VPC. This restriction will be lifted once Transit Gateway
|
|
25
|
+
support is added.
|
|
26
|
+
:::
|
|
27
|
+
|
|
28
|
+
<DualCode>
|
|
29
|
+
<Fragment slot="ts">
|
|
30
|
+
```ts {24-50}
|
|
31
|
+
import {App} from 'aws-cdk-lib';
|
|
32
|
+
import { DataLandingZone } from 'aws-data-landing-zone';
|
|
33
|
+
|
|
34
|
+
const app = new App();
|
|
35
|
+
const dlz = new DataLandingZone(app, {
|
|
36
|
+
organization: {
|
|
37
|
+
...
|
|
38
|
+
ous: {
|
|
39
|
+
workloads: {
|
|
40
|
+
accounts: [{
|
|
41
|
+
name: 'development',
|
|
42
|
+
vpcs: [
|
|
43
|
+
Defaults.vpcClassB3Private3Public(0, Region.EU_WEST_1),
|
|
44
|
+
Defaults.vpcClassB3Private3Public(1, Region.US_EAST_1),
|
|
45
|
+
],
|
|
46
|
+
}
|
|
47
|
+
...
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
...
|
|
52
|
+
},
|
|
53
|
+
network: {
|
|
54
|
+
nats: [
|
|
55
|
+
{
|
|
56
|
+
name: "development-eu-west-1-internet-access",
|
|
57
|
+
location: new NetworkAddress('development', Region.EU_WEST_1, 'default', 'public', 'public-1'),
|
|
58
|
+
allowAccessFrom: [
|
|
59
|
+
new NetworkAddress('development', Region.EU_WEST_1, 'default', 'private')
|
|
60
|
+
],
|
|
61
|
+
type: {
|
|
62
|
+
gateway: {
|
|
63
|
+
eip: ... //Optional
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'development-us-east-1-internet-access',
|
|
69
|
+
location: new NetworkAddress('development', Region.US_EAST_1, 'default', 'public', 'public-1'),
|
|
70
|
+
allowAccessFrom: [
|
|
71
|
+
new NetworkAddress('development', Region.US_EAST_1, 'default', 'private'),
|
|
72
|
+
],
|
|
73
|
+
type: {
|
|
74
|
+
instance: {
|
|
75
|
+
instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.MICRO),
|
|
76
|
+
eip: ... //Optional
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
````
|
|
84
|
+
|
|
85
|
+
</Fragment>
|
|
86
|
+
<Fragment slot="python">
|
|
87
|
+
```python {24-58}
|
|
88
|
+
import aws_cdk as cdk
|
|
89
|
+
import aws_data_landing_zone as dlz
|
|
90
|
+
|
|
91
|
+
app = cdk.App()
|
|
92
|
+
dlz.DataLandingZone(app,
|
|
93
|
+
...
|
|
94
|
+
organization=dlz.DLzOrganization(
|
|
95
|
+
ous=dlz.OrgOus(
|
|
96
|
+
...
|
|
97
|
+
workloads=dlz.OrgOuWorkloads(
|
|
98
|
+
accounts=[
|
|
99
|
+
dlz.DLzAccount(
|
|
100
|
+
name='development',
|
|
101
|
+
vpcs: [
|
|
102
|
+
dlz.Defaults.vpc_class_b3_private3_public(0, dlz.Region.EU_WEST_1),
|
|
103
|
+
dlz.Defaults.vpc_class_b3_private3_public(1, dlz.Region.US_EAST_1),
|
|
104
|
+
]
|
|
105
|
+
...
|
|
106
|
+
),
|
|
107
|
+
],
|
|
108
|
+
),
|
|
109
|
+
),
|
|
110
|
+
network={
|
|
111
|
+
"nats": [
|
|
112
|
+
{
|
|
113
|
+
"name": "development-eu-west-1-internet-access",
|
|
114
|
+
"location": NetworkAddress(
|
|
115
|
+
"development", str(Region.EU_WEST_1), "default", "public", "public-1",
|
|
116
|
+
),
|
|
117
|
+
"allow_access_from": [
|
|
118
|
+
NetworkAddress(
|
|
119
|
+
"development", str(Region.EU_WEST_1), "default", "private"
|
|
120
|
+
),
|
|
121
|
+
],
|
|
122
|
+
"type": {
|
|
123
|
+
"instance": {
|
|
124
|
+
"instance_type": ec2.InstanceType.of(
|
|
125
|
+
ec2.InstanceClass.T3, ec2.InstanceSize.MICRO
|
|
126
|
+
),
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "development-us-east-1-internet-access",
|
|
132
|
+
"location": NetworkAddress(
|
|
133
|
+
"development", str(Region.US_EAST_1), "default", "public", "public-1",
|
|
134
|
+
),
|
|
135
|
+
"allow_access_from": [
|
|
136
|
+
NetworkAddress(
|
|
137
|
+
"development", str(Region.US_EAST_1), "default", "private"
|
|
138
|
+
),
|
|
139
|
+
],
|
|
140
|
+
"type": {
|
|
141
|
+
"gateway": {
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
)
|
|
149
|
+
````
|
|
150
|
+
</Fragment>
|
|
151
|
+
</DualCode>
|
|
152
|
+
|
|
153
|
+
Each NAT configuration includes the following:
|
|
154
|
+
- A single Internet Gateway
|
|
155
|
+
- A NAT Gateway or Instance
|
|
156
|
+
- Routes in the route table of the NATs pointing all outbound traffic (`0.0.0.0/0`) to the Internet Gateway
|
|
157
|
+
- Routes in the route table of all the `from` addresses, pointing all outbound traffic (`0.0.0.0/0`) to the NAT Gateway
|
|
158
|
+
or Instance.
|
|
159
|
+
|
|
160
|
+
## Configuration examples
|
|
161
|
+
|
|
162
|
+
### Single NAT Gateway in the public subnet
|
|
163
|
+
|
|
164
|
+
The default VPC includes two Route Tables, one private and one public, as defined by the `Defaults.vpcClassB3Private3Public`
|
|
165
|
+
function. In the configuration below, the NAT is placed in the `public-1` subnet, and the `private` route table is set to
|
|
166
|
+
route all outbound traffic through the NAT.
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
const config: DataLandingZoneProps = {
|
|
170
|
+
...configBase,
|
|
171
|
+
network: {
|
|
172
|
+
nats: [
|
|
173
|
+
{
|
|
174
|
+
name: "development-eu-west-1-internet-access",
|
|
175
|
+
location: new NetworkAddress('development', Region.EU_WEST_1, 'default', 'public', 'public-1'),
|
|
176
|
+
allowAccessFrom: [
|
|
177
|
+
new NetworkAddress('development', Region.EU_WEST_1, 'default', 'private')
|
|
178
|
+
],
|
|
179
|
+
type: {
|
|
180
|
+
gateway: {}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+

|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
### NAT Gateway per AZ
|
|
192
|
+
|
|
193
|
+
Since the Default VPC function creates a single public and private route table we can not make use of it. This example
|
|
194
|
+
configures the VPC with separate route tables for each Availability Zone (AZ). This ensures that the NAT in each public
|
|
195
|
+
subnet AZ can route traffic from the private subnets within the same AZ.
|
|
196
|
+
|
|
197
|
+
This setup ensures no traffic leaves the AZ, creating a Highly Available and Resilient architecture.
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
<DualCode>
|
|
201
|
+
<Fragment slot="ts">
|
|
202
|
+
```ts
|
|
203
|
+
import {App} from 'aws-cdk-lib';
|
|
204
|
+
import { DataLandingZone } from 'aws-data-landing-zone';
|
|
205
|
+
|
|
206
|
+
const app = new App();
|
|
207
|
+
const dlz = new DataLandingZone(app, {
|
|
208
|
+
organization: {
|
|
209
|
+
...
|
|
210
|
+
ous: {
|
|
211
|
+
workloads: {
|
|
212
|
+
accounts: [{
|
|
213
|
+
name: 'development',
|
|
214
|
+
vpcs: [
|
|
215
|
+
{
|
|
216
|
+
name: 'default',
|
|
217
|
+
region: Region.US_EAST_1,,
|
|
218
|
+
cidr: '10.0.0.0/16',
|
|
219
|
+
routeTables: [
|
|
220
|
+
{
|
|
221
|
+
name: 'private-1',
|
|
222
|
+
subnets: [
|
|
223
|
+
{
|
|
224
|
+
name: 'private-1',
|
|
225
|
+
cidr: '10.0.0.0/19',
|
|
226
|
+
az: 'us-east-1a',
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'private-2',
|
|
232
|
+
subnets: [
|
|
233
|
+
{
|
|
234
|
+
name: 'private-2',
|
|
235
|
+
cidr: '10.0.32.0/19',
|
|
236
|
+
az: 'us-east-1b',
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: 'private-3',
|
|
242
|
+
subnets: [
|
|
243
|
+
{
|
|
244
|
+
name: 'private-3',
|
|
245
|
+
cidr: '10.0.64.0/19',
|
|
246
|
+
az: 'us-east-1b',
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
{
|
|
252
|
+
name: 'public-1',
|
|
253
|
+
subnets: [
|
|
254
|
+
{
|
|
255
|
+
name: 'public-1',
|
|
256
|
+
cidr: '10.0.96.0/19',
|
|
257
|
+
az: 'us-east-1a',
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: 'public-2',
|
|
263
|
+
subnets: [
|
|
264
|
+
{
|
|
265
|
+
name: 'public-2',
|
|
266
|
+
cidr: '10.0.128.0/19',
|
|
267
|
+
az: 'us-east-1b',
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: 'public-3',
|
|
273
|
+
subnets: [
|
|
274
|
+
{
|
|
275
|
+
name: 'public-3',
|
|
276
|
+
cidr: '10.0.160.0/19',
|
|
277
|
+
az: 'us-east-1c',
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
}
|
|
285
|
+
...
|
|
286
|
+
]
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
...
|
|
290
|
+
},
|
|
291
|
+
network: {
|
|
292
|
+
nats: [
|
|
293
|
+
{
|
|
294
|
+
name: "development-us-east-1-internet-access-AZ-a",
|
|
295
|
+
location: new NetworkAddress('development', Region.US_EAST_1, 'default', 'public', 'public-1'),
|
|
296
|
+
allowAccessFrom: [
|
|
297
|
+
new NetworkAddress('development', Region.US_EAST_1, 'default', 'private-1')
|
|
298
|
+
],
|
|
299
|
+
type: {
|
|
300
|
+
gateway: {}
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: "development-us-east-1-internet-access-AZ-b",
|
|
305
|
+
location: new NetworkAddress('development', Region.US_EAST_1, 'default', 'public', 'public-2'),
|
|
306
|
+
allowAccessFrom: [
|
|
307
|
+
new NetworkAddress('development', Region.US_EAST_1, 'default', 'private-2')
|
|
308
|
+
],
|
|
309
|
+
type: {
|
|
310
|
+
gateway: {}
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: "development-us-east-1-internet-access-AZ-c",
|
|
315
|
+
location: new NetworkAddress('development', Region.US_EAST_1, 'default', 'public', 'public-3'),
|
|
316
|
+
allowAccessFrom: [
|
|
317
|
+
new NetworkAddress('development', Region.US_EAST_1, 'default', 'private-3')
|
|
318
|
+
],
|
|
319
|
+
type: {
|
|
320
|
+
gateway: {}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
);
|
|
326
|
+
```
|
|
327
|
+
</Fragment>
|
|
328
|
+
<Fragment slot="python">
|
|
329
|
+
```python
|
|
330
|
+
import aws_cdk as cdk
|
|
331
|
+
import aws_data_landing_zone as dlz
|
|
332
|
+
|
|
333
|
+
app = cdk.App()
|
|
334
|
+
dlz.DataLandingZone(app,
|
|
335
|
+
...
|
|
336
|
+
organization=dlz.DLzOrganization(
|
|
337
|
+
ous=dlz.OrgOus(
|
|
338
|
+
...
|
|
339
|
+
workloads=dlz.OrgOuWorkloads(
|
|
340
|
+
accounts=[
|
|
341
|
+
dlz.DLzAccount(
|
|
342
|
+
name='development',
|
|
343
|
+
vpcs: [
|
|
344
|
+
{
|
|
345
|
+
"name": "default",
|
|
346
|
+
"region": region,
|
|
347
|
+
"cidr": "10.0.0.0/16",
|
|
348
|
+
"route_tables": [
|
|
349
|
+
{
|
|
350
|
+
"name": "private-1",
|
|
351
|
+
"subnets": [
|
|
352
|
+
{
|
|
353
|
+
"name": "private-1",
|
|
354
|
+
"cidr": "10.0.0.0/19",
|
|
355
|
+
"az": "us-east-1a",
|
|
356
|
+
},
|
|
357
|
+
],
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"name": "private-2",
|
|
361
|
+
"subnets": [
|
|
362
|
+
{
|
|
363
|
+
"name": "private-2",
|
|
364
|
+
"cidr": "10.0.32.0/19",
|
|
365
|
+
"az": "us-east-1b",
|
|
366
|
+
},
|
|
367
|
+
],
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"name": "private-3",
|
|
371
|
+
"subnets": [
|
|
372
|
+
{
|
|
373
|
+
"name": "private-3",
|
|
374
|
+
"cidr": "10.0.64.0/19",
|
|
375
|
+
"az": "us-east-1b",
|
|
376
|
+
},
|
|
377
|
+
],
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"name": "public-1",
|
|
381
|
+
"subnets": [
|
|
382
|
+
{
|
|
383
|
+
"name": "public-1",
|
|
384
|
+
"cidr": "10.0.96.0/19",
|
|
385
|
+
"az": "us-east-1a",
|
|
386
|
+
},
|
|
387
|
+
],
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"name": "public-2",
|
|
391
|
+
"subnets": [
|
|
392
|
+
{
|
|
393
|
+
"name": "public-2",
|
|
394
|
+
"cidr": "10.0.128.0/19",
|
|
395
|
+
"az": "us-east-1b",
|
|
396
|
+
},
|
|
397
|
+
],
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"name": "public-3",
|
|
401
|
+
"subnets": [
|
|
402
|
+
{
|
|
403
|
+
"name": "public-3",
|
|
404
|
+
"cidr": "10.0.160.0/19",
|
|
405
|
+
"az": "us-east-1c",
|
|
406
|
+
},
|
|
407
|
+
],
|
|
408
|
+
},
|
|
409
|
+
],
|
|
410
|
+
}
|
|
411
|
+
]
|
|
412
|
+
...
|
|
413
|
+
),
|
|
414
|
+
],
|
|
415
|
+
),
|
|
416
|
+
),
|
|
417
|
+
network={
|
|
418
|
+
"nats": [
|
|
419
|
+
{
|
|
420
|
+
name: "development-us-east-1-internet-access-AZ-a",
|
|
421
|
+
location: new NetworkAddress('development', Region.US_EAST_1, 'default', 'public', 'public-1'),
|
|
422
|
+
allowAccessFrom: [
|
|
423
|
+
new NetworkAddress('development', Region.US_EAST_1, 'default', 'private-1')
|
|
424
|
+
],
|
|
425
|
+
type: {
|
|
426
|
+
gateway: {}
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "development-us-east-1-internet-access-AZ-b",
|
|
431
|
+
location: new NetworkAddress('development', Region.US_EAST_1, 'default', 'public', 'public-2'),
|
|
432
|
+
allowAccessFrom: [
|
|
433
|
+
new NetworkAddress('development', Region.US_EAST_1, 'default', 'private-2')
|
|
434
|
+
],
|
|
435
|
+
type: {
|
|
436
|
+
gateway: {}
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
name: "development-us-east-1-internet-access-AZ-c",
|
|
441
|
+
location: new NetworkAddress('development', Region.US_EAST_1, 'default', 'public', 'public-3'),
|
|
442
|
+
allowAccessFrom: [
|
|
443
|
+
new NetworkAddress('development', Region.US_EAST_1, 'default', 'private-3')
|
|
444
|
+
],
|
|
445
|
+
type: {
|
|
446
|
+
gateway: {}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
],
|
|
450
|
+
}
|
|
451
|
+
),
|
|
452
|
+
)
|
|
453
|
+
```
|
|
454
|
+
</Fragment>
|
|
455
|
+
</DualCode>
|
|
456
|
+
|
|
457
|
+

|
|
458
|
+
|
|
459
|
+
## API References
|
|
460
|
+
- [NetworkNat](https://datalandingzone.com/reference/api/#networknat)
|
|
461
|
+
- [NetworkNatGateway](https://datalandingzone.com/reference/api/#networknatgateway)
|
|
462
|
+
- [NetworkNatInstance](https://datalandingzone.com/reference/api/#networknatinstance)
|