Skip to main content

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")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onema-cdk.static-website-0.0.11.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file onema-cdk.static-website-0.0.11.tar.gz.

File metadata

  • Download URL: onema-cdk.static-website-0.0.11.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.2

File hashes

Hashes for onema-cdk.static-website-0.0.11.tar.gz
Algorithm Hash digest
SHA256 18dc4c14f10c5d2ca606234661b48f0d87564b4446a738676d612901765396d8
MD5 e311fe2cf207e26127136e78f3d6f9b5
BLAKE2b-256 e5d3c09a89dfb3409e6d1fc56f3f18b10cb9a7a17cf2f0dc7f914fdc18bec79d

See more details on using hashes here.

File details

Details for the file onema_cdk.static_website-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: onema_cdk.static_website-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.2

File hashes

Hashes for onema_cdk.static_website-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 75daf656063e331fe6b032a19de5c16373aa2367cd38169655c4055417d33dc2
MD5 a45f1fd380b7c24c645810760602ce1c
BLAKE2b-256 5600fb87e92d72117a536f6a4998065f40d7d4855cb2cadc7492c1cbd256eb37

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page