Simple static site CDK construct
This constructs creates a static website hosted on S3.
Requirements
- Hosted zone in Route53
Usage
This constructs creates:
- S3 bucket
- DNS Validated certificate
- CloudFront web distribution
- Route53 A record
from aws_cdk.core import Stack, Construct
from static_website import StaticWebsite
from aws_cdk.aws_route53 import HostedZone
class WebSiteStack(Stack):
def __init__(self, scope: Construct, id: str, **kwargs):
super().__init__(scope, id, **kwargs)
# The code that defines your stack goes here
zone = HostedZone.from_lookup(self, "HostedZone",
domain_name="mydomain.com",
private_zone=False)
StaticWebsite(self, "serverlesslink-website",
hosted_zone=zone,
site_domain="blog.mydomain.com",
sources="../public",
website_error="404.html")
Website without custom domain
from aws_cdk.core import Stack, Construct
from static_website import StaticWebsite
class WebSiteStack(Stack):
def __init__(self, scope: Construct, id: str, **kwargs):
super().__init__(scope, id, **kwargs)
# The code that defines your stack goes here
StaticWebsite(self, "serverlesslink-website",
sources="../public",
website_error="404.html")
Metadata
Release files for onema-cdk.static-website 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| onema-cdk.static-website-0.1.1.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| onema_cdk.static_website-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.7 kB
Release files / onema-cdk.static-website-0.1.1.tar.gz
| Download URL | onema-cdk.static-website-0.1.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b145ee199fba8744f5525ad1185dcaa7fa0a2220f12f9f4ee40a1af5d25e46b3
|
|
BLAKE2b-256 checksum How to use checksums |
083fb79f92133ffa39d351913f1ac46555134752b89966bfe95cd78b7aae1406
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
|
Release files / onema_cdk.static_website-0.1.1-py3-none-any.whl
| Download URL | onema_cdk.static_website-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d2a9e2aae0d52cf8c4044758df381858e85b058e0ba56fcd3e2f5a7a10c0a46
|
|
BLAKE2b-256 checksum How to use checksums |
6201ca43b6e1812a3ab44868fcf343067d00c17430c103472934534377a48bf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
|