Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
cdk-static-wordpress
Advanced tools
Generate a static site from Wordpress (via WP2Static) using AWS CDK
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.
⚠️ This project is archived and no longer being maintained. ⚠️
This was a fun side project, but recent external changes have made it challenging to run Wordpress in a cost-efficient manner.
For these reasons, I've decided to no longer maintain this package. If anyone would like to pick up the torch and continue maintaining this project, please feel free to fork it!
If you'd like to take a final backup, you can use a tool like Updraft Plus. This will create a portable backup you can use to restore your Wordpress instance somewhere else (e.g., Lightsail, a hosted Wordpress provider, etc.).
Then, destroy the resources created CDK Static Wordpress by running cdk destroy
. This will remove all the resources
associated with the project.
Install the construct:
yarn add @blimmer/cdk-static-wordpress
# or
npm i --save @blimmer/cdk-static-wordpress
Instantiate a StaticWordpress
instance a Stack
:
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 is blog.example.com
, visit admin-blog.example.com/wp-admin
. The default password for the wordpress user is
changeme
(please change it :smile:).
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
},
});
TODO
This construct provides escape hatches, to allow you to customize the underlying infrastructure if you need to. This is a big benefit of using CDK over Terraform (where every customizable property must be manually exposed as a variable).
Look for *Overrides
in the API docs for customization options. But, be warned, we allow overriding almost
everything, so you can easily produce invalid infrastructure if you don't know what you're doing.
FAQs
Generate a static site from Wordpress (via WP2Static) using AWS CDK
We found that cdk-static-wordpress demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.