Allan Posadas
Allan Posadas

Reputation: 11

why is my S3 TemporaryURL no longer working

My laravel controller has this code that would generate a temporary URL for my files on S3 and send it to the users for temporary access.

here is the code:

return Storage::disk('s3')->temporaryUrl('Reports/report_signed2.pdf', now()->addMinutes(1));

I have configured my s3 storage properly and this is used to be working until recently, the url returns Denied Access.

Did some changes implemented in AWS s3 security and need some updating to my bucket or iam? I did not change anything to policies to my IAM.

My IAM has three Policies:

  1. AmazonS3FullAccess
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:*",
                "s3-object-lambda:*"
            ],
            "Resource": "*"
        }
    ]
}
  1. iaminlinepolicy
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetObject",
                "s3:DeleteObject",
                "s3:GetObjectAcl",
                "s3:PutObjectAcl",
                "s3:PutObject",
                "s3:GetAccessGrants"
            ],
            "Resource": [
                "arn:aws:s3:::hris-pangasinan",
                "arn:aws:s3:::hris-pangasinan/*"
            ]
        }
    ]
}
  1. laravel-policy
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListBucket",
                "s3:GetObject",
                "s3:DeleteObject",
                "s3:GetObjectAcl",
                "s3:PutObjectAcl",
                "s3:PutObject",
                "s3:GetAccessGrants"
            ],
            "Resource": [
                "arn:aws:s3:::hris-pangasinan",
                "arn:aws:s3:::hris-pangasinan/*"
            ]
        }
    ]
}

Thank you very much

I have been experimenting but to no avail.

Upvotes: 1

Views: 406

Answers (0)

Related Questions