Skip to main content

Serving a Static Site Over HTTPS Using S3, CloudFront, and GoDaddy



I want to create and host a HTTPS secure static website using AWS S3 bucket, Cloudfront, and Godaddy. 

If you are looking for options on hosting that is cost-effective, can scale just in case your site goes viral and is fairly easy to maintain? and It's important to host your websites and web apps with HTTPS enabled. here a right architecture for you to host.

We will be using AWS S3 for hosting our static website content (will post a separate blog, how to host an Angular application). AWS CloudFront for faster distribution, using AWS certificate manager and finally we will be using our DNS service from Godaddy. (I could have used AWS Route53 but why to pay that extra 50 bucks). 

**imp. - because of GoDaddy only allows CNAME for subdomains;  we will do cloudfront distribution for www.myexample.com, and use domain forwarding from myexample.com to www.myexample.com

1. Setup S3 bucket and upload your website content to your bucket. 

Just remember below points: 
  1. Bucket name should be domain friendly. if domain name = web.myexample.com; keep it "myexample"
  2. Uncheck the "Block all public access"
  3. Properties tab, Set as static website hosting
  4. Permission tab, update the bucket policy with below text, Save

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

2. Use AWS Certificate Manager, 
**Imp: it's easy to manage if you create a separate certificate for each subdomain

  1. Change Zone to 'N. Virginia' --> Click 'Request a certificate' --> add domain name 'www.myexample.com' 
  2. use DNS validation, follow process to update CNAME DNS records.


3. AWS Cloudfront - Create Distribution with below settings, rest leave default

  1. Origin Domain Name: Copy and paste bucket name from S3, don't use dropdown suggestion for static hosting.
  2. Viewer Protocol Policy: Redirect HTTP to HTTPS
  3. Change the Allowed HTTP Methods to GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE,
  4. Alternate Domain Names: add 'www.myexample.com'
  5. Click 'Custom SSL Certificate' : select your certificate for this subdomain. 


4. GoDaddy, DNS manager
  1.  Add DNS record, Type CNAME
  2. Host name: 'www', Point to: "Copy and paste the CloudFront distribution domain name here"
  3. Now to forward domain to subdomain: Click Forward, Domain - ADD,  put 'www.myexample.com'

Comments

Popular posts from this blog

Installing BEA Weblogic 10.3 on Mac/OSx

Updated post:- I have to go through a long hassle of making Weblogic work on my MacBook. Few things which I learned and would like to share: -Before starting to install you have to trick the installer into thinking that the local JDK is the generic Sun JDK. If you skip this step the installer will not accept the default Mac OS X JDK and complain that it is Invalid. $ cd /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home $ sudo mkdir -p jre/lib $ cd jre/lib $ sudo touch rt.jar $ sudo touch core.jar -To Install, run the following command from terminal : (Updated for the "fatal error occurred while installing 10.3.2") $ java -Xms256m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m -jar -Dos.name=unix -jar server103_generic.jar -Once installation is completed, Create a new domain through "./config.sh" from "/bea/wlserver_103/common/bin" -Once the domain is created: --Need to update the env setting in " .setDomainEnv.sh " file i.e. locat...

DIABETES - ITS EARLY SYMPTOMS

Diabetes, especially Type-2 diabetes is often termed as the 'silent killer disease'. Why? The reason behind it is that this disease does not come with prominent symptoms. Sometimes this disease is not detected until the condition gets severe. However, there are certain symptoms of Type-1 and Type-2 Diabetes, which one should know, in order to identify this ailment at an earlier stage. Let us gain an elaborative insight about this chronic disease and the warning signs that it comes with. 1. Intensive Thirst One of the earliest symptoms of diabetes is peeing more than regular. A normal individual usually pees for 4-7 times in a day but a diabetic might do much more than that. This in turn also leads to intensive thirst as the person starts feeling much thirstier than usual. Why does this happen? This happen because the glucose, which your body reabsorbs in normal conditions, is not able to do so when your blood sugar level goes up. 2. Dry Mouth Lack of necessary amount of fluids...

DEPRESSION – HOW TO FIGHT IT

‘Depression’ is a condition which is quite prevalent these days courtesy a hectic lifestyle. One might think that this condition is an imaginary one where it is just all in the head, however, on the contrary, depression is a ‘real’ disease, which has an extremely adverse effect on the brain. There are several reasons, apart from changes in the brain chemistry, that lead to depression which include difficult life situations, stress or any other medical condition. There are many symptoms that are associated with this disease that are commonly found in people who are suffering from depression. These symptoms include: a) Angry Outbursts b) Mood Swings  c) Withdrawal from people d) Losing interest in any activity e) Immense Sadness f) Hallucination  g) Lack Of Sleep h) Concentration Problems  Depression is a common problem. Several studies suggest that one in every 5 women and one in every 10 men suffer from the problem of depression. How to fight this disease? Is ther...