You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多
文档控制台
免费开始使用

如何在AWS Route53中删除旧子域名并创建新子域名完成指向迁移?

Got it, let's walk through this process step by step to ensure your domain changes happen smoothly without downtime or broken links. Here's exactly what you need to do:

1. First, create the new subdomain ask02.helloword.com (don't delete the old one yet!)

We'll set up the new record first to avoid any service interruption:

  • Log into your AWS Management Console and navigate to the Route53 service.
  • In the "Hosted zones" section, find and select your helloword.com hosted zone.
  • Click Create record to add the new subdomain:
    • For the Record name, enter ask02 (Route53 will automatically append .helloword.com).
    • Match the Record type to whatever ask01.helloword.com uses (e.g., A, AAAA, CNAME, or Alias).
    • Copy the Value exactly from the existing ask01 record (this ensures the new subdomain points to the same backend resource).
    • Leave the TTL (seconds) as is for now, or set it to a lower value (like 300 seconds = 5 minutes) if you want faster propagation later.
    • Click Create records to save.

This is the most critical part—you need to update every place that references the old subdomain:

  • Internal resources: Update documentation, team wikis, internal tools, and any configuration files (e.g., app settings, environment variables) that use ask01.helloword.com.
  • External services: If you use third-party tools (like OAuth providers, webhooks, or API clients), update their callback URLs or endpoint addresses to point to ask02.
  • Website/application links: If ask01 is part of a website, update all internal links, image sources, and script references to use the new subdomain.
  • Add a permanent 301 redirect: To catch any users or bots still accessing the old subdomain, set up a redirect from ask01 to ask02:
    • If your backend is a web server (Nginx/Apache), add a redirect rule. For example, in Nginx:
      server {
          server_name ask01.helloword.com;
          return 301 $scheme://ask02.helloword.com$request_uri;
      }
      
    • If you're using AWS services, you can use CloudFront or an S3 static website bucket to handle the redirect (configure the bucket to redirect all requests to ask02.helloword.com and point the ask01 Route53 record to it as an Alias).

3. Verify the new subdomain works correctly

Before deleting the old record, confirm everything is functioning:

  • Test accessing ask02.helloword.com in a browser and check that all content/services load as expected.
  • Use tools like ping or nslookup to verify the DNS record has propagated (note: propagation can take up to 48 hours, but lower TTL values speed this up).
  • Check any automated workflows or third-party integrations to ensure they're using the new subdomain successfully.
  • Monitor traffic to ensure users are being redirected properly if you set up the 301 rule.

4. Delete the old subdomain ask01.helloword.com

Once you're 100% sure the new subdomain is working and all dependencies are updated:

  • Go back to your helloword.com hosted zone in Route53.
  • Locate the record for ask01.helloword.com.
  • Select the record, click Delete records, and confirm the deletion.

Pro Tips to Avoid Headaches

  • Lower TTL first: A day before making changes, edit the ask01 record's TTL to 300 seconds (5 minutes). This reduces the time DNS changes take to propagate, minimizing downtime if something goes wrong.
  • Double-check for hardcoded values: Search through codebases, databases, and configuration files for any hidden references to ask01—it's easy to miss these!
  • Wait a few days before fully retiring the old subdomain: Even after redirects are set up, some users might have cached the old address. Keeping the redirect in place for a week or two ensures a smooth transition.

内容的提问来源于stack exchange,提问作者Shahid Rasool

火山引擎 最新活动