cloudflare cdn with amazon s3 website

Configure Cloudflare CDN to serve files from an Amazon S3 bucket website

We assume you have already setup a S3 bucket website the right way using a custom domain / sub-domain. This post continues from that point to guide you to use Cloudflare CDN with your S3 bucket website.

Benefits of Cloudflare CDN

  • Caching to reduce the load on my webserver
  • Geographic Distribution for speedy delivery regardless of where you are
  • DDoS Protection from sudden spikes in traffic
  • Compression of files for faster delivery for user on slow internet
  • Secure padlocked status in the web browser
  • No cost or low cost based on pricing plan selected

Change to Cloudflare name servers

To start using the Cloudflare CDN you will need to start managing your domain name's DNS via Cloudflare's name servers.

When you signup with Cloudflare and add your domain name, Cloudflare will import all existing DNS records for your domain from your existing name server (DNS management service provider). This include the DNS record you have added for your S3 bucket website.

Before you proceed you should check that all records have been imported correctly. If any records are missing add them now.

When you continue you will be shown two name servers that you need to set as authoritative.

cloudflare nameservers sample

Example of Cloudflare name servers. Your domain could be assigned different ones.

This step is important as without this you cannot manage your domain's DNS via Cloudflare and also cannot use their CDN.

To do this go to your current DNS manager service's control panel and replace the existing name servers with the ones displayed by Cloudflare.

changing to cloudflare nameservers

Example of a name server change being done. Your DNS management console may look different.

When Cloudflare detects the change in a few minutes to an hour, it will change the status of your domain name to Active in Cloudflare.

Switch on CDN Proxy Caching

To use Cloudflare CDN you need to enable Cloudflare proxy caching for your domain/sub-domain.

To do this visit the domain name's control panel in Cloudflare and go to DNS settings.

Locate the CNAME record for your S3 bucket website and edit it to enable proxying.

cloudflare dns enable proxy

Cloudflare CDN will now take care of global requests for all files from your S3 bucket website!

Make it Secure

To keep the data transfer of files secure between Cloudflare's local proxy and the website visitor's web browser you can enable encryption.

To do this visit the SSL/TLS settings and select Flexible mode.

cloudflare ssl flexible mode

The Result

Once you have completed the above steps you should be able to view your S3 bucket website when you try to access it via the assigned domain/sub-domain.

s3 website dns cname ssl

If you have also additionally enabled encryption you should also see the padlock secure icon in your web browser's address bar.

publii s3 web browser

Using Publii CMS with S3 Static Web Hosting

Static Web Hosting

Static website hosting refers to hosting of web pages that have fixed (static) content and any user interactivity is processed on the client-side instead of the server-side.

Publii CMS

publii cms window

Publii CMS is a free and open-source, PC-based, static website CMS. It means that Publii helps you create & manage the website structure and pages on your PC and then publishes them to static web hosting.

About S3 Static Web Hosting

Amazon S3 is a low-cost-low-maintenance, online, container-based object storage service that can be used to store directories and files like on a PC.

To work with Amazon S3 you need to create S3 buckets (containers) and then create folder objects and upload file objects.

Additionally, Amazon S3 can also be used to host static websites by enabling a specific bucket configuration and security policy.

Did you know you could launch an S3 bucket with the necessary static website configuration and security policy in 5 minutes?

Launch S3 Static Hosting for Website

Sign-in to your user account and navigate to the S3 Bucket Websites section.

Under the Launcher sub-section, give your static web hosting bucket a unique friendly name to identify it.

iwebzcloud s3 bucket website launch options

Leave the Domain Name field blank unless you plan to use this web hosting bucket with a custom domain/sub-domain. more info

Hit the Launch button to set it all up. Thats all!

Your S3 static web hosting is ready for you to publish your website.

Connect and Publish a Static Website from Publii CMS

Download and Install the Publii CMS on your PC then start it.

Create a new website to publish to your S3 static web hosting. view instructions

Under server type, select S3. Enter the required bucket and access key details.

publii cms s3 server settings

You can get the bucket details from here.

The Access Key/ID and Secret key can be found here.

Use the Test Connection button to verify everything is correctly entered. Save the settings.

Now use the Sync your website button in the menu to upload/publish your website.

You can now use your web browser to visit your static website online on Amazon S3.

You can modify your website further to your satisfaction and then sync (publish) it as many times as you like!

5 Minute WordPress Install on Amazon EC2 with Debian

WordPress

wordpress logoWordPress is the world’s most popular website theme and content management system. Powerful yet simple, everyone from students to global corporations use it  to create a beautiful website, blog, or a user interface for your web app.

WordPress is free, open-source software. So you can also self-host it on your own Amazon EC2 instance (cloud server) without any software license fees. You get charged only for your own actual usage of AWS resources.

WordPress Install Requirements

An install of WordPress goes as follows:

  1. Launch an EC2 instance with an operating system (mostly a Linux OS)
  2. Setup (Apache/nginx) web server
  3. Setup PHP with it’s web server module
  4. Configure PHP correcty
  5. Setup MySQL/MariaDB database server
  6. Create a database on MySQL server
  7. Download WordPress
  8. Setup WordPress with the MySQL database
  9. Set permissions on WordPress folders/directories

What if we told you you can do this in 5-15 minutes with just a selection and a click?

