Publish to S3

Section Explanation

 

This section is a walkthrough on setting up an S3 Bucket and publishing the WordPress site to S3.

Requirements

  • This walkthrough has the expectation that a CMS has been set up using a docker container as described here.
  • To do this you need an AWS account. For directions on how to open an AWS account please click here.

Create S3 Bucket

From the AWS Management Console select S3.

Click Create bucket

Now Set the bucket name.  I recommend making it the final website name.  In an example for examples, my bucket name is www.examplecms.com.  Additionally, your region will be important later on.  All this is shown in the screenshot below.

Click Next

There isn’t anything to change here, just click next.

Click Next

All the default permissions are good.

Once you have the bucket created click double click the bucket to open the bucket Overview.  As shown in the screenshot below.

Under Properties click on Static website hosting.  Shown in the below screenshot.

In the hosting form, identify the default page to be index.html.  Shown in the screenshot below.

Create IAM Access to upload to the bucket.

Next, we will create an IAM access user and give them access to write to S3.   To start go to Identity and Access Management in the AWS console as shown in the screenshot below.

Click on Users as shown in the screenshot below.

Click Add User to get the Add user options shown below.

Notice I have this user the name WordPress, and only Programmatic access.  I then clicked Next Permissions.

I then select Attach existing policies directly and choose S3 Full Access.  Shown in the screenshot below.

Then click Next: Review.

Next click Create user as shown below.

In the next screen save your access keys.

Static Publishing

Now that we have a S3 Bucket, and access keys we can set up the CMS to publish our website to S3.

In Our WordPress  CMS select Plugins.  As shown in the below screenshot.

If you WP Static HTML Output is not activated, click activate so it shows so.  As shown in the screenshot below.

With our plugin activated goto Tools then WP Static HTML Output.  To get a page as shown below.

Under Base Url input the web url you intend to use for the website.  In my example this is https://www.examplecms.com/.

I have also checked “Strip out unneeded WordPress meta tags”.

I also checked “Transfer files via S3.”  Then add the access keys we generated earlier, entered the region and S3 bucket we created.

Click Save current options.  All shown in a screenshot below.

Finally, click Start stick site export.  Shown in the screenshot below.

What Next?

At this point, the CMS is up.  Our work isn’t done, you decide what to take on next.