version: 1.4
My personal / freelancer promotion website.
For my benefit, so I don't forget...
- Create an S3 bucket
- Bucket Properties -> Enable website hosting
- Index document:
index.html
- Edit Redirection Rules to provide the
cv
redirect:
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>cv</KeyPrefixEquals>
</Condition>
<Redirect>
<Protocol>https</Protocol>
<HostName>docs.google.com</HostName>
<ReplaceKeyWith>/document/d/1cXZjQi9ESDVKs3lqAtWbvsepLz-HLDPao3I9PsYGryc/edit?usp=sharing</ReplaceKeyWith>
<HttpRedirectCode>302</HttpRedirectCode>
</Redirect>
</RoutingRule>
</RoutingRules>
- Permissions -> Edit Bucket Policy to allow assets to be made public by default:
{
"Version": "2012-10-17",
"Id": "Policy1482880671909",
"Statement": [
{
"Sid": "Stmt1482880670019",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::willmorgan.co.uk/*"
}
]
}
- Permissions -> Edit CORS Configuration
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
- See
.travis.yml
for auto deployment to S3, triggered by pushes to GitHub. In summary, this runsnpm run build
and then pushes to S3.
- Create a certificate for
willmorgan.co.uk
andwww.willmorgan.co.uk
- Upload or configure with Certificate Manager
- Set
CNAME
fields:willmorgan.co.uk
,www.willmorgan.co.uk
- Use Custom SSL certificate (use cert uploaded to certificate manager)
- Default root object:
index.html
(should match S3 Index Document) - Origins: Copy the S3 bucket URL you're using. Do not choose it from the dropdown, otherwise redirects will not work.
- Behaviours
- Enable Redirect to HTTPS
- Query String Forwarding: Allow whitelist (
version
) - Enable Compress Objects Automatically
- Add
A
andAAAA
records forwillmorgan.co.uk
andwww.willmorgan.co.uk
that alias to the CloudFront distribution ID
It will take a while to propagate changes so certificate issues might occur when trying to access with SSL.