Launch the Bitnami WordPress AMI

bitnami logoBitnami is a VMWare-owned organization that provides a catalog of curated server applications and development environments that can be installed with one click, either locally, in a VM, or in the cloud.

Bitnami apps work out of the box, with no dependency or compiling worries. Updates can be applied with no problems, but you may face the restriction of not being able to upgrade the stack such as PHP or MySQL versions.

We will use a Bitnami WordPress public AMI to spin-up an EC2 instance. All Bitnami WordPress AMIs are built on 64-bit Debian Linux, with a LAMP/LEMP technology stack and WordPress pre-installed.

Sign-in to your user account and locate the Bitnami WordPress option based on the (LAMP/LEMP) technology stack you prefer. If you are not sure just select the LEMP option.

bitnami wordpress lamp lemp ssl

Select the AWS region and associated AWS key, then hit the launch button. Your WordPress server will be ready to use in 5 minutes!

Launch WordPress on a clean Debian/Ubuntu AMI

Sign-in to your user account and locate the WordPress on LAMP technology stack offered by iWebz.

iwebz wordpress lamp debian ubuntu

Select the AWS region and associated AWS key, then hit the launch button. We will be taking a few more minutes to install and configure WordPress and it’s dependencies after launching the base Debian/Ubuntu AMI.

In this case, your WordPress server will be ready to use in 15 minutes!

Thats all… you are done with installing WordPress on an Amazon EC2 instance!

cloudpanel on debian

5 Minute CloudPanel Install on Debian in Amazon EC2

Cloud Panel

cloudpanel logoCloudPanel is a free server control panel for deploying PHP apps, built for maximum performance and security in the cloud. With CloudPanel you can add domains, users, databases, and much more in no time.

CloudPanel is free, open-source software. So you can also self-host it on your own Amazon EC2 instance (cloud server) without any software license fees. You get charged only for your own actual usage of AWS resources.

The CloudPanel technology stack consists of:

  • Debian Linux OS, nginx web server, MySQL database server, php-fpm (LEMP stack)
  • Redis data store
  • Node.js JavaScript runtime
  • ProFTPD SFTP server

How long do you think you will take to install these softwares and then setup CloudPanel on them on AWS?

Let us see how long you will take using our one-click AMI launcher service!

Launch the official CloudPanel AMI

Once you sign-in, look for the CloudPanel EC2 launcher in the list of one-click launchers.

cloudpanel lemp stack ami launcher

Choose the desired AWS region to deply to and the region-based AWS key, then hit the launch button next to it.

Thats all, you’re done with the install!

You can now access your CloudPanel controlled cloud server using a web browser. know more

OPTIONAL: Access the server via SSH

SSH into the new Ubuntu instance using an SSH client (we suggest Muon) with the SSH PEM Key downloaded from your launch history page with the SSH username displayed there.

install sandstorm apps on ubuntu lts

10 Minute Install of Sandstorm Apps on Ubuntu in Amazon EC2

Sandstorm is an open-source platform that enables non-technical end users to install and run productivity apps on private servers. Over 70+ Apps may be downloaded from an app store and installed with one click, like installing apps on your phone.

Each app runs in it’s own secure sandbox, where it cannot interfere with other apps without permission.

We have simplified the process of setting up a cloud server so you can be up and running with a self-hosted Sandstorm private cloud server in your Amazon EC2 in a matter of minutes!

We assume you have already signed-up on our website and added atleast one set of AWS Keys to your user account.

Step 1 – Launch Ubuntu

Look for the Sandstorm-ready Ubuntu one-click EC2 launcher after sign-in.

It is important you select this version instead of the plain Ubuntu so that the correct seurity group settings can be put in place for running Sandstorm apps.

sandstorm-ready ubuntu-listing

Click the launch button to spin-up a fresh Ubuntu LTS server in your AWS Cloud (Amazon EC2) with sandstorm security group settings.

Thats all… you’re done with this step!

In the background our one-click EC2 launcher will spin-up a freshly installed Ubuntu LTS server EC2 instance from an official Ubuntu AMI with EBS storage allocated for system disks. It will also assign an AWS Elastic IP (static IP), and setup firewall rules (AWS Security Group) for all the required ports for Sandstorm. A PEM key will also be issued from AWS for SSH access and attached to the EC2 instance.

Step 2 – Install and Setup Sandstorm

SSH into the new Ubuntu instance using an SSH client (we suggest Muon) with the SSH PEM Key downloaded from your launch history page with the SSH username displayed there.

Once signed-in to the EC2 instance via SSH you need to start Sandstorm’s installation wizard. Just download and run the installation wizard script by running one command. Copy-paste the following line into your SSH client to save time and execute it:
curl https://install.sandstorm.io | bash

The two screenshots below show the complete Sandstorm install wizard from start to finish.

Follow the instructions and provide inputs as needed. It just takes a couple of minutes to install.

As you can see in the last screenshot above, at the end of the installation you are given an admin link to setup Sandstorm in a web browser so you can customize it to your needs. official install instructions

Conclusion

In this post we have seen how to quickly launch a Ubuntu server on Amazon EC2 followed by installation of Sandstorm on the server. At the end you have a working self-hosted Sandstorm personal apps platform on which you can securely run multiple instances each of 70+ productivity apps.