Bridging Domains:How to Migrate From GoDaddy to AWS S3 in Style!

Written by aryanguls | Published 2023/10/22
Tech Story Tags: website-hosting | devops | aws-s3 | godaddy-domain | aws-s3-bucket | godaddy-to-aws-s3 | website-hosting-in-aws-s3 | hackernoon-top-story

TLDRJoin us on a journey from securing your own domain with GoDaddy to hosting your website on Amazon Web Services (AWS) S3. Follow a step-by-step guide to ensure a seamless transition into the digital world. Learn how to set up your website, make it secure and efficient, and keep it updated. Finally, celebrate the launch of your brand-new online presence! 🚀🎉via the TL;DR App

This one is personal.

It was a random Friday evening and I had a ‘simple’ goal: host a static website on AWS S3 with my GoDaddy domain. I mean, how difficult can it be, right? Apparently quite, considering it took 10 articles, 4 tutorials, 2 videos, and an entire day of trying everything the internet had to offer.

But fret not! Your journey will be far smoother. Let’s embark on this adventure together, starting with the first and fundamental step: snagging yourself a catchy domain.

Content Overview

  • GoDaddy: Securing Your Slice of the Internet Pie!
  • Amazon Web Services: Where Websites Fly First Class
  • Migrating GoDaddy Domain to AWS S3 Bucket
  • Webmaster: Smooth Updates for Your Shiny, New Site
  • Celebration Time: You’re Live!

GoDaddy: Securing Your Slice of the Internet Pie!

(Learn how to acquire and set up a personal domain with GoDaddy.)

So, you’ve decided to establish your own little corner on the web. Exciting times ahead! Let’s begin with the basics: acquiring a domain.

Step 1: Choose Your Domain

Start by brainstorming a unique and memorable domain name that represents you or your project well. Keep it short, sweet, and easy to spell. Once you have a few options in mind, it’s time to head over to GoDaddy’s website.

Step 2: Search and Select

On GoDaddy’s homepage, enter your desired domain name into the search bar. If your first choice is taken, don’t despair! GoDaddy will offer alternative suggestions, or you can try a variation of your initial idea. Once you find an available domain that you love, add it to your cart by clicking on the Make it Yours button.

Step 3: Customize and Checkout

GoDaddy will offer various add-ons and options, like privacy protection and professional email addresses (<username>@yourdomain). Review these offerings, select the ones that fit your needs, and proceed to checkout. Complete the transaction, and voila, the domain is yours!

Step 4: Setup and Configuration

Now, with the domain in your possession, there might be a few setup steps and changes before it shows up on your desired URL. Configure your domain settings, connect it to your hosting (which we’ll dive into next), and ensure everything is in tip-top shape for launch. For this part of the setup we’ll be visiting your domain’s DNS Records and Forwarding rules.

And just like that, you’ve successfully secured your slice of the internet pie with GoDaddy! Stay tuned as we navigate through the next phase of our digital journey: hosting with AWS S3.

Amazon Web Services: Where Websites Fly First Class

(Introduction to hosting your website on Amazon Web Services’ S3.)

Welcome to the powerhouse of the internet: Amazon Web Services (AWS). If the web were an ocean, AWS would be its mightiest vessel, and today, you’re coming aboard to host your website in style.

Step 1: Navigating the AWS Landscape

AWS is vast, with a myriad of services that can be overwhelming for first-timers. Either log-in to your existing AWS account or create a new one.

  • Familiarizing Yourself: Upon first login to AWS, you’ll encounter the AWS Management Console. It’s your control center for AWS services, so take a moment to explore its layout. Notice the ‘Services’ dropdown at the top left, your go-to hub for all AWS offerings.

  • Finding S3: Under the ‘Services’ dropdown, you’ll find ‘S3’ listed under the ‘Storage’ category. Click on ‘S3’ to enter the S3 console, where you’ll be managing your static website hosting.

Step 2: Creating an S3 Bucket

