How to store WordPress media files to Amazon S3 bucket

Поделиться
HTML-код
  • Опубликовано: 28 сен 2024
  • Today in this video, we are going to learn how to store the WordPress media files in the S3 bucket of AWS.
    Login to the AWS console.
    In S3, before creating an s3 bucket, navigate to block public access settings for this account. In block public access settings, click on the edit button. Here uncheck the first two checkboxes and check the last two checkboxes.
    Now it's time to create the s3 bucket to store all the media files of the WordPress site. In the buckets section, create a new bucket. Give an appropriate name of the bucket. Select your current region. ACLs disable recommended, fine.
    Block public access settings, checked the option same as previous. Unchecked the two options and checked the last two options.
    Acknowledge public access.
    Create Bucket.
    Navigate to the IAM page. Before creating a new user, let’s create a separate policy for it.
    Create Policy.
    Open the JSON tab.
    Paste the policy code.
    {
    "Version": "2012-10-17",
    "Statement": [{
    "Sid": "VisualEditor0",
    "Effect": "Allow",
    "Action": [
    "s3:PutObject",
    "s3:GetObjectAcl",
    "s3:GetObject",
    "s3:PutBucketAcl",
    "s3:ListBucket",
    "s3:DeleteObject",
    "s3:GetBucketAcl",
    "s3:GetBucketLocation",
    "s3:PutObjectAcl"
    ],
    "Resource": [
    "arn:aws:s3:::your bucket name",
    "arn:aws:s3:::your bucket name/*"
    ]
    }
    ]
    }
    Copy the bucket name, and paste it. Here as well.
    Provide an appropriate name for the policy. Describe the policy so that it can help in the future to understand for what purpose this policy was created.
    Create policy.
    Navigate to the user's page.
    Click the add users button to add a new user who can access our s3 bucket.
    Provide an appropriate name for it.
    In the select AWS access type, checked the access key programmatic access.
    Select the attach existing policies directly option. Search for the policy which you have just created before. Here it is mine, select it.
    Create user.
    Copy the access key id and secret access key which we need to configure in our WordPress site to give access to our s3 bucket.
    Please don’t forget to save it properly coz we can’t view it again as we close this page.
    Ok, now it's time to move to the WordPress site.
    Let’s install a fresh WordPress site.
    Currently, I'm working on the default theme.
    Navigate to the Plugin menu, and add a new plugin. Search plugin wp offload - wp offload media lite for Amazon s3.
    Install it - Activate it as well.
    Open the plugin setting page.
    You must set your storage provider access credentials to enable bucket access.
    Select Provider - we are using Amazon s3
    Connection method - define access keys in the wp-config.php file.
    Copy the code and navigate to the wp-config file.
    Paste the code.
    Add any custom values between this line and the stop editing line.
    We need to replace the * with the access key id and secret access key.
    Navigate back to settings, here the page will refresh automatically.
    Refresh the page.
    Copy the bucket name and paste it.
    Save bucket settings.
    Here both block all public access and object ownership are disabled. Which should be disabled and if we try to enable it, it will not be allowed to do so.
    Could not change block all public access status for a bucket.
    We are not storing any media files locally. So enable remove local media option as well.
    In check in delivery settings. I'm using HTTPS on the site so let’s enable the force HTTPS option as well.
    Save changes.
    Check whether it is all fine or not by uploading images to the media.
    Open the Media library and add new. Select files.
    The path of the image is in the local system, not in the s3 bucket.
    Delete the image and go for the solution.
    Navigate to the wp offload media lite plugin setting, and check all settings. Seems all fine.
    What we have to do over here is, we have to enable both - block all public access and object ownership for once and disable it again.
    Update changes, - could not change it.
    For that, we have to assign the current IAM user to the s3 bucket full access once.
    Navigate to the IAM page on AWS.
    Click on the add permission button.
    Again select the same option - attach existing policies directly and search for s3.
    Amazon s3 full access - checked it.
    Navigate back to the offload setting. Let’s refresh once before we process ahead.
    Enable both security settings.
    Settings locked, requesting refresh the page.
    Warnings. Disable it again.
    Update bucket security.
    Upload image to the media library.
    Check the path of the image.
    In this way, we can set up and manage to store all media files of the WordPress site in the AWS s3 bucket.
    SUBSCRIBE to our RUclips channel for more videos: www.youtube.co...
    Like us on Facebook: / master2teach
    For more content go to master2teach.com/

