I successfully uploaded files in amazon s3 storage bucket with private mode.I need to access the file with in my default time. Am using luman laravel for my application
Here my code to get file:
$bucket="liv";
$resource="Arsenal-Wallpapers.jpeg";
$folde="testr";
$AWS_S3_KEY="AKIAJ7SN435435CGBIEEB3CRLA";
$AWS_s3_secret_key="dJnfWNcKY2A45435ddT4W0NduCdg7+voVnDialbF0dvgr";
$expire_seconds="1000";
$expires = time()+$expire_seconds;
// S3 Signed URL creation
$string_to_sign = "GET\n\n\n{$expires}\n/".str_replace("s3.ap-south-1.amazonaws.com","", $bucket)."/$folder"."/$resource";
$signature = urlencode((hash_hmac("sha256", utf8_encode($string_to_sign), $AWS_s3_secret_key, TRUE)));
$authentication_params = "AWSAccessKeyId=".$AWS_S3_KEY;
$authentication_params.= "&Expires={$expires}";
$authentication_params.= "&Signature={$signature}";
return $link = "https://s3.ap-south-1.amazonaws.com/{$bucket}/{$folder}/{$resource}?{$authentication_params}";
When i hit api to get access the file from s3 storage .I got issue
InvalidRequest
The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256. Id>85DAE9708BDF8514 zjhhQ+iJ3q3z8goBtMdRLfTdla5QAqaFCqQCdIRVxVjdWtykam3+NzNv/+gMgPmepTLkyi9So+c=
But am using AWS4-HMAC-SHA256 authorization mechanism to access the file.I dont know where am wrong .kindly help me for this problem.