How to connect s3 bucket to wordpress using wp offload media lite plugin

An Amazon S3 bucket is a public cloud storage resource available in (AWS). s3 a object storage offering. Amazon S3 buckets, which are similar to file folders, store media, which consists of data and its descriptive metadata.

Let’s started

Go to the AWS control panel and then the s3 bucket.
create an s3 bucket same as my screenshot.

Enter the bucket and click on the permission tab. then you have to off block all public access.

then we would have to add a bucket policy.

{
    "Version": "2008-10-17",
    "Statement": [
        {
            "Sid": "AllowPublicRead",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::arifwork/*"      //replace your bucket name
        }
    ]
}


then go to the IAM. we have to create a user. so click on the ‘User” and enter a user name.

then click on the attached existing policies directly then you will get create policy button. click on the create policy button


{
	"Version": "2012-10-17",
	"Statement": [
	{
		"Effect": "Allow",
		"Action": [
			"s3:CreateBucket",
			"s3:DeleteObject",
			"s3:Put*",
			"s3:Get*",
			"s3:List*"
		],
		"Resource": [
			"arn:aws:s3:::bucketname",
			"arn:aws:s3:::bucketname/*"     //replace your bucket name
		]
	}
	]
}



In the end, you have to add the plugin. the name of the plugin is “wp offload media lite” after active the plugin and enter the plugin settings. you will get a code like

define( 'AS3CF_SETTINGS', serialize( array(
	'provider' => 'aws',
	'access-key-id' => '********************',
	'secret-access-key' => '**************************************',
) ) );

you paste the code on your wp-config.php file. then paste the access key and secret id on the code.

Leave a Reply

Your email address will not be published. Required fields are marked *