Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS S3 Redirection rules not letting me saving it

I tried to create an image resizer lambda function and for that I use S3 bucket for storage, but when I try to add Redirection rules under S3 properties it does not allow me to save it. It keep giving me error

(Unknown Error
An unexpected error occurred.
API response
Expected params.WebsiteConfiguration.RoutingRules to be an Array)

this is the redirect rule I'm trying to add

<RoutingRules>
    <RoutingRule>
        <Condition>
            <KeyPrefixEquals/>
            <HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
        </Condition>
        <Redirect>
            <Protocol>https</Protocol>
            <HostName>API-endpoint</HostName>
            <ReplaceKeyPrefixWith>prod/resize?key=</ReplaceKeyPrefixWith>
            <HttpRedirectCode>307</HttpRedirectCode>
        </Redirect>
    </RoutingRule>
</RoutingRules>
like image 547
lbudwal Avatar asked Oct 29 '20 20:10

lbudwal


People also ask

How do I save on my S3?

Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/ . In the Buckets list, choose the name of the bucket that you want to upload your folders or files to. Choose Upload.

How do I enable S3 PutBucketPolicy action?

In the Permissions tab of your IAM identity, expand each policy to view its JSON policy document. 5. In the JSON policy documents, search for policies related to Amazon S3 access. Then, confirm that you have permissions for the s3:GetBucketPolicy and s3:PutBucketPolicy actions on the bucket.

Is S3 path case sensitive?

Unlike standard Windows file systems, the Amazon S3 storage is case-sensitive. To ensure consistent behavior, Kentico automatically converts all file and folder names to lower case when processing files on Amazon S3.


1 Answers

GOT IT WORKING

Following definition works:

[
    {
        "Condition": {
            "HttpErrorCodeReturnedEquals": "404"
        },
        "Redirect": {
            "Protocol": "https",
            "HostName": "<host>",
            "ReplaceKeyPrefixWith": "<prefix>",
            "HttpRedirectCode": "307"
        }
    }
]
like image 59
Andrei Tchijov Avatar answered Sep 22 '22 08:09

Andrei Tchijov