Think of a bucket as a storage unit for your website. Click on the ‘Create Bucket’ button. Here, you’ll name your bucket (usually, this should match your domain name for simplicity but its fine to name it anything you like), select a region closest to your target audience, and follow through with the default settings for now.

  • Naming Your Bucket: Under the S3 console, click the blue ‘Create bucket’ button. A window appears prompting you for a bucket name. Select a name closely matching your domain for consistency.

  • Selecting Regions: Pick a region close to your audience to minimize latency. Each region corresponds to a specific geographical area. For me personally, I always prefer using US East regions since I am based in the US and also because it helps with SSL certification process on AWS (more on this in the next section).

  • Reviewing Settings: While many settings are fine at default, glance through each option and get acquainted. You’ll likely not need to adjust much here, but familiarity is key for future troubleshooting and adjustments.

Step 3: Configuring the Bucket

Once your bucket is ready, it’s time for some configurations. Set the properties and permissions to make your bucket public (as it is private by default), enabling people to view your website. You’ll also set up static website hosting here by enabling the feature and designating your index and error documents.

  • Public Access Settings: Uncheck “Block all public access” to allow users to access the bucket files. This is what it should look like post allowing access.

Step 4: Uploading Content and Making it Public

With everything set up, you’re ready to upload your website’s files to the bucket. Simply drag and drop, or manually upload your HTML, CSS, and other files into your S3 bucket.

  • Uploading Website Files: Upload your static website files to the new bucket. You can do this using the AWS CLI or by selecting the “Upload” option under the “Objects” tab. Personally I always use the upload option.

  • Enabling Static Website Hosting: Navigate to the “Properties” tab of your bucket and scroll to “Static website hosting”. Click “Edit”, enable static website hosting, and input your default page name (typically ‘index.html’) in the “index” text field. Don’t forget to save your changes!

  • Granting Public Access: Head to the “Permissions” tab and add a bucket policy to grant public read access to your bucket (change YOUR-BUCKET-NAME and add the code provided below). This policy allows anyone on the internet to read the objects in your bucket, so ensure you want your data to be publicly accessible. Be sure to review and understand the policy’s permissions before saving it along with your other changes.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject"
            ],
            "Resource": [
                "arn:aws:s3:::YOUR-BUCKET-NAME/*"
            ]
        }
    ]
}


Step 5: Testing Your Live Site

AWS provides a unique endpoint for your hosted content. Click on this link, and if all is well, you’ll see your static website alive and kicking!

And there you have it! The initial descent into AWS might seem daunting, but with these steps, you’ve not only landed but set up base. Ready for the next adventure? We’ll delve into going live in the upcoming section.

Finally Done: Your Site is Live!

(A walkthrough of successfully hosting your website and seeing it go live.)

Congratulations, you’re almost there! Now, let’s bind everything together by pointing your shiny new GoDaddy domain to the AWS S3 bucket you’ve meticulously set up.

Migrating GoDaddy Domain to AWS S3 Bucket

Step 1: Getting an SSL Certificate with AWS ACM

  • Open AWS Certificate Manager (ACM).

  • Click “Request” to initiate a new certificate and select “Request a public certificate”.

  • Add your domain names — www.your-domain.com & your-domain.com.

  • Choose “DNS Validation”.

  • After certificate creation, two CNAME records will be generated by ACM. Copy both the “CNAME name” and “CNAME value” for later use.

Step 2: Updating DNS Records in GoDaddy

  • Login to your GoDaddy account and navigate to the domain settings of your chosen domain.

  • Go to “Manage DNS” under “Additional Settings”.

  • Add the CNAME records provided by ACM. Repeat this step for both sets of values provided.

  • Set “Type” to “CNAME”.

  • “Name” is the “CNAME name” from ACM omitting the .your-domain.com part from the CNAME name (in this case making it _95c3d23b4c008dfcadeed5b518ed3d1d.www & _2bb2bfda7c66af8c036422465b415a8c).

  • “Value” is the “CNAME value” from ACM (copy as is).

  • Set “TTL” to “Default”.

  • Allow some time for these changes to propagate and the certificate to be validated.

