Publishing a Website with Web Accelerator and Object Storage
Server Web Accelerator
Published: 2021-04-15

I tried using the newly integrated feature that allows linking Sakura Cloud’s Web Accelerator with Object Storage.

Web Accelerator Now Supports Object Storage Integration

This blog is a static site generated by Hugo, so I wanted to distribute this site using Object Storage and Web Accelerator.

Currently, it is being distributed via Web Accelerator + Sakura Rental Server.

Creating a Bucket in Object Storage

For pricing information, please check here

Manual can be found here

  1. Select Object Storage from the Cloud Home
    Cloud Home
  2. Select [Site] => [Ishikari 1st Site]
    objstr1
  3. Select [Bucket] and then [Add Bucket]
    objstr2
  4. Enter the bucket name and click [Add]
    objstr3
  5. Select [Permissions] and then [Add Permissions]
    objstr4
    Create an access key to access Object Storage
  6. Name it
    Here, we create a permission that allows READ (read-only) access to the myblog bucket
    objstr5
  7. Note down the created access key
    This read-only access key will be needed later for the Web Accelerator settings, so be sure to note down the Access Key ID and Secret Access Key
    objstr6
  8. Add another permission
    This permission will be used to upload site content to Object Storage, so create it with READ/WRITE (read and write) permissions
    objstr7
  9. Note down the Access Key ID and Secret Access Key, which will be used for uploading
    objstr5

Uploading Content

Currently, content is generated with Hugo, so upload the contents of the public directory created by Hugo to Object Storage.
Of course, if you have created your own HTML, you can upload that instead.
*Note: Object Storage is a storage service, not a rental server, so PHP or CGI programs will not run.

We will use awscli, as mentioned in the Sakura Cloud Object Storage manual, to upload the content.

Installing and Setting Up Tools

First, install awscli. (Here we are using Ubuntu 20.04)

  • Install awscli
$ sudo apt install awscli
  • Configure awscli
$ aws configure
AWS Access Key ID [None]: <Access Key ID>
AWS Secret Access Key [None]: <Secret Access Key>
Default region name [jp-north-1]: [ENTER]
Default output format [json]: [ENTER]

Here, use the READ/WRITE (read and write) Access Key ID and Secret Access Key created earlier.

  • Checking the bucket
aws --endpoint-url=https://s3.isk01.sakurastorage.jp s3 ls s3://myblog/

You can view s3:///.
Initially, it should be empty.

Uploading Content

awscli has a sync command, so use sync to synchronize the content of the public directory generated by Hugo.

  • Uploading (syncing)
$ aws --endpoint-url=https://s3.isk01.sakurastorage.jp s3 sync public s3://myblog/
  • Checking
$ aws --endpoint-url=https://s3.isk01.sakurastorage.jp s3 ls s3://myblog/
                           PRE assets/
                           PRE css/
                           PRE page/
                           PRE posts/
                           PRE tags/
2021-04-14 18:46:18        219 .htaccess
2021-04-14 18:46:19       1704 404.html
2021-04-14 18:46:19       6242 index.html
2021-04-14 18:46:19       9773 index.xml
2021-04-14 18:46:21       3721 sitemap.xml

Successfully uploaded 🎉

Setting Up Web Accelerator

This time, since blog.masa23.jp is already registered with Web Accelerator and the origin server is set to Sakura Rental Server, we will change this to Object Storage.

  • Open the target site and click [Settings]
    webaccel1

  • Change the origin type from [Web Server] to [Object Storage]
    webaccel2

  • Enter the [Bucket Name], [Access Key ID], and [Secret Access Key]
    Here, set the READ (read-only) Access Key ID and Secret Access Key
    webaccel3

  • Confirm that the origin type is set to Object Storage and save
    webaccel4

Now, the content uploaded to Object Storage should be distributed via the Web Accelerator.