{"id":1411,"date":"2023-06-27T01:08:39","date_gmt":"2023-06-27T01:08:39","guid":{"rendered":"http:\/\/tiemensfamily.com\/timoncs\/?p=1411"},"modified":"2023-06-27T04:09:44","modified_gmt":"2023-06-27T04:09:44","slug":"add-https-lock-to-aws-s3","status":"publish","type":"post","link":"https:\/\/tiemensfamily.com\/timoncs\/2023\/06\/27\/add-https-lock-to-aws-s3\/","title":{"rendered":"Add HTTPS lock to AWS S3"},"content":{"rendered":"\n<p>The goal was to change the &#8220;Not secure&#8221; banner to the little lock (aka enable https) for <a href=\"https:\/\/timtiemens.com\">timtiemens.com<\/a>.  <\/p>\n\n\n\n<p> Previously, that site was hosted using only AWS S3 &#8211; which does not support &#8220;https&#8221;.<\/p>\n\n\n\n<p>This is the documentation for the final configurations for <a rel=\"noreferrer noopener\" href=\"https:\/\/s3.console.aws.amazon.com\/s3\/\" target=\"_blank\">AWS S3<\/a>, <a rel=\"noreferrer noopener\" href=\"https:\/\/us-east-1.console.aws.amazon.com\/cloudfront\/\" target=\"_blank\">AWS CloudFront<\/a>. <a rel=\"noreferrer noopener\" href=\"https:\/\/us-east-1.console.aws.amazon.com\/acm\/\" target=\"_blank\">AWS Certificate Manager<\/a>, and <a rel=\"noreferrer noopener\" href=\"https:\/\/us-east-1.console.aws.amazon.com\/route53\/\" target=\"_blank\">AWS Route 53<\/a>.<\/p>\n\n\n\n<p>The basic idea is to put a CloudFront distribution in front of your AWS S3 website, create a certificate, and then make sure all of the configuration settings between S3\/CloudFront\/Route53 agree and work with each other.<\/p>\n\n\n\n<h2>AWS S3<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Bucket Name<\/strong><\/td><td><strong>Public<\/strong><\/td><td><strong>Static website<\/strong><\/td><td><strong>Notes<\/strong><\/td><\/tr><tr><td>www.timtiemens.com<\/td><td>Yes<\/td><td>Disabled<\/td><td>No longer used<\/td><\/tr><tr><td>cftimtiemensdotcom<\/td><td>Yes<\/td><td>Enabled\/Bucket hosting<\/td><td>Bucket policy set to allow access to S3GetObject from Cloudfront<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Since all of the files in AWS S3 are auto-deployed from a <a href=\"https:\/\/github.com\/timtiemens\/timtiemens.com\">github <\/a>repository using &#8220;aws s3 sync&#8221;, it was simple for me to change the target bucket from &#8220;s3:\/\/www.timtiemens.com&#8221; to &#8220;s3:\/\/cftimtiemensdotcom&#8221;.  Note that for AWS S3 static websites, the bucket name has to match (www.timtiemens.com) but for CloudFront, the bucket name can be anything (cftimtiemensdotcom).<\/p>\n\n\n\n<h2>AWS CloudFront<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Configuration Item<\/strong><\/td><td><strong>Value<\/strong><\/td><td><strong>Notes<\/strong><\/td><\/tr><tr><td><strong>General<\/strong><\/td><td><\/td><td><\/td><\/tr><tr><td>Price Class<\/td><td>Use all edge locations<\/td><td>If there is ever a bill for this, switch to &#8220;Use only North America and Europ&#8221;<\/td><\/tr><tr><td>Custom SSL Certificate<\/td><td>ARN of certificate<\/td><td>Selected from dropdown list<\/td><\/tr><tr><td>Alternate domain names<\/td><td>2<\/td><td><\/td><\/tr><tr><td><\/td><td>timtiemens.com<\/td><td><\/td><\/tr><tr><td><\/td><td>www.timtiemens.com<\/td><td><\/td><\/tr><tr><td><strong>Origins<\/strong><\/td><td><\/td><td><\/td><\/tr><tr><td>Origin Domain<\/td><td>cftimtiemens.com<\/td><td>From dropdown choices<\/td><\/tr><tr><td><\/td><td>HTTP only, port 80<\/td><td><\/td><\/tr><tr><td>&#8220;Name&#8221; <\/td><td>is greyed-out, no edit<\/td><td><\/td><\/tr><tr><td><strong>Behavior<\/strong><\/td><td><\/td><td><\/td><\/tr><tr><td>Path pattern<\/td><td>*<\/td><td><\/td><\/tr><tr><td>Origin and origin groups<\/td><td>cftimtiemensdotcom.s3.us-east-1.amazonaws.com<\/td><td><\/td><\/tr><tr><td>View<\/td><td>Redirect HTTP to HTTPS<\/td><td><\/td><\/tr><tr><td>Allowed HTTP methods<\/td><td>GET, HEAD<\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2>AWS Certificate Manager<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Configuration Item<\/strong><\/td><td><strong>Value<\/strong><\/td><td><strong>Notes<\/strong><\/td><\/tr><tr><td><strong>Domains<\/strong><\/td><td>2<\/td><td><\/td><\/tr><tr><td>timtiemens.com<\/td><td><\/td><td>Requires DNS CNAME confirmation<\/td><\/tr><tr><td>*.timtiemens.com<\/td><td><\/td><td>Requires same DNS CNAME confirmation<\/td><\/tr><tr><td><strong>Status<\/strong><\/td><td>Issued<\/td><td><\/td><\/tr><tr><td><strong>In Use<\/strong><\/td><td>Yes<\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>After created, pushed the &#8220;Create records in Route 53&#8221; button.  This creates the required CNAME records in the hosted zone.<\/p>\n\n\n\n<h2>AWS Route 53<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Record<\/strong><\/td><td><strong>Type<\/strong><\/td><td><strong>Value<\/strong><\/td><\/tr><tr><td>timtiemens.com<\/td><td>A<\/td><td>Alias, to abcdefghijk.cloudfront.net<\/td><\/tr><tr><td>www.timtiemens.com<\/td><td>A<\/td><td>Alias, to abcdefghijk.cloudfront.net<\/td><\/tr><tr><td>various &#8220;_xxyyzz&#8221;<\/td><td>CNAME<\/td><td>as set by AWS Certificate Manager, for various certificates to be validated by DNS<\/td><\/tr><tr><td>blog.timtiemens.com<\/td><td>A<\/td><td>34.236.123.127 (separate webserver, not under this CloudFront distribution)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The goal was to change the &#8220;Not secure&#8221; banner to the little lock (aka enable https) for timtiemens.com. Previously, that site was hosted using only AWS S3 &#8211; which does not support &#8220;https&#8221;. This is the documentation for the final &hellip; <a href=\"https:\/\/tiemensfamily.com\/timoncs\/2023\/06\/27\/add-https-lock-to-aws-s3\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/1411"}],"collection":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/comments?post=1411"}],"version-history":[{"count":4,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/1411\/revisions"}],"predecessor-version":[{"id":1415,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/1411\/revisions\/1415"}],"wp:attachment":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/media?parent=1411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/categories?post=1411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/tags?post=1411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}