aws-data-landing-zone 0.0.42 → 0.0.43

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.
Files changed (93) hide show
  1. package/.jsii +2 -2
  2. package/docs/astro.config.ts +47 -36
  3. package/docs/public/favicon.png +0 -0
  4. package/docs/src/content/docs/components/account-management/accounts.mdx +1 -1
  5. package/docs/src/content/docs/components/identity/iam-identity-center.mdx +148 -0
  6. package/docs/src/content/docs/components/networking/bastion-hosts.mdx +189 -0
  7. package/docs/src/content/docs/components/networking/imgs/nat_1.png +0 -0
  8. package/docs/src/content/docs/components/networking/imgs/nat_2.png +0 -0
  9. package/docs/src/content/docs/components/networking/imgs/vpt_1.png +0 -0
  10. package/docs/src/content/docs/components/networking/imgs/vpt_2.png +0 -0
  11. package/docs/src/content/docs/components/networking/imgs/vpt_3.png +0 -0
  12. package/docs/src/content/docs/components/networking/imgs/vpt_4.png +0 -0
  13. package/docs/src/content/docs/components/networking/imgs/vpt_5.png +0 -0
  14. package/docs/src/content/docs/components/networking/nats.mdx +462 -0
  15. package/docs/src/content/docs/components/networking/vpc-peering.mdx +313 -0
  16. package/docs/src/content/docs/components/networking/vpcs.mdx +284 -0
  17. package/docs/src/content/docs/components/security/control-tower-controls.mdx +66 -0
  18. package/docs/src/content/docs/components/security/iam-permission-boundary.mdx +70 -0
  19. package/docs/src/content/docs/components/security/security-hub.mdx +123 -0
  20. package/docs/src/content/docs/components/security/service-deny-list.mdx +59 -0
  21. package/docs/src/content/docs/getting-started.mdx +2 -2
  22. package/docs/src/content/docs/index.mdx +2 -2
  23. package/docs/src/content/docs/introduction.mdx +134 -49
  24. package/docs/src/content/docs/reference/defaults.mdx +9 -0
  25. package/docs/src/content/docs/reference/extending-and-escape-hatches.mdx +50 -0
  26. package/docs/src/content/docs/reference/integration/cdk-client.mdx +122 -0
  27. package/docs/src/content/docs/reference/integration/exported-ssm-parameters.mdx +28 -0
  28. package/docs/src/content/docs/reference/network-address.mdx +54 -0
  29. package/docs/src/content/docs/{components/account-management/sop-account-setup.mdx → sop/account-setup.mdx} +2 -2
  30. package/docs/src/content/docs/{components/account-management/sop-add-account.mdx → sop/add-account.mdx} +3 -3
  31. package/docs/src/content/docs/sop/iam-identity-center-setup-external.mdx +46 -0
  32. package/docs/src/content/docs/sop/iam-identity-center-setup-internal.mdx +23 -0
  33. package/docs/src/content/docs/sop/iam-identity-center.mdx +43 -0
  34. package/docs/src/content/docs/sop/imgs/aws_sso_enable_iam_identity_center.png +0 -0
  35. package/docs/src/content/docs/sop/imgs/aws_sso_external_change.png +0 -0
  36. package/docs/src/content/docs/sop/imgs/aws_sso_external_disable_provisioning_1.png +0 -0
  37. package/docs/src/content/docs/sop/imgs/aws_sso_external_disable_provisioning_2.png +0 -0
  38. package/docs/src/content/docs/sop/imgs/aws_sso_external_idp_config.png +0 -0
  39. package/docs/src/content/docs/sop/imgs/aws_sso_external_select.png +0 -0
  40. package/docs/src/content/docs/sop/imgs/aws_sso_external_trusted_token_1.png +0 -0
  41. package/docs/src/content/docs/sop/imgs/aws_sso_external_trusted_token_2.png +0 -0
  42. package/docs/src/content/docs/sop/imgs/aws_sso_internal_select_identity_source.png +0 -0
  43. package/docs/src/content/docs/sop/imgs/aws_sso_settings_configure.png +0 -0
  44. package/docs/src/content/docs/sop/imgs/select_settings.png +0 -0
  45. package/docs/src/content/docs/{components/account-management/sop-initial-control-tower-setup.mdx → sop/initial-control-tower-setup.mdx} +7 -4
  46. package/docs-old/sop/Setting Up IAM Identity Center External/README.md +1 -1
  47. package/docs-old/sop/Setting Up IAM Identity Center Internal/README.md +1 -1
  48. package/lib/constructs/account-chatbots/index.js +1 -1
  49. package/lib/constructs/dlz-budget/index.js +1 -1
  50. package/lib/constructs/dlz-control-tower-control/control-tower-control.js +1 -1
  51. package/lib/constructs/dlz-lake-formation/dlz-lake-formation.js +1 -1
  52. package/lib/constructs/dlz-ssm-reader/dlz-ssm-reader-stack-cache.js +1 -1
  53. package/lib/constructs/dlz-ssm-reader/dlz-ssm-reader.js +1 -1
  54. package/lib/constructs/dlz-stack/index.js +1 -1
  55. package/lib/constructs/dlz-vpc/dlz-account-networks.js +1 -1
  56. package/lib/constructs/dlz-vpc/dlz-vpc.js +1 -1
  57. package/lib/constructs/dlz-vpc/network-address.js +1 -1
  58. package/lib/constructs/iam-identity-center/iam-identity-center-group.js +1 -1
  59. package/lib/constructs/iam-identity-center/iam-identity-center.js +1 -1
  60. package/lib/constructs/iam-identity-center/identity-store-user.js +1 -1
  61. package/lib/constructs/organization-policies/service-control-policy.js +1 -1
  62. package/lib/constructs/organization-policies/tag-policy.js +1 -1
  63. package/lib/data-landing-zone-client.js +1 -1
  64. package/lib/data-landing-zone.js +1 -1
  65. package/lib/defaults.js +1 -1
  66. package/lib/lib/report/index.js +1 -1
  67. package/lib/scripts/index.js +1 -1
  68. package/lib/stacks/organization/management-stack.js +1 -1
  69. package/lib/stacks/organization/security/audit/global-stack.js +1 -1
  70. package/lib/stacks/organization/security/audit/regional-stack.js +1 -1
  71. package/lib/stacks/organization/security/log/global-stack.js +1 -1
  72. package/lib/stacks/organization/security/log/regional-stack.js +1 -1
  73. package/lib/stacks/organization/workloads/base/global-stack.js +1 -1
  74. package/lib/stacks/organization/workloads/base/regional-stack.js +1 -1
  75. package/lib/stacks/organization/workloads/data-services-phase-1-stack/global-stack.js +1 -1
  76. package/lib/stacks/organization/workloads/data-services-phase-1-stack/regional-stack.js +1 -1
  77. package/lib/stacks/organization/workloads/network-connections-phase-1-stack/global-stack.js +1 -1
  78. package/lib/stacks/organization/workloads/network-connections-phase-2-stack/global-stack.js +1 -1
  79. package/lib/stacks/organization/workloads/network-connections-phase-2-stack/regional-stack.js +1 -1
  80. package/lib/stacks/organization/workloads/network-connections-phase-3-stack/global-stack.js +1 -1
  81. package/lib/stacks/organization/workloads/network-connections-phase-3-stack/regional-stack.js +1 -1
  82. package/package.json +1 -1
  83. package/docs/public/favicon.svg +0 -1
  84. package/docs/src/assets/houston.webp +0 -0
  85. package/docs/src/content/docs/components/account-management/service-deny-list.mdx +0 -58
  86. package/docs/src/content/docs/components/identity/introduction.mdx +0 -4
  87. /package/docs/src/content/docs/{components/account-management → sop}/imgs/account_factory_settings.png +0 -0
  88. /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_new_account_1.png +0 -0
  89. /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_new_account_2.png +0 -0
  90. /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_new_account_3.png +0 -0
  91. /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_new_account_4.png +0 -0
  92. /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_new_account_5.png +0 -0
  93. /package/docs/src/content/docs/{components/account-management → sop}/imgs/aws_organisation_ids_final.png +0 -0
