cdk-private-s3-hosting 0.0.0__py3-none-any.whl → 0.0.2__py3-none-any.whl

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.
@@ -7,10 +7,26 @@ You can use this construct for a enterprise use case where you want to host a st
7
7
 
8
8
  Original idea is from [this blog post](https://aws.amazon.com/jp/blogs/networking-and-content-delivery/hosting-internal-https-static-websites-with-alb-s3-and-privatelink/).
9
9
 
10
+ [![View on Construct Hub](https://constructs.dev/badge?package=cdk-private-s3-hosting)](https://constructs.dev/packages/cdk-private-s3-hosting)
11
+ [![Open in Visual Studio Code](https://img.shields.io/static/v1?logo=visualstudiocode&label=&message=Open%20in%20Visual%20Studio%20Code&labelColor=2c2c32&color=007acc&logoColor=007acc)](https://open.vscode.dev/badmintoncryer/cdk-private-s3-hosting)
12
+ [![npm version](https://badge.fury.io/js/cdk-private-s3-hosting.svg)](https://badge.fury.io/js/cdk-private-s3-hosting)
13
+ [![Build Status](https://github.com/badmintoncryer/cdk-private-s3-hosting/actions/workflows/build.yml/badge.svg)](https://github.com/badmintoncryer/cdk-private-s3-hosting/actions/workflows/build.yml)
14
+ [![Release Status](https://github.com/badmintoncryer/cdk-private-s3-hosting/actions/workflows/release.yml/badge.svg)](https://github.com/badmintoncryer/cdk-private-s3-hosting/actions/workflows/release.yml)
15
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
16
+ [![npm downloads](https://img.shields.io/npm/dm/cdk-private-s3-hosting.svg?style=flat)](https://www.npmjs.com/package/cdk-private-s3-hosting)
17
+
10
18
  ## Architecture
11
19
 
12
20
  ![Architecture](./images/private_s3_hosting.png)
13
21
 
22
+ ## Installation
23
+
24
+ You can install the package via npm:
25
+
26
+ ```sh
27
+ npm install cdk-private-s3-hosting
28
+ ```
29
+
14
30
  ## Usage
15
31
 
16
32
  To create a private S3 bucket and an ALB with a listener rule that forwards requests to the S3 bucket, you can use the following code:
@@ -93,6 +109,7 @@ from ._jsii import *
93
109
  import aws_cdk.aws_certificatemanager as _aws_cdk_aws_certificatemanager_ceddda9d
94
110
  import aws_cdk.aws_ec2 as _aws_cdk_aws_ec2_ceddda9d
95
111
  import aws_cdk.aws_elasticloadbalancingv2 as _aws_cdk_aws_elasticloadbalancingv2_ceddda9d
112
+ import aws_cdk.aws_route53 as _aws_cdk_aws_route53_ceddda9d
96
113
  import aws_cdk.aws_s3 as _aws_cdk_aws_s3_ceddda9d
97
114
  import constructs as _constructs_77d1e7e8
98
115
 
@@ -114,16 +131,18 @@ class PrivateS3Hosting(
114
131
  certificate: typing.Optional[_aws_cdk_aws_certificatemanager_ceddda9d.ICertificate] = None,
115
132
  enable_private_dns: typing.Optional[builtins.bool] = None,
116
133
  internet_facing: typing.Optional[builtins.bool] = None,
134
+ sub_domain: typing.Optional[builtins.str] = None,
117
135
  vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
118
136
  ) -> None:
119
137
  '''
120
138
  :param scope: -
121
139
  :param id: -
122
140
  :param bucket_props: The properties for the S3 bucket. Default: - use default properties
123
- :param domain_name: The domain name for the website. This will be used to create the S3 bucket and the ALB listener
141
+ :param domain_name: The domain name for the website. S3 bucket name will be created with ``domainName``. If ``enablePrivateDns`` is enabled, a private hosted zone also will be created for the ``domainName`` and an A record has been created from ``domainName`` to the ALB DNS name.". If ``subDomein`` is provided, these names will be ``${subDomain}.${domainName}``.
124
142
  :param certificate: The certificate for the website. Default: - use HTTP
125
143
  :param enable_private_dns: Enable private DNS for the website. By eneabling this, a private hosted zone will be created for the domain name and an alias record will be created for the ALB You can access to the alb by the ``http(s)://<domainName>`` from the VPC Default: true
126
144
  :param internet_facing: Whether the ALB is internet facing. Default: false
145
+ :param sub_domain: The sub domain for the website. S3 bucket name will be created with ``${subDomain}.{domainName}``. If ``enablePrivateDns`` is enabled, a private hosted zone also will be created for the ``domainName`` and an A record has been created from ``${subDomain}.${domainName}`` to the ALB DNS name.". Default: - no sub domain
127
146
  :param vpc: The VPC for the website. Default: - create a new VPC with 2 AZs and 0 NAT gateways
128
147
  '''
129
148
  if __debug__:
@@ -136,6 +155,7 @@ class PrivateS3Hosting(
136
155
  certificate=certificate,
137
156
  enable_private_dns=enable_private_dns,
138
157
  internet_facing=internet_facing,
158
+ sub_domain=sub_domain,
139
159
  vpc=vpc,
140
160
  )
141
161
 
@@ -161,6 +181,12 @@ class PrivateS3Hosting(
161
181
  '''The VPC.'''
162
182
  return typing.cast(_aws_cdk_aws_ec2_ceddda9d.IVpc, jsii.get(self, "vpc"))
163
183
 
184
+ @builtins.property
185
+ @jsii.member(jsii_name="hostedZone")
186
+ def hosted_zone(self) -> typing.Optional[_aws_cdk_aws_route53_ceddda9d.IHostedZone]:
187
+ '''The hosted zone for the website.'''
188
+ return typing.cast(typing.Optional[_aws_cdk_aws_route53_ceddda9d.IHostedZone], jsii.get(self, "hostedZone"))
189
+
164
190
 
165
191
  @jsii.data_type(
166
192
  jsii_type="cdk-private-s3-hosting.PrivateS3HostingProps",
@@ -171,6 +197,7 @@ class PrivateS3Hosting(
171
197
  "certificate": "certificate",
172
198
  "enable_private_dns": "enablePrivateDns",
173
199
  "internet_facing": "internetFacing",
200
+ "sub_domain": "subDomain",
174
201
  "vpc": "vpc",
175
202
  },
176
203
  )
@@ -183,15 +210,17 @@ class PrivateS3HostingProps:
183
210
  certificate: typing.Optional[_aws_cdk_aws_certificatemanager_ceddda9d.ICertificate] = None,
184
211
  enable_private_dns: typing.Optional[builtins.bool] = None,
185
212
  internet_facing: typing.Optional[builtins.bool] = None,
213
+ sub_domain: typing.Optional[builtins.str] = None,
186
214
  vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
187
215
  ) -> None:
188
216
  '''Properties for PrivateS3Hosting.
189
217
 
190
218
  :param bucket_props: The properties for the S3 bucket. Default: - use default properties
191
- :param domain_name: The domain name for the website. This will be used to create the S3 bucket and the ALB listener
219
+ :param domain_name: The domain name for the website. S3 bucket name will be created with ``domainName``. If ``enablePrivateDns`` is enabled, a private hosted zone also will be created for the ``domainName`` and an A record has been created from ``domainName`` to the ALB DNS name.". If ``subDomein`` is provided, these names will be ``${subDomain}.${domainName}``.
192
220
  :param certificate: The certificate for the website. Default: - use HTTP
193
221
  :param enable_private_dns: Enable private DNS for the website. By eneabling this, a private hosted zone will be created for the domain name and an alias record will be created for the ALB You can access to the alb by the ``http(s)://<domainName>`` from the VPC Default: true
194
222
  :param internet_facing: Whether the ALB is internet facing. Default: false
223
+ :param sub_domain: The sub domain for the website. S3 bucket name will be created with ``${subDomain}.{domainName}``. If ``enablePrivateDns`` is enabled, a private hosted zone also will be created for the ``domainName`` and an A record has been created from ``${subDomain}.${domainName}`` to the ALB DNS name.". Default: - no sub domain
195
224
  :param vpc: The VPC for the website. Default: - create a new VPC with 2 AZs and 0 NAT gateways
196
225
  '''
197
226
  if isinstance(bucket_props, dict):
@@ -203,6 +232,7 @@ class PrivateS3HostingProps:
203
232
  check_type(argname="argument certificate", value=certificate, expected_type=type_hints["certificate"])
204
233
  check_type(argname="argument enable_private_dns", value=enable_private_dns, expected_type=type_hints["enable_private_dns"])
205
234
  check_type(argname="argument internet_facing", value=internet_facing, expected_type=type_hints["internet_facing"])
235
+ check_type(argname="argument sub_domain", value=sub_domain, expected_type=type_hints["sub_domain"])
206
236
  check_type(argname="argument vpc", value=vpc, expected_type=type_hints["vpc"])
207
237
  self._values: typing.Dict[builtins.str, typing.Any] = {
208
238
  "bucket_props": bucket_props,
@@ -214,6 +244,8 @@ class PrivateS3HostingProps:
214
244
  self._values["enable_private_dns"] = enable_private_dns
215
245
  if internet_facing is not None:
216
246
  self._values["internet_facing"] = internet_facing
247
+ if sub_domain is not None:
248
+ self._values["sub_domain"] = sub_domain
217
249
  if vpc is not None:
218
250
  self._values["vpc"] = vpc
219
251
 
@@ -231,7 +263,13 @@ class PrivateS3HostingProps:
231
263
  def domain_name(self) -> builtins.str:
232
264
  '''The domain name for the website.
233
265
 
234
- This will be used to create the S3 bucket and the ALB listener
266
+ S3 bucket name will be created with ``domainName``.
267
+
268
+ If ``enablePrivateDns`` is enabled,
269
+ a private hosted zone also will be created for the ``domainName``
270
+ and an A record has been created from ``domainName`` to the ALB DNS name.".
271
+
272
+ If ``subDomein`` is provided, these names will be ``${subDomain}.${domainName}``.
235
273
  '''
236
274
  result = self._values.get("domain_name")
237
275
  assert result is not None, "Required property 'domain_name' is missing"
@@ -271,6 +309,21 @@ class PrivateS3HostingProps:
271
309
  result = self._values.get("internet_facing")
272
310
  return typing.cast(typing.Optional[builtins.bool], result)
273
311
 
312
+ @builtins.property
313
+ def sub_domain(self) -> typing.Optional[builtins.str]:
314
+ '''The sub domain for the website.
315
+
316
+ S3 bucket name will be created with ``${subDomain}.{domainName}``.
317
+
318
+ If ``enablePrivateDns`` is enabled,
319
+ a private hosted zone also will be created for the ``domainName``
320
+ and an A record has been created from ``${subDomain}.${domainName}`` to the ALB DNS name.".
321
+
322
+ :default: - no sub domain
323
+ '''
324
+ result = self._values.get("sub_domain")
325
+ return typing.cast(typing.Optional[builtins.str], result)
326
+
274
327
  @builtins.property
275
328
  def vpc(self) -> typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc]:
276
329
  '''The VPC for the website.
@@ -308,6 +361,7 @@ def _typecheckingstub__1f6a3822c2541f3c785fce5f3187d688039409f4677b681948fb4a3ae
308
361
  certificate: typing.Optional[_aws_cdk_aws_certificatemanager_ceddda9d.ICertificate] = None,
309
362
  enable_private_dns: typing.Optional[builtins.bool] = None,
310
363
  internet_facing: typing.Optional[builtins.bool] = None,
364
+ sub_domain: typing.Optional[builtins.str] = None,
311
365
  vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
312
366
  ) -> None:
313
367
  """Type checking stubs"""
@@ -320,6 +374,7 @@ def _typecheckingstub__5f3ff047cbd8e8c18995347a63899f04375c4e4a279cffb2f203e5b10
320
374
  certificate: typing.Optional[_aws_cdk_aws_certificatemanager_ceddda9d.ICertificate] = None,
321
375
  enable_private_dns: typing.Optional[builtins.bool] = None,
322
376
  internet_facing: typing.Optional[builtins.bool] = None,
377
+ sub_domain: typing.Optional[builtins.str] = None,
323
378
  vpc: typing.Optional[_aws_cdk_aws_ec2_ceddda9d.IVpc] = None,
324
379
  ) -> None:
325
380
  """Type checking stubs"""
@@ -33,9 +33,9 @@ import constructs._jsii
33
33
 
34
34
  __jsii_assembly__ = jsii.JSIIAssembly.load(
35
35
  "cdk-private-s3-hosting",
36
- "0.0.0",
36
+ "0.0.2",
37
37
  __name__[0:-6],
38
- "cdk-private-s3-hosting@0.0.0.jsii.tgz",
38
+ "cdk-private-s3-hosting@0.0.2.jsii.tgz",
39
39
  )
40
40
 
41
41
  __all__ = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cdk-private-s3-hosting
3
- Version: 0.0.0
3
+ Version: 0.0.2
4
4
  Summary: CDK Construct for a private frontend hosting S3 bucket
5
5
  Home-page: https://github.com/badmintoncryer/cdk-private-s3-hosting.git
6
6
  Author: Kazuho CryerShinozuka<malaysia.cryer@gmail.com>
@@ -34,10 +34,26 @@ You can use this construct for a enterprise use case where you want to host a st
34
34
 
35
35
  Original idea is from [this blog post](https://aws.amazon.com/jp/blogs/networking-and-content-delivery/hosting-internal-https-static-websites-with-alb-s3-and-privatelink/).
36
36
 
37
+ [![View on Construct Hub](https://constructs.dev/badge?package=cdk-private-s3-hosting)](https://constructs.dev/packages/cdk-private-s3-hosting)
38
+ [![Open in Visual Studio Code](https://img.shields.io/static/v1?logo=visualstudiocode&label=&message=Open%20in%20Visual%20Studio%20Code&labelColor=2c2c32&color=007acc&logoColor=007acc)](https://open.vscode.dev/badmintoncryer/cdk-private-s3-hosting)
39
+ [![npm version](https://badge.fury.io/js/cdk-private-s3-hosting.svg)](https://badge.fury.io/js/cdk-private-s3-hosting)
40
+ [![Build Status](https://github.com/badmintoncryer/cdk-private-s3-hosting/actions/workflows/build.yml/badge.svg)](https://github.com/badmintoncryer/cdk-private-s3-hosting/actions/workflows/build.yml)
41
+ [![Release Status](https://github.com/badmintoncryer/cdk-private-s3-hosting/actions/workflows/release.yml/badge.svg)](https://github.com/badmintoncryer/cdk-private-s3-hosting/actions/workflows/release.yml)
42
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
43
+ [![npm downloads](https://img.shields.io/npm/dm/cdk-private-s3-hosting.svg?style=flat)](https://www.npmjs.com/package/cdk-private-s3-hosting)
44
+
37
45
  ## Architecture
38
46
 
39
47
  ![Architecture](./images/private_s3_hosting.png)
40
48
 
49
+ ## Installation
50
+
51
+ You can install the package via npm:
52
+
53
+ ```sh
54
+ npm install cdk-private-s3-hosting
55
+ ```
56
+
41
57
  ## Usage
42
58
 
43
59
  To create a private S3 bucket and an ALB with a listener rule that forwards requests to the S3 bucket, you can use the following code:
@@ -0,0 +1,9 @@
1
+ cdk-private-s3-hosting/__init__.py,sha256=mQsZ-xyYmP7nweN9vIH6fotdCzRkfvY9h3v2KxmjGSo,18130
2
+ cdk-private-s3-hosting/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
+ cdk-private-s3-hosting/_jsii/__init__.py,sha256=6256oRzj6EVzyss4i-lfQxMgs-3l3loSpRraDPXMYYU,1468
4
+ cdk-private-s3-hosting/_jsii/cdk-private-s3-hosting@0.0.2.jsii.tgz,sha256=1oaAusIUmVvdjG6hxongv0sbxTu0RNOM_em7CzP15JQ,44766
5
+ cdk_private_s3_hosting-0.0.2.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
6
+ cdk_private_s3_hosting-0.0.2.dist-info/METADATA,sha256=sC2FPtVEUqR8LXnI48XAQSVIYiDPocQ1A0SlhwnmKYM,4484
7
+ cdk_private_s3_hosting-0.0.2.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
8
+ cdk_private_s3_hosting-0.0.2.dist-info/top_level.txt,sha256=Garilimgavjx7-oTth2AD47uG-twwl6dTXCfLYQ1lqY,23
9
+ cdk_private_s3_hosting-0.0.2.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- cdk-private-s3-hosting/__init__.py,sha256=0E0ebc4eyTwCrP2dkjoWDvR21eax1Rd94o4901qgba8,13927
2
- cdk-private-s3-hosting/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
- cdk-private-s3-hosting/_jsii/__init__.py,sha256=qgUE_8RUQ9641T_uEvgydrQnBQCPcQ2Ruprl7LjAlZA,1468
4
- cdk-private-s3-hosting/_jsii/cdk-private-s3-hosting@0.0.0.jsii.tgz,sha256=_eo4mRwUAIh6oreMLMrSF8R16vp4sNy9sDMyBBxhMmQ,42789
5
- cdk_private_s3_hosting-0.0.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
6
- cdk_private_s3_hosting-0.0.0.dist-info/METADATA,sha256=esybgyfS6WQ8SAV0i9lT_7xlQhMRvDGsTUsHKjX4dAM,3205
7
- cdk_private_s3_hosting-0.0.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
8
- cdk_private_s3_hosting-0.0.0.dist-info/top_level.txt,sha256=Garilimgavjx7-oTth2AD47uG-twwl6dTXCfLYQ1lqY,23
9
- cdk_private_s3_hosting-0.0.0.dist-info/RECORD,,