Комментарии • 25

  • @Bromoteknada
    @Bromoteknada Год назад +4

    Great! But what if for some reason we need to change our media again from s3 to self-hosted without breaking our url's?

  • @felipemunoz1533
    @felipemunoz1533 Год назад +2

    this tutorial is gold! All correct. Thanks a lot

    • @Master2Teach
      @Master2Teach  Год назад

      Thank you for your comment. Pls don't forget to like, share, and subscribe to the channel.

  • @kberwager
    @kberwager Месяц назад +1

    How do we include the BuddyPress directory? I see that it's separate from the Media Library.

    • @LufyNightcrows
      @LufyNightcrows 21 день назад

      I also want to know, can you help me?

  • @ajgotinsain27
    @ajgotinsain27 7 месяцев назад +1

    How can we replace the existing files URLs with S3 URLs ?

  • @saikatkumarshil251
    @saikatkumarshil251 8 месяцев назад

    Hello, great video, but I am getting the error below, how can i fix this issue?
    Offloaded media URLs may be broken. An error was encountered while testing the domain: Received 403 from endpoint

  • @cloudexpert3418
    @cloudexpert3418 Год назад

    Great tutorial. Thanks alot.

  • @amineboualaoui6590
    @amineboualaoui6590 Год назад +5

    at 03:55 you select Access Key - programmatic access ... now it doesn't show that ... what should we do instead please ?? thank you

  • @ovinenyalazi8104
    @ovinenyalazi8104 Год назад

    Awesome tutorial.

  • @grinfluencers
    @grinfluencers Год назад

    Thank you very much 🙂

  • @Noobs-play65
    @Noobs-play65 Год назад

    Nicely explained!! I'm planning to use this same plugin in my WordPress site I just want to know if this is a completely free plugin?

  • @jesuarriaga2986
    @jesuarriaga2986 Год назад

    hello, excellent video. a query, perform all the steps, and upload files that are already hosted in the bucket, but when using them in my wordpress mp3 recorder they do not play, they appear but do not play.

  • @SanjayKumar-li8pc
    @SanjayKumar-li8pc Год назад

    hello, once i remove policy amazon s3 full access again store file on server? and again add amazons3full aceess then work fine? please help me

  • @webpack1705
    @webpack1705 Год назад

    How to configure aws cloudfront as well?

  • @BirendraChaudhary-qi8jo
    @BirendraChaudhary-qi8jo 10 дней назад

    when we upload it is uploading on both bucket and server what will be the solution???help

  • @grinfluencers
    @grinfluencers Год назад

    Hi, it´s working perfect :-) ,but, the problem I have, is that I´m using BuddyBoss Them & BuddyBoss Platform Pro Plugn, and it´s still upload media from wordpress path and not, AWS path. Any idea, about how to solve it? Thank you in advance for your help!

  • @parfumegue5463
    @parfumegue5463 Год назад

    Thanks Master2Teach it's clear now to me.

  • @buzzsubash
    @buzzsubash Год назад

    Great tutorial, thank you !

  • @markuspatzer8658
    @markuspatzer8658 9 месяцев назад

    For me it makes no sense to store wp media files in wp media and in a separate cloud. The fuller your wordpress media library gets, then slower will be your site loading. Is it not better upload your media files from your local pc direct to the s3 bucket, then copy the link to insert it in a wp page/ post?

  • @mrjunaidali
    @mrjunaidali Год назад +1

    Hi, thannks for details. how about moving existing media? and also if threre is any limit?

  • @adrianforster4956
    @adrianforster4956 Год назад +1

    Thanks for this great tutorial. Delicious Brains havent managed to do this themselves. Much appreciated.
    If poss can you record another HOw to regarding the CDN set up?