My customer needs a HTTP 301 redirect solution. They have their xyz.com mapped to certain A record along with www.xyz.com mapped to A record. They want scalable cloud native way to handle redirects from https://xyz.com to https://www.xyz.com. HTTPS redirects is a need and they want something integrates with ACM as well.
Some of the things that come to mind are:
-
Create a Lambda function that returns an HTTP 301 response to the request. (Edit - Looks like you can directly use rule based on host header condition in ALB and set redirect action with custom 301 response)
-
Front End the Lambda with ALB: Configure Lambda Function as target for ALB
3A.1 Use Global Accelerator with static IP address to FrontEnd ALB
3A.2 Use the GA static IP address as A record value for your domain that needs redirect.
3B.1 Use NLB with with static IP address to FrontEnd ALB.
3B.2 Use the NLB static IP address as A record value for your domain that needs redirect.
Any other suggestions? Or comments on above. Looks like CNAME won’t work as we have apex domain involved. Their DNS is not hosted on AWS.
Looking for suggestions on using API Gateway or Cloudfront Lambda @ Edge if possible. My doubt is only because of A record need as DNS is not in Route53.