Moving your website to a CDN

How to setup and configure an Amazon CloudFront CDN for your WordPress website

Create an Identity and Access Management (IAM) User


Identity and Access Management (IAM) allows you to manage all user access to AWS resources and services. Before you can use S3, you need to create an IAM user.

  • From your AWS Console, click Identity & Access Management.
  • Click Users, then Create New Users.
  • Enter a descriptive user name and click Create.
  • View the new user security credentials by clicking Show User Security Credentials.

 

    • Note: You can only view or download a user's secret access key immediately after the user has been created. This information cannot be accessed at a later point in time.

 

  • Click Download Credentials.

  

Make sure you save the credentials in a secure location before leaving this page. You will need the access keys when configuring the Amazon S3 and CloudFront plugin.

 

Assign User Privileges


Now you need to give the new user permission to manage S3 (Amazon Simple Storage Service), because that is where assets are stored.

  • From the Users page, select your new user.
  • In the Permissions section, click Attach Policy.
  • Select AmazonS3FullAccess and click Attach Policy.

  

You now have a user with full S3 access and are ready to configure WordPress.

 

Configure CloudFront on WordPress


There are several plugins that will help you manage cached assets in WordPress with CloudFront; however, for the sole purpose of incorporating CloudFront, this article uses the Amazon S3 and CloudFront plugin.

 

Install the Amazon S3 and CloudFront Plugin via the WordPress Dashboard


Access your WordPress Dashboard by appending /wp-admin to your website URL and log in using your WordPress credentials.

  • Click Plugins, then select Add New.
  • Paste the name of the plugin in the Search Plugins box and press enter.
  • Find Amazon S3 and CloudFront and click Install Now.
  • Click OK to confirm the installation.
  • Click Activate Plugin. You are now directed to the Plugin page of your WordPress Dashboard to install and activate the plugin.
  • Click Install it, then Activate Plugin.

 

Configure the Amazon S3 and CloudFront Plugin


From within your WordPress Dashboard:

  • Click AWS and select Settings.

 

    • Note: You already have your AWS user credentials, as they were generated in the steps above. For security reasons, you should not provide user credentials within the Settings page of this plugin as it will not be stored securely in the site's database.

 

  • Add the provided code to the wp-config.php file located at the web root of your WordPress site using FTP (replace the stars with your user credentials):

 

    • define( 'AWS_ACCESS_KEY_ID', '********************' );
      define( 'AWS_SECRET_ACCESS_KEY', '****************************************' );
  • Click AWS, then S3 and CloudFront from within your WordPress Dashboard.
  • Create a new bucket by entering a unique name, and then click Create.
  • Ensure that "Copy Files to S3" and "Rewrite File URLs" are both set to ON.

  

There are several other options available within this plugin for you to experiment with. Take a tour of the settings to find the best configuration for your particular use case.


Test Amazon S3


Follow these steps within your WordPress Dashboard to test CloudFront:


  • Click Media and upload a new image.
  • Once the image has uploaded, click on the image thumbnail to view attachment details.
  • Verify the image URL.

  

If the URL contains your newly created S3 bucket, then you have followed all steps correctly and have successfully configured Amazon S3 services. If you still see your Pantheon Development URL, start over and repeat the previous steps.

 

Set up CloudFront


Now for the final step: turning on Amazon CloudFront. These combined services will automatically distribute your media globally so your pages will load fast around the world.

  • Access the CloudFront home page from within your Amazon Console.
  • Click Create Distribution.
  • From within the Web section, click Get Started.
  • In the Origin Name field, select your recently created S3 bucket. This will automatically populate the Origin ID field.
  • You can use the default configurations for the other options or tweak them as you need.
  • Click Create Distribution.

  

You're now sent to the CloudFront Distributions page. You will notice that your distribution is enabled and the status is "In Progress". The amount of time this initial setup takes depends on the size of your media library. Once complete, Amazon CloudFront will serve all of your media.

 



link to document - 


    • Related Articles

    • Why You Need a CDN For Your Website

      What is a CDN?   A CDN is a Content Delivery Network - basically a network of servers that deliver content from websites to users based on the geographic location of the user.   When a user comes to your website, they are redirected to your website's ...
    • Skills That Media Motion Brings To The Table

      We have wide variety of skills that we can bring to the table as a Virtual Assistant. Our skills are mostly at a mid to senior level. If you are looking for a Virtual Assistant to answer the phone or make reservations for your business trips, we are ...
    • Collect Past Due Invoices

      In one of the Blog articles on our website, Bookkeeping Virtual Assistant, we talk about the importance of bookkeeping. Bookkeeping is a funny thing. Business owners either know how to do bookkeeping and are comfortable making the day-to-day entries ...
    • Create And Send Invoices

      In one of the Blog articles on our website, Bookkeeping Virtual Assistant, we talk about the importance of bookkeeping. Bookkeeping is a funny thing. Business owners either know how to do bookkeeping and are comfortable making the day-to-day entries ...
    • We Are a Proven Asset

      There is a section on the home page of the Media Motion Online website where we ask "Why Choose Us?" That is one of the primary questions that is asked. Our answer is that we are a proven asset with a history of delivering effective results. An asset ...