Generate a static site from Wordpress (via WP2Static) using AWS CDK
Project description
CDK Static Wordpress
The goal of this project is to make it easy to deploy a static website, generated by Wordpress as simple and cost-effective as possible.
It's largely inspired by TechToSpeech/terraform-aws-serverless-static-wordpress, but uses AWS CDK instead of Terraform.
It creates the infrastructure to launch a temporary, transient Wordpress container. You then log in and customize it like any Wordpress site, and finally publish it as a static site fronted by a global CloudFront CDN and S3 Origin. When you’re done you shut down the Wordpress container and it costs you almost nothing.
WP2Static is used to generate the static site from the Wordpress container.
Quick Start
-
Install the construct:
yarn add @blimmer/cdk-static-wordpress # or npm i --save @blimmer/cdk-static-wordpress
-
Instantiate a
StaticWordpress
instance aStack
:import { StaticWordpress } from "@blimmer/cdk-static-wordpress"; import { Stack, StackProps } from "aws-cdk-lib"; import { HostedZone } from "aws-cdk-lib/aws-route53"; import { Construct } from "constructs"; export class StaticWordpressStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { super(scope, id, props); // You can create or import a hosted zone // See https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53.HostedZone.html const exampleHostedZone = new HostedZone(this, "ExampleHostedZone", { zoneName: "example.com", }); new StaticWordpress(this, "StaticWordpress", { fullyQualifiedSiteName: "blog.example.com", hostedZone: exampleHostedZone, wordpressAdminProps: { email: "me@example.com", }, }); } }
-
Deploy with the
cdk deploy
command -
Once the deployment completes, visit the Wordpress console at
admin-<fullyQualifiedSiteName>
. E.g., if your static site isblog.example.com
, visitadmin-blog.example.com/wp-admin
. -
Customize Wordpress as you see fit, create posts, etc.
-
When you're ready to deploy your static site, trigger WP2Static.
-
Visit your static site (e.g.,
blog.example.com
) once WP2Static completes. -
(optional) Shut down the Wordpress container to save money.
new StaticWordpress(this, "StaticWordpress", { fullyQualifiedSiteName: "blog.example.com", hostedZone: exampleHostedZone, wordpressAdminProps: { email: "me@example.com", run: false, // <-- Shut down the container after deployment }, });
Architecture
TODO
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
Hashes for cdk-static-wordpress-0.1.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00f1133b70d74c55230bee8b9099379dfc80b20215ac791ec19df1bb52815ac5 |
|
MD5 | 5f1380152ecc153943fe0d06e293a8c7 |
|
BLAKE2b-256 | bbbed20322a6568a30a5861516b9a6f51c73a5d891fd8a4c8d6c2c51d153e31a |
Hashes for cdk_static_wordpress-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a17c2962e7d2643371255ddce36d1608cb52ca51c25d9e7e2fe75debbf92ecf |
|
MD5 | 0cb9279b803852d787f9a801a07d7238 |
|
BLAKE2b-256 | 3fd41bf20cffbb5a8dfc3aba8703ea4b0d47b7bea35dab3742180c0542a74959 |