npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2022 – Pkg Stats / Ryan Hefner

@makemydeal/cdk-static-website

v1.113.0

Published

Static Website CDK Packages

Downloads

846

Readme

cdk-static-website

This package will provide stacks/managers to create multiple region buckets with replication along with setting up cloudfront.

Stacks

| Stack | Description | --- | --- | ClientStack | This will configure CloudFront. This will also create the S3 bucket to host the website. It can also setup replication with other buckets (make sure those buckets are created first) | WebsiteBucketStack | This will allow for creation of website S3 buckets. It can be useful to use prior to the ClientStack when setting up replication

ClientStack Properties

| Property | Required | Type | Description | --- | --- | --- | applicationName | Yes | string | Name of the application and used as a prefix for all lambda names | environmentName | Yes | string | The logical environment (dev, qa, etc) | enableWaf | No | boolean | Should a WAF be in front of the Cloudfront Configuration | network | Yes | ClientStackNetworkProps | Network Configuration | s3DefaultCacheTtl | No | Duration | s3DefaultCacheTtl (86400 is the default if not specified) | removalPolicy | No | RemovalPolicy | When this stack is removed, what should happen to the bucket? (RemovalPolicy.RETAIN is the default) | replication | No | WebsiteBucketReplicationProps | The failover bucket and the IAMFactory used to get the s3-replication-role | bucketName | No | string | The name of the bucket to store the artifacts. If not specified, the name will be ${applicationName}-${environmentName}-static-website-${region}

WebsiteBucketStack Properties

| Property | Required | Type | Description | --- | --- | --- | applicationName | Yes | string | Name of the application and used as a prefix for all lambda names | environmentName | Yes | string | The logical environment (dev, qa, etc) | bucketName | Yes | string | The name of the bucket | removalPolicy | No | RemovalPolicy | When this stack is removed, what should happen to the bucket? (RemovalPolicy.RETAIN is the default) | websiteIndexDocument | No | string | The index page of the site (index.html is the default) | websiteErrorDocument | No | string | The error page of the site (error.html is the default) | versioned | No | boolean | Should the artifacts be versioned (the default is yes) | bucketEncryption | No | BucketEncryption | Should the bucket be encrypted (Default is bucketEncryption.S3_MANAGED) | encryptionFactory | No | ConstructFactory | A factory to get encryption. Only used if the bucketEncryption is KMS

Managers

Managers are used to have a consolidated object that will control the CICD and Build process. This allows the same object to be passed to the CICD and APP setups. They allow for custom actions to be run during the IAC Setup, the Environment Setup, and when creating the stack. These managers will be passed to the CICD process.

Each stack above has a corresponding manager:

  • ClientStackManager
  • WebsiteBucketStackManager

ClientStackManager

Managers can take a list of regions to work within to set up multi region deployment. For the client stack, however, CloudFront can only be deployed to 1 region. Therefore, make sure to supply only 1 region in the regions property for multi region deployments.

WebsiteBucketStackManager

Conversely, for buckets used for replication, you should specify all of the regions except the main one. This will create the child buckets which you can then pass into the ClientStack.

Parameters

In order to setup bucket replication, we need a role. The IAM construct has a s3ReplicationRole property which gets that role from SSM. /dr/global/iam/s3-replication-role is the value that needs to be put into SSM, and should be an ARN for the role to use. By default, IAMFactory is used which will get the construct, but you can specify your own.