2018 Modded Minecraft Server on AWS : Part 3 — Serve Twitch Custom Profile via S3 and a Static Website and Route53 Custom Domain

Andrew WC Brown
ExamPro
Published in
5 min readSep 5, 2018

We want our friends to play on our modded Minecraft server we’re going to need to export our Twitch Custom Profile for Minecraft and share it with them.

We can use S3 to create a static website which will use for the time being to let them download the Custom Profile and Share with the server’s Static IP.

Register Domain Name with Route53

So proceeding to Route53 lets Register a domain

I’m going search for the domain Regimontia because that’s the in-lore name of the world my players and I agreed upon.

You’ll then proceed to fill our your domain information such as address, email and phone. You’ll need to confirm your email address and accept terms of service and proceed to purchase.

You should now have a domain and we can create an S3 bucket based on our domain.

Creating a Static Website with S3

Create two new buckets

We need to create two new S3 buckets based on our domain name. So I’m going to create regimontia.com and www.regimontia.com and take note that I have yet to make them public.

We have two buckets but we are only going to be using one and redirecting the traffic to the other.

Create and Upload Homepage

We’ll create an index.html and upload this to our bucket without www so in my case its regimontia.com

<html>
<head>
<title>Minecraft Server</title>
</head>
<body>
<h1>(REPLACE WITH YOUR STATIC IP)</h1>
<a href='/mod-profile.zip'>Download Custom Profile</a>
</body>
</html>

Export Profile and Upload to S3 Bucket

Lets export our profile.

Just keep the default selected for config and mods, you can rename the profile.

Then upload to the S3 bucket

Turn On Static Website Hosting

We want our index.html file to be recognized as the homepage so on the Properties Tab lets turn it on.

Take note that it well tell us our website’s public url. If we didn’t want to register a domain we could just share this with our url. Copy this link and after saving visit this url.

And we should except to see and error

This is because everything in a bucket by default is private, so we’re going to have to tell S3 to make everything in this bucket publicly accessible to everyone.

Custom Bucket Policy

We can achieve this using an custom bucket policy. So plug your domain name into the template below and copy it.

{
"Version":"2012-10-17",
"Statement":[{
"Sid":"PublicReadGetObject",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::REPLACE-WITH-YOUR-DOMAIN.com/*"
]
}
]
}

We’ll proceed to our bucket’s Permissions Tab and add this Bucket Policy

Don’t worry about the public access warning because its not applicable to us.

So we’ll check the url provided by our bucket again and we should now see our homepage and we should also be able to download the mod profile.

Custom Domain with Route 53

We want to create an alias record so we’ll need to open Route53 > Hosted Zones > Select Your Domain > Create Record Set

We need to choose Alias which will allow us to select possible AWS resources that we can link to our naked domain. So select the your S3 website endpoint and leave the name blank and Create.

I waited a few minutes and then I visited my naked domain and everything works as expected. The website is Not Secure since we aren’t yet using an SSL certificate which I think is not important for our requirements.

Redirect WWW to Naked Domain

We want www to work as well so we are going to need to redirect our www bucket to our naked domain. We can do this by redirecting requests on our www bucket.

Then we just need to create another Alias to the S3 website endpoint but for our www subdomain.

When you attempt to visit your domain with www it should redirect to your naked domain.

Some Fun Finishing Touches

You can make yourself a nice logo at https://textcraft.net/

FYI rein isn’t a typo, its an inside joke

I also added myself a background and added some styling and here is the end result.

Here’s the HTML. You’ll need to source your own background image and place both your logo and background image alongside your index.html in the naked domain bucket.

<html>
<head>
<title>Regimontia</title>
<style>
* {
font-family: arial, sans-serif;
}
html, body {
padding: 0; margin: 0;
background: url('dirt.jpg');
}
main {
text-align: center;
padding: 64px;
}
h1 {
font-size: 42px;
color: rgb(177,169,166);
text-shadow: 2px 2px 3px rgb(0,0,0);
}
a {
font-size: 28px;
color: rgb(100,100,255);
text-shadow: 2px 2px 3px rgb(0,0,0);
}
</style>
</head>
<body>
<main>
<img src='logo.png' />
<h1>34.238.37.39</h1>
<a href='/mod-profile.zip'>Download Custom Profile</a>
</main>
</body>
</html>

--

--

Andrew WC Brown
ExamPro

I have an unhealthy obsession with web-development.