S3 content redirects for multiple files

0

I am aware of how to redirect s3 bucket items using the metadata, but this works only for files that exist. Our developers archived and deleted over 500 files as a routine process and asked to have them redirected.

I have been looking for various solutions on how to resolve the dilemma of applying a redirect to the now missing content to another URL. I have read how to use advanced conditional redirects but it indicates that there's a limit of 50 items maximum that can be applied to the s3 bucket properties on the static web hosting. I'm trying to understand if that's 50 specific rules or 50 items objects that can have multiple redirects using a conditional. Would one behavior with 550+ removed items redirecting elsewhere (new url) count as one object, I've read elsewhere this doesn't work well. and is there any notable performance or impact in approaching it in this method?

I know its possible to create redirects in cloudfront by adding a behavior and developing a script to negotiate all the redirects similar to the above-mentioned approach.

已提問 8 個月前檢視次數 230 次
1 個回答
0

If you're already using CloudFront, you can use Lambda@Edge, which lets you run Lambda functions to customize content AWS delivers through CloudFront. You can store the origin and destination URL in a simple map and use simple match and replace functions to process redirects at the edge locations.

Remember that the Lambda@Edge needs to be deployed in us-east-1 and will record logs in the region from which the user accessed it.

Here are some links that are a good reference for what you're trying to build:

If the answer is helpful, please click "Accept Answer" and upvote it.

profile picture
專家
已回答 8 個月前
profile picture
專家
已審閱 2 個月前
  • Perhaps thats something the developers should have presented to you as the solution as they should be aware of the setup

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南