This is an AWS CDK Construct to simplify deploying a single-page website use CloudFront distributions.
Project description
cdk-simplewebsite-deploy
This is an AWS CDK Construct to simplify deploying a single-page website using either S3 buckets or CloudFront distributions.
Installation and Usage
CreateBasicSite
Creates a simple website using S3 buckets with a domain hosted in Route 53.
Typescript
npm install cdk-simplewebsite-deploy
# Example automatically generated from non-compiling source. May contain errors.
import aws_cdk.core as cdk
from cdk_simplewebsite_deploy import CreateBasicSite
class PipelineStack(cdk.Stack):
def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None, analyticsReporting=None):
super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting)
CreateBasicSite(stack, "test-website",
website_folder="./src/build",
index_doc="index.html",
hosted_zone="example.com"
)
C#
dotnet add package ThonBecker.CDK.SimpleWebsiteDeploy
using Amazon.CDK;
using ThonBecker.CDK.SimpleWebsiteDeploy;
namespace SimpleWebsiteDeploy
{
public class PipelineStack : Stack
{
internal PipelineStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
{
new CreateBasicSite(scope, "test-website", new BasicSiteConfiguration()
{
WebsiteFolder = "./src/build",
IndexDoc = "index.html",
HostedZone = "example.com",
});
}
}
}
Java
<dependency>
<groupId>com.thonbecker.simplewebsitedeploy</groupId>
<artifactId>cdk-simplewebsite-deploy</artifactId>
<version>0.4.2</version>
</dependency>
package com.myorg;
import software.amazon.awscdk.core.Construct;
import software.amazon.awscdk.core.Stack;
import software.amazon.awscdk.core.StackProps;
import com.thonbecker.simplewebsitedeploy.CreateBasicSite;
public class MyProjectStack extends Stack {
public MyProjectStack(final Construct scope, final String id) {
this(scope, id, null);
}
public MyProjectStack(final Construct scope, final String id, final StackProps props) {
super(scope, id, props);
CreateBasicSite.Builder.create(this, "test-website")
.websiteFolder("./src/build")
.indexDoc("index.html")
.hostedZone("example.com");
}
}
Python
pip install cdk-simplewebsite-deploy
from aws_cdk import core
from cdk_simplewebsite_deploy import CreateBasicSite
class MyProjectStack(core.Stack):
def __init__(self, scope: core.Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
CreateBasicSite(self, 'test-website', website_folder='./src/build',
index_doc='index.html',
hosted_zone='example.com')
CreateCloudfrontSite
Creates a simple website using a CloudFront distribution with a domain hosted in Route 53.
Typescript
npm install cdk-simplewebsite-deploy
# Example automatically generated from non-compiling source. May contain errors.
import aws_cdk.core as cdk
from cdk_simplewebsite_deploy import CreateCloudfrontSite
class PipelineStack(cdk.Stack):
def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None, analyticsReporting=None):
super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting)
CreateCloudfrontSite(stack, "test-website",
website_folder="./src/dist",
index_doc="index.html",
hosted_zone="example.com",
sub_domain="www.example.com"
)
C#
dotnet add package ThonBecker.CDK.SimpleWebsiteDeploy
using Amazon.CDK;
using ThonBecker.CDK.SimpleWebsiteDeploy;
namespace SimpleWebsiteDeploy
{
public class PipelineStack : Stack
{
internal PipelineStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
{
new CreateCloudfrontSite(scope, "test-website", new CloudfrontSiteConfiguration()
{
WebsiteFolder = "./src/build",
IndexDoc = "index.html",
HostedZone = "example.com",
SubDomain = "www.example.com",
});
}
}
}
Java
<dependency>
<groupId>com.thonbecker.simplewebsitedeploy</groupId>
<artifactId>cdk-simplewebsite-deploy</artifactId>
<version>0.4.2</version>
</dependency>
package com.myorg;
import software.amazon.awscdk.core.Construct;
import software.amazon.awscdk.core.Stack;
import software.amazon.awscdk.core.StackProps;
import com.thonbecker.simplewebsitedeploy.CreateCloudfrontSite;
public class MyProjectStack extends Stack {
public MyProjectStack(final Construct scope, final String id) {
this(scope, id, null);
}
public MyProjectStack(final Construct scope, final String id, final StackProps props) {
super(scope, id, props);
CreateCloudfrontSite.Builder.create(this, "test-website")
.websiteFolder("./src/build")
.indexDoc("index.html")
.hostedZone("example.com")
.subDomain("www.example.com");
}
}
Python
pip install cdk-simplewebsite-deploy
from aws_cdk import core
from cdk_simplewebsite_deploy import CreateCloudfrontSite
class MyProjectStack(core.Stack):
def __init__(self, scope: core.Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
CreateCloudfrontSite(self, 'test-website', website_folder='./src/build',
index_doc='index.html',
hosted_zone='example.com',
sub_domain='www.example.com')
License
Distributed under the Apache-2.0 license.
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 Distribution
Close
Hashes for cdk-simplewebsite-deploy-0.4.71.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc7c7aa44dcd7b507beaaf8c4719b9237f8155ad004260cc878daa5f89afbf34 |
|
MD5 | 7b9d3347368f0ff42543f2645c56e767 |
|
BLAKE2b-256 | 3b520efa014b6454266a283bff9893e6f4d17821232d564b92db3310cccac367 |
Close
Hashes for cdk_simplewebsite_deploy-0.4.71-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af178e32c17f5b5741970dc52c39a72d27f9e69a6e5ab22928e2aae9d6006d86 |
|
MD5 | ae9562364f87a55f8447c53cc9db4670 |
|
BLAKE2b-256 | 134f1bd33d0429612c1c8a6f48d3afd2d31cddf301434c25f7f7ae3e7c729fbb |