Amazon web services CloudFront with subdirectory

Well, this is my second post after Jekyll for static website scenario. Jekyll is perfect and what it does is just generate set of static files (i.e. html linking to certain stylesheets and / or javascript files or CDNs). Nice one! So check this out if you have not yet.

There are several ways of hosting and distributing its files across global network (of course Github pages), self-owned VPS (i.e. AWS Lightsail or DigitalOcean). This time I have another way to do this. Amazon web services (AWS) with S3 bucket and further with CloudFront distribution.

Set up S3 bucket with static site

The very fist thing we need to do is to enable our S3 bucket serving our content out for global network. To do this we need to go to bucket properties and enable «Static Website Hosting». The most important part here is to set what default file should be root for certain folder. The problem is that CloudFront does not inherit this this for folders other than root. Basically what I want to enable is to have my content served as or for better SEO. And, to be honest I think that having .html in web-site address at the end is such a bad practise and smell 90s :)

S3 bucket configuration

It is not important (if you plan CloudFront) how your bucket available (permissions). I just disallowed all. Ok this is 50% of the challenge.

CloudFront distribution for web site

Now we almost ready for further set up. We need to create new distribution and add origin. Origin is the content. And my workaround is not to select the bucket itself (which is given as default option when you set origin by autocomplete), but bucket endpoint.

S3 static website endpoint

Why this is important? Well, if you really need to solve the challenge that I had (access subfolders with index.html files that Jekyll can generate when you set config.yml permalink as for example :slug/, what means it builds static post in it subfolder naming slug and pasting index.html inside).
Once CloudFront configured, you need to wait a bit ~ 10-15 minutes for caching across all selected edge locations of Amazon (look for "In progress" status, once it's gone, you can check).

In short, this is about:
#amazon s3

Start discussion:
Related articles:
In this very short tutorial we are going to mount S3 bucket from AWS to the local folder of Debian. ... more
Learn how to mount S3 bucket to your Mac OS ... more
over 5 years#amazon s3 #mac #amazon
August, 9th, 2016 - passed my Amazon CSAA. Few tips I'd love to share here. ... more
Amazon Web Services (AWS) has its own AWS Linux AMI (also free tier). There are several reasons you want to use this AMI for your projects. ... more
AWSRus — Official AWS User Group Russia (St. Petersburg). ... more
almost 5 years#meetup #awsrus #amazon
CloudAcademy webinar: how to use AWS services for Backup and DR challenges. I am presenter! ... more
AWS Elastic File System is scalable file system in the cloud, requires NFSv4.1 client and does not support Windows at the moment. However let's see what we can do.. ... more
about 4 years#efs #amazon efs #amazon
It's been written many times, however there is no consistency how to make static web site with SSL and SEO friendly urls (301 redirect). Pure AWS based services static website ahead, check details inside! ... more
almost 5 years#static site #seo #amazon
Send text messages (SMS) with few lines of Python code using Amazon SNS and boto3 SDK. ... more
AWS SES supports SMTP settings for sending through it-self. This is really helpful if we want to configure personal outbound server. ... more
about 4 years#aws ses #smtp #amazon
Launching AWS EC2 can be supplied by something what is known as "user data" and it helps to have things ready before you access it. ... more
How to pre-deploy App using user data script for Windows OS with powershell powered script in EC2? Example inside. ... more
I made light talk on one of our recent #AWSRus community gathering in Moscow and decided to discover this topic with further series of posts in my blog covering various AWS services. ... more
about 4 years#free tier #amazon