package/.jsii CHANGED
@@ -13221,6 +13221,6 @@
13221
13221
  "symbolId": "src/stacks/organization/workloads/base/regional-stack:WorkloadRegionalStack"
13222
13222
  }
13223
13223
  },
13224
- "version": "0.0.42",
13225
- "fingerprint": "BV8Ldu8YH7WGXw7nsHWfp6Ug3zaxWkZbicYMtYy8OFg="
13224
+ "version": "0.0.43",
13225
+ "fingerprint": "77d+cqIU547CZVMWp7vOSkPCjSoq7a6a2I9Lw/WDak8="
13226
13226
  }
@@ -22,6 +22,7 @@ export default defineConfig({
22
22
  },
23
23
  integrations: [starlight({
24
24
  title: 'Data Landing Zone',
25
+ favicon: 'favicon.png',
25
26
  components: {
26
27
  Footer: './src/components/Footer.astro',
27
28
  },
@@ -57,41 +58,35 @@ export default defineConfig({
57
58
  { label: 'Tagging', slug: 'components/account-management/tagging'},
58
59
  { label: 'Budgets', slug: 'components/account-management/budgets'},
59
60
  // { label: 'Default Notifications', slug: 'components/account-management/budgets'}, //TODO Later
60
- { label: 'SOP - Initial Control Tower Setup', slug: 'components/account-management/sop-initial-control-tower-setup'},
61
- { label: 'SOP - Add Account', slug: 'components/account-management/sop-add-account'},
62
- { label: 'SOP - Account Setup', slug: 'components/account-management/sop-account-setup'},
63
61
  ]
64
62
  },
65
- // {
66
- // label: 'Networking',
67
- // items: [
68
- // { label: 'Overview', slug: 'introduction'},
69
- // { label: 'VPCs', slug: 'introduction'},
70
- // { label: 'NATs', slug: 'introduction'},
71
- // { label: 'Bastion Hosts', slug: 'introduction'},
72
- // { label: 'VPC Peering', slug: 'introduction'},
73
- // ]
74
- // },
75
- // {
76
- // label: 'Security',
77
- // items: [
78
- // { label: 'Overview', slug: 'introduction'},
79
- // { label: 'Service Control Policies', slug: 'introduction'}, // Mention the service deny list
80
- // { label: 'Permission Boundary', slug: 'introduction'},
81
- // { label: 'SecurityHub', slug: 'introduction'},
82
- // { label: 'Control Tower Controls', slug: 'introduction'},
83
- // { label: 'AWS Config', slug: 'introduction'},
84
- // { label: 'AWS Guard Duty', slug: 'introduction'},
85
- // { label: 'AWS Macie', slug: 'introduction'},
86
- // ]
87
- // },
88
- // {
89
- // label: 'Identity',
90
- // items: [
91
- // { label: 'Overview', slug: 'introduction'},
92
- // { label: 'Iam Identity Center', slug: 'introduction'},
93
- // ]
94
- // },
63
+ {
64
+ label: 'Networking',
65
+ items: [
66
+ { label: 'VPCs', slug: 'components/networking/vpcs'},
67
+ { label: 'NATs', slug: 'components/networking/nats'},
68
+ { label: 'Bastion Hosts', slug: 'components/networking/bastion-hosts'},
69
+ { label: 'VPC Peering', slug: 'components/networking/vpc-peering'},
70
+ ]
71
+ },
72
+ {
73
+ label: 'Security',
74
+ items: [
75
+ { label: 'SecurityHub', slug: 'components/security/security-hub'},
76
+ { label: 'Control Tower Controls', slug: 'components/security/control-tower-controls'},
77
+ { label: 'Service Deny Lists', slug: 'components/security/service-deny-list'}, // Change to SCPs when we support them externally and make the deny list a subheading
78
+ { label: 'IAM Permission Boundary', slug: 'components/security/iam-permission-boundary'},
79
+ // { label: 'AWS Config', slug: 'introduction'},
80
+ // { label: 'AWS Guard Duty', slug: 'introduction'},
81
+ // { label: 'AWS Macie', slug: 'introduction'},
82
+ ]
83
+ },
84
+ {
85
+ label: 'Identity',
86
+ items: [
87
+ { label: 'Iam Identity Center', slug: 'components/identity/iam-identity-center'},
88
+ ]
89
+ },
95
90
  {
96
91
  label: 'Data Services',
97
92
  items: [
@@ -109,17 +104,33 @@ export default defineConfig({
109
104
  }
110
105
  ],
111
106
  },
107
+ {
108
+ label: 'Integration',
109
+ items: [
110
+ { label: 'Exported SSM Parameters', slug: 'reference/integration/exported-ssm-parameters'},
111
+ { label: 'CDK Client', slug: 'reference/integration/cdk-client'},
112
+ ]
113
+ },
114
+ {
115
+ label: 'SOPs',
116
+ items: [
117
+ { label: 'Initial Control Tower Setup', slug: 'sop/initial-control-tower-setup'},
118
+ { label: 'Add Account', slug: 'sop/add-account'},
119
+ { label: 'Account Setup', slug: 'sop/account-setup'},
120
+ { label: 'IAM Identity Center', slug: 'sop/iam-identity-center'},
121
+ ]
122
+ },
112
123
  {
113
124
  label: 'Reference',
114
125
  items: [
115
126
  // TODO: Complete docs
116
127
  { label: 'API', slug: 'reference/api'},
117
128
  { label: 'Defaults', slug: 'reference/defaults'},
118
- // { label: 'Config sharing', slug: 'introduction'},
119
129
  { label: 'Scripts & commands', slug: 'reference/scripts-commands' },
130
+ { label: 'Extending and Escape Hatches', slug: 'reference/extending-and-escape-hatches'},
120
131
  { label: 'Lake Formation TBAC strategy', slug: 'reference/lake-formation-tbac-recommended-strategy' },
121
- // { label: 'Roadmap', slug: 'introduction'},
122
- // { label: 'Escape Hatches', slug: 'introduction'}, // How to extend and modify/add components
132
+ { label: 'Network Address', slug: 'reference/network-address'},
133
+ // { label: 'Roadmap', slug: 'introduction'},
123
134
  ]
124
135
  },
125
136
 
Binary file
@@ -35,7 +35,7 @@ Each account is classified as one of the following types:
35
35
  - `DlzAccountType.DEVELOP` - Accounts with fewer security restrictions, designed to enhance the developer experience.
36
36
  - `DlzAccountType.PRODUCTION` - Accounts requiring tight security measures, used for hosting production workloads.
37
37
 
38
- To begin, follow the [SOP - Initial Control Tower Setup](sop-initial-control-tower-setup) guide to enable Control
38
+ To begin, follow the [SOP - Initial Control Tower Setup](/sop/initial-control-tower-setup) guide to enable Control
39
39
  Tower, configure the AWS Organization, and create the required OUs. The final step,
40
40
  [Gather the required information for DLZ](sop-initial-control-tower-setup#gather-the-required-information-for-dlz),
41
41
  provides instructions for identifying and copying the necessary Organization ID, OU IDs, and Account IDs.
@@ -0,0 +1,148 @@
1
+ ---
2
+ title: IAM Identity Center
3
+ description: IAM Identity Center
4
+ ---
5
+ import DualCode from '../../../../components/DualCode.astro';
6
+
7
+ AWS IAM Identity Center (formerly AWS Single Sign-On) is a service that simplifies access management by enabling
8
+ centralized user sign-in and permissions for AWS accounts and applications. It integrates with external identity
9
+ providers (IdPs) or the internal Identity Center directory to manage users and authentication. This provides a unified
10
+ way to assign and enforce access permissions.
11
+
12
+ The Data Landing Zone does not create an IAM Identity Center instance but integrates with an existing one. Once the
13
+ required IDs are provided to the DLZ construct, it manages users, permissions, and thier account assignment
14
+ within the IAM Identity Center.
15
+
16
+ Refer to the [SOP - IAM Identity Center Setup](/sop/iam-identity-center) for detailed instructions on setting up IAM
17
+ Identity Center and providing the necessary IDs to the DLZ configuration.
18
+
19
+ :::note
20
+ The email address must be used as the username. If an external IdP is used, the email address must match the one in the IdP.
21
+ :::
22
+
23
+ Users can be added to access groups, which are assigned permission sets. Permission sets can be created from managed
24
+ policies or inline policies. Access groups support wildcards for account names, making it easy to assign permissions
25
+ across multiple accounts.
26
+
27
+ The example below assigns the `AdministratorAccess` permission set (created by
28
+ `...Defaults.iamIdentityCenterPermissionSets()`) to the user `you@org.com` in all accounts, as specified by the wildcard
29
+ `*`.
30
+
31
+ <DualCode>
32
+ <Fragment slot="ts">
33
+ ```ts
34
+ import {App} from 'aws-cdk-lib';
35
+ import { DataLandingZone } from 'aws-data-landing-zone';
36
+
37
+ const app = new App();
38
+ const dlz = new DataLandingZone(app, {
39
+ iamIdentityCenter: {
40
+ arn: 'IdentityCenterARN',
41
+ id: 'IdentityCenterID',
42
+ storeId: 'StoreID',
43
+ users: [
44
+ {
45
+ userName: 'you@org.com',
46
+ name: 'Name',
47
+ surname: 'LastName',
48
+ },
49
+ ],
50
+ permissionSets: [
51
+ // Provides the AWS managed policy `AdministratorAccess` and `ReadOnlyAccess` as permission sets
52
+ ...Defaults.iamIdentityCenterPermissionSets(),
53
+ // Create custom permission sets from managed policies
54
+ {
55
+ name: 'power-user-permission-set',
56
+ managedPolicyArns: ['arn:aws:iam::aws:policy/PowerUserAccess']
57
+ },
58
+ // Create a custom permission sets from inline policies
59
+ {
60
+ name: 's3-only-access',
61
+ inlinePolicyStatement: new iam.PolicyStatement({
62
+ actions: ['s3:*'],
63
+ resources: ['*'],
64
+ })
65
+ }
66
+ ],
67
+ accessGroups: [
68
+ {
69
+ name: 'admin-access-group',
70
+ accountNames: ['*'], // All accounts
71
+ // accountNames: ['project-1-*'], // All accounts starting with `project-1-`
72
+ // accountNames: ['root', 'development', 'production'], // Specific accounts
73
+ userNames: [
74
+ 'you@org.com',
75
+ ],
76
+ permissionSetName: 'AdministratorAccess',
77
+ },
78
+ ],
79
+ },
80
+ });
81
+ ````
82
+
83
+ </Fragment>
84
+ <Fragment slot="python">
85
+ ```python
86
+ import aws_cdk as cdk
87
+ import aws_data_landing_zone as dlz
88
+
89
+ app = cdk.App()
90
+ dlz.DataLandingZone(app,
91
+ ...
92
+ organization=dlz.DLzOrganization(
93
+ iam_identity_center={
94
+ "arn": "IdentityCenterARN",
95
+ "id": "IdentityCenterID",
96
+ "store_id": "StoreID",
97
+ "users": [
98
+ {
99
+ "user_name": "you@org.com",
100
+ "name": "Name",
101
+ "surname": "LastName",
102
+ },
103
+ ],
104
+ "permission_sets": [
105
+ # Provides the AWS managed policy `AdministratorAccess` and `ReadOnlyAccess` as permission sets
106
+ *Defaults.iam_identity_center_permission_sets(),
107
+ # Create custom permission sets from managed policies
108
+ {
109
+ name: 'power-user-permission-set',
110
+ managed_policy_arns: ['arn:aws:iam::aws:policy/PowerUserAccess']
111
+ },
112
+ # Create a custom permission sets from inline policies
113
+ {
114
+ name: 's3-only-access',
115
+ inline_policy_statement: {
116
+ actions: ['s3:*'],
117
+ resources: ['*'],
118
+ }
119
+ }
120
+ ],
121
+ "access_groups": [
122
+ {
123
+ "name": "admin-access-group",
124
+ "account_names": ["*"], # All accounts
125
+ # accountNames: ['project-1-*'], # All accounts starting with `project-1-`
126
+ # accountNames: ['root', 'development', 'production'], # Specific accounts
127
+ "user_names": ["you@org.com"],
128
+ "permission_set_name": "AdministratorAccess",
129
+ },
130
+ ],
131
+ },
132
+ ),
133
+ )
134
+ ````
135
+ </Fragment>
136
+ </DualCode>
137
+
138
+
139
+
140
+
141
+ ## Defaults
142
+
143
+ The `Defaults.iamIdentityCenterPermissionSets` function creates two permission sets:
144
+ - `AdministratorAccess`: Using the AWS managed policy `AdministratorAccess`
145
+ - `ReadOnlyAccess`: Using the AWS managed policy `ReadOnlyAccess`
146
+
147
+ ## API References
148
+ - [IamIdentityCenterProps](/reference/api/#aws-data-landing-zone.IamIdentityCenterProps)
@@ -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)