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:Â
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:
-
Type: CNAME
-
Name: www
-
Data: [Your CloudFront domain name]
-
TTL: 1 Hour (adjust as preferred)
- Setting Up Root Domain Forwarding:Â Implement forwarding to redirect traffic from your root domain to theÂ
www
 subdomain:
- Go to DNS management for your domain in GoDaddyâs dashboard.
- Locate the âForwardingâ section and add âDomainâ forwarding.
- Forward to:Â
www.your-domain.com
- Redirect type: 301 (Permanent)
- 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! đđ