Step 3: Creating AWS CloudFront Distribution

  • Open the CloudFront console on AWS.

  • Click “Create Distribution”.

  • Enter the S3 bucket website URL as the “Origin Domain” (avoid using the auto-suggested link).

  • Under “Viewer Protocol Policy”, select “Redirect HTTP to HTTPS”.

  • Under “Web Application Firewall (WAF)”, select “Enable security protection”.

  • Add “Alternative Domain names (CNAME)” for both your preferred website URLs (www.your-domain.com and your-domain.com) under “Settings”.

  • Choose the previously created ACM certificate under “Custom SSL Certificate”.

  • Complete the distribution creation process and wait for it to deploy (usually 5–10 minutes).

Step 4: Pointing Domain to CloudFront and Final Adjustments

Unfortunately, GoDaddy’s standard DNS service does not support direct ALIAS or ANAME records to CloudFront. Therefore, the best practice is to set up a CNAME for the www subdomain and then redirect the root domain to the www subdomain. You already have a CNAME for www, so let’s modify that.

  • CloudFront Domain Retrieval: Take note of the CloudFront domain name provided upon creating your distribution, resembling dxxxxxxxxxxxxx.cloudfront.net.

  • Updating Root Domain Record: GoDaddy’s standard DNS doesn’t support ALIAS or ANAME records pointing directly to CloudFront for root domains. To address this, set up a CNAME for your www subdomain and redirect the root to www.

  • Adjusting CNAME for www: Modify the existing CNAME record for www subdomain:

  1. Type: CNAME

  2. Name: www

  3. Data: [Your CloudFront domain name]

  4. TTL: 1 Hour (adjust as preferred)

  • Setting Up Root Domain Forwarding: Implement forwarding to redirect traffic from your root domain to the www subdomain:
  1. Go to DNS management for your domain in GoDaddy’s dashboard.
  2. Locate the “Forwarding” section and add “Domain” forwarding.
  3. Forward to: www.your-domain.com
  4. Redirect type: 301 (Permanent)
  5. Settings: Forward only

  • Handling Other Records: Maintain the existing NS, SOA, and _domainconnect records without changes.

  • Propagation Time Consideration: Following these DNS adjustments, propagation might require some time, potentially ranging from immediate to several hours. Utilize tools like DNS Checker to monitor propagation status globally.

Once propagation concludes, accessing your-domain.com or www.your-domain.com should direct users to your site hosted on CloudFront securely via HTTPS.

Webmaster: Smooth Updates for Your Shiny, New Site

(Guidance on updating and maintaining your newly hosted website.)

Updating your static website hosted on AWS S3 is a straightforward process. Follow these steps to ensure your site stays fresh and up-to-date:

Step 1: Accessing AWS S3

  • Log in to your AWS Console.
  • Navigate to the S3 service.
  • Open the bucket hosting your website.

Step 2: Updating Website Files

  • To update existing files:
  • Navigate to the file you wish to replace.
  • Either overwrite this file by uploading a file with the same name or delete the existing file and upload the new version.
  • To add new files, simply upload them to the relevant directory within your bucket.

Step 3: File Permissions (if necessary)

  • When uploading new files, ensure their permissions are set correctly.
  • If your bucket is public, new files should typically be set to ‘public read’ to be accessible to visitors.

Step 4: Clearing Cache (if using CloudFront)

  • If you’re utilizing AWS CloudFront for content delivery, remember that updates might not reflect immediately due to caching.
  • You may need to create an invalidation to clear the cache for updated content to appear.
  • Navigate to your CloudFront distribution, go to the ‘Invalidations’ tab, and create an invalidation by entering the path of your updated files (use /* to invalidate all files).

Step 5: Testing

  • After updating files and settings, visit your website to confirm that changes are live and functioning as expected.
  • Test on different devices and browsers to ensure compatibility and proper display.

Celebration Time: You’re Live!

Congratulations on successfully navigating the digital waves to launch your shiny, new website! Your virtual real estate is now up, running, and ready to welcome visitors from around the globe, securely and swiftly.

This journey, while seemingly daunting, has brought you from domain registration with GoDaddy to secure, static website hosting on AWS S3, all the way to deploying with CloudFront for that extra speed and security layer. Cheers to your success! 🚀🎉


Written by aryanguls | I build things using code all the time and write about them sometimes. Also CS @ Stanford.
Published by HackerNoon on 2023/10/22