A CDK Python construct to create static S3 websites. This is a port of the AWS static site example https://github.com/aws-samples/aws-cdk-examples/blob/master/typescript/static-site/static-site.ts
Project description
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")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Close
Hashes for onema-cdk.static-website-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 701432da93ab3cda9ba20f18ba5292ac5f57853557774e81cdfb2f4081a5cb52 |
|
MD5 | 390fc692060a514d66a2639fcf38cce5 |
|
BLAKE2b-256 | d2ab17ee09ae241ad1fd2bd8588d5b5e281c15945ef6a61700660c8cad01d2f4 |
Close
Hashes for onema_cdk.static_website-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6fa1c9873fe5c5892fc30b4be07a3695ee16f0b16781899ae1e00316ce07077 |
|
MD5 | fad85a78bb67bce5e96335b0770a212b |
|
BLAKE2b-256 | da47fd261937cd322a551b547e20031c2636dfb8c8a88f3f296b5a07d3afd1cd |
Close
Hashes for onema_cdk.static_website-0.1.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e0a50ca65f878b1405ca34a343f7fb1754e975dfbda33720ee6ad5400103967 |
|
MD5 | 4297b0ee782c1eabb3a6d633c462e974 |
|
BLAKE2b-256 | aebbffe6d12c5b4ea4555daa69d0077c7ed2274372f6e595fc843561972c8faf |