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.

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
전문가
답변함 일 년 전
profile picture
전문가
검토됨 7달 전
  • Perhaps thats something the developers should have presented to you as the solution as they should be aware of the setup

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