[HOWTO] XenForo attachments via Amazon S3 and CloudFlare

Discussion in 'Other' started by xfrocks, May 3, 2013.

  1. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Prerequisite:
    Step 1. Obtain Amazon Web Services Security Credentials

    Go to https://portal.aws.amazon.com/gp/aws/securityCredentials and login. You may need to create a new one if you haven't had an Amazon account. Click the "Create a new Access Key" link to create a new key pair. Please note that Amazon only allow 2 key pairs per account so you will not see the create link if your account has already reached the limit.
    Screen Shot 2013-05-03 at 12.50.18 PM.png

    Step 2. Create an Amazon S3 bucket

    Go to https://console.aws.amazon.com/s3/home and sign up for the service if asked. Click the "Create Bucket" button and start fill in the bucket name and select a region for your bucket. A few things to remember:
    • If you plan to use subdomain link for the attachment, you need to enter the subdomain as your bucket name. For example, for this website I want to access the attachment via the subdomain attachments.xfrocks.com, I will use it as the bucket name.
    • You should select the region closest to your primary audience for best result. The cost for each region is different, so take that into account when you decide too. More information here.
    Screen Shot 2013-05-03 at 12.58.17 PM.png
    Step 3. Configure [bd] Attachment Store

    Go to AdminCP > Home > Options > Attachments, look for the option [bd] Attachment Store and select "Store files in Amazon S3". You will need to fill out the key ID and secret from step 1. The bucket name and region from step 3. You can optionally change the "Protocol" if you don't want it to be auto-detected: by default, the S3 link will use the same protocol (https or http) as your page to prevent security warnings.
    Screen Shot 2013-05-03 at 1.03.30 PM.png
    Step 4. Configure subdomain/CloudFlare

    If you decided to follow the subdomain approach, you can use CloudFlare free service to reduce the Amazon S3 cost by routing requests through CloudFlare before they hit Amazon servers. If you don't use CloudFlare, you still need to configure your subdomain or your attachment links will not work. Below is the instruction to set it up with CloudFlare.
    Go to https://www.cloudflare.com/my-websites and click "DNS Settings" for your website. Create a new CNAME record with your subdomain as the name and <bucket-name>.s3.amazonaws.com as the value. Make sure you enable CloudFlare for the new subdomain (the orange cloud).
    Screen Shot 2013-05-03 at 1.12.39 PM.png
    Upon saving, it should look like this:
    Screen Shot 2013-05-03 at 1.14.56 PM.png

    And you are done! All images in this HOWTO are attachments served via Amazon S3/CloudFlare.
     
    Big Dan likes this.
  2. hlchia

    hlchia New Member

    For using sub-domain as the bucket name in your illustration i.e. " attachments.xfrocks.com", do we need to create the sub-domain "attachements" in our web hosting cpanel?
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @hlchia You do not need to create it in your hosting server but you must create the subdomain record either via your domain manager or via CloudFlare (if you use their service).
       
  3. hlchia

    hlchia New Member

    Hi, can point me to how to create the subdomain record either domain manager? I am using cpanel
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

  4. Andy

    Andy Member

    Do you mean the latest update for Cloudfront or Cloudflare?
     
  5. Andy

    Andy Member

    Arg, my bad. One addon, two separate similar looking threads :)
     
    xfrocks likes this.
  6. MattW

    MattW Member

    Just to point out, this guide will also work with cdn77.com ;)
     
    xfrocks likes this.
    1. RoldanLT

      RoldanLT Active Member

      RoldanLT @MattW Does it have storage option also? No just CDN?
       
    2. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @RoldanLT CDN77 has CDN only as far as I know.
       
      RoldanLT likes this.
      1
  7. BamaStangGuy

    BamaStangGuy New Member

    Can you simply just have the images served straight from Amazon S3 instead of using a CDN?
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @BamaStangGuy Yes, you can do that. But Amazon stated that S3 is a storage solution, serving straight from S3 may not be the best idea for performance.
       
  8. thienbui

    thienbui Member

    #15 thienbui, Oct 17, 2015
    Last edited: Oct 17, 2015
    Mình thục hiện tất cả các bước như trên ok hết rồi nhưng thấy vẫn bình thường không biết addon đã hoạt động chưa.
    Mình hỏi thêm là đính kèm chuyển qua amazon bên đó họ lưu ở chô nào mình có thể quản lý được không và không gian ổ đia bên đó họ cấp cho mình như thế nào?
    Mình có phải làm theo hướng dẫn bài này nưa không cloudfront.60?
    Hay chỉ sử dụng 1 trong hai cái cloudfront or CloudFlare
    Thanks you.
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @thienbui Chỉ sử dụng hoặc CloudFront hoặc CloudFlare thôi bạn nhé. Với file cũ bạn phải chạy rebuilder để cập nhật nơi lưu mới cho nó. Các file mới upload sau khi cấu hình add-on thì sẽ đúng chỗ luôn.
       
    2. thienbui

      thienbui Member

      thienbui @xfrocks Trời mình chới cả hai cái luôn rồi đang rebuil không biết có sao không nữa :)
       
      xfrocks likes this.
      1
  9. kappadox

    kappadox New Member

    I bought the hello plug-in, but I think I did something wrong. Can you help me.
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @kappadox What is your issue?
       
    2. kappadox

      kappadox New Member

      kappadox @xfrocks All problems fixed. Only but I not make CloudFlare settings. I'm having DNS issues and Step 4. Configure subdomain/CloudFlare I did not set
       
    3. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @kappadox Have you been able to add your domain into CloudFlare? You will need to change your name server with your domain registrar for that FYI.
       
  10. kappadox

    kappadox New Member

    yes add my domain CloudFlare? But dont change NS1 and Ns2 (ram.ns.cloudflare.com) (val.ns.cloudflare.com),

    But Create a new CNAME record with my subdomain

    upload_2017-10-23_8-28-49.png
     
    1. xfrocks

      xfrocks XenForo rocks!
      Staff Member

      xfrocks @kappadox You must change the name server. Otherwise CloudFlare won't work.
       
  11. kappadox

    kappadox New Member

    I will not use CloudFlare because it is a new site. The plugin is nice and thanks very much for working well.
     
    xfrocks likes this.
Loading...