Using Redis with Amazon AWS

If you’re like me and expected to simply connect to an Amazon AWS Redis instance with a local “Terminal” client, you’re wrong. It’s not so simple.

So it’s the holidays, and I’m on a long staycation with the kids while my wife attends a dance convention in Reno. As such, I’m unexpectedly burnt out on Fortnite Battle Royale, and in need of something to do with my time. So, I’ve decided to work on a prototype that has been on my mind for over a year now. Of course this prototype is super basic, but because it uses Redis for data storage, I decided to write this tutorial to share my experiences interacting with Redis on AWS.

Naturally, I first finished the prototype on my Macbook with a locally installed Redis instance, a simple NodeJS server, and a very basic web client. Now I’m ready to publish my prototype online so it can be tested by family members on different devices. But unlike other projects I’ve worked on in the past, I was confused on how to access my AWS Redis instance from my Macbook Terminal (to perform sanity checks of course). Simply put: If you’re like me and expected to simply connect to you Amazon AWS Redis instance with a local “Terminal” client, you’re wrong. It’s not so simple.

Instead, you need to remotely connect to an AWS EC2 instance through your terminal, then connect to your Redis instance from there. This means, you’ll need to do the following:

  1. Create an EC2 instance in AWS
  2. Create a Redis instance
  3. Connect to the EC2 instance remotely
  4. Install the Redis command line tools on the EC2 instance
  5. Connect to the Redis instance from the EC2 instance
  6. Interact with Redis similar to how you would from your local instance.

I know the above now, because I spent about 1 hour googling for an answer, reading stack overflow discussions, and altogether avoiding the Amazon documentation. When I finally bothered to read the Amazon documentation, it became clear: https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/GettingStarted.AuthorizeAccess.html. On this page, you’ll see the following statement: All ElastiCache clusters are designed to be accessed from an Amazon EC2 instance. (Not sure why I avoided the AWS docs initially.)

Step 1: Create an EC2 instance in AWS

I’ve already covered this step in a prior detailed blog entry, so I wont go over it again here. Please the original entry at this link: Hosting Your Own WordPress Blog – Step 2 – Create a Cloud Server Using Amazon AWS. While this was part of a series about hosting your own blog via AWS, this specific EC2 setup step is required here as well. Once you have your EC2 instance set up, move onto the next step below.

Step 2: Create a Redis instance in AWS

From the services list drop down, search for Redis and select the “ElastiCache” option.

Locating the ElastiCache (Redis) AWS service

Click “Get Started Now” in the middle of the page (assuming you have never started a Redis instance on AWS before), or click the Redis link in the left menu. Either method will result in the page below with the following sections. In the first section pictured, select Redis.

Choosing a Redis ElastiCache cluster engine.

In the next section, apply whichever settings work for you. I’ve included a screenshot of my settings. Since this only a prototype, I don’t need a lot of functionality. (Sorry in advance for the small screenshot. I wanted to fit the entire page of settings in one go)

Configuring a new Redis AWS instance

Notice that I’ve chosen Node type : cache.t2.micro (0.5 GiB). This is the smallest instance available. You may want to choose something larger. A few other settings of note, because they’re not needed for prototypes:

  • Node type: cache.t2.micro (0.5 GiB)
  • Number of replicas: 0
  • Enable automatic backups: unchecked

Once complete, click the “Create” at the bottom of the page. This will forward you to the Redis dashboard and indicate that your instance is being created.

Starting up a Redis AWS instance.

Step 3: Connect to the EC2 instance remotely

If you followed step one above to completion, you would have created an EC2 instance and connected to it via your Terminal (or other shell) application. If you’ve only created the instance but not connected yet, go ahead and do so now. Instructions for this are found in the earlier referenced post: Hosting Your Own WordPress Blog – Step 2 – Create a Cloud Server Using Amazon AWS. Once you have connected to your EC2 instance, move onto the next step.

Step 4: Install the Redis command line tools on the EC2 instance

Once connected to your EC2 instance, we can install the Redis command line tools. The command for this is: sudo apt-get install redis-tools

Installing the redis-cli command line tools.

You can test your installation by running the following command: redis-cli. You’ll know your successful when you see “Connection refused”, show below. This means the command line tools tried connecting to a local Redis server by default (which doesn’t exist), and failed. So while the connection may have failed, we’ve proven that the tools were installed! Good failure 🙂 Be sure to type exit to return back to your EC2 command prompt.

redis-cli tools, installation sanity check.

Step 5: Connect to the Redis instance from the EC2 instance

Now that we have tools installed, we need to connect to our Redis instance created in step 2. Go back to your ElastiCache Dashboard (pictured below), and see the “Endpoint” and “Port” value:

  • Endpoint: tutorial-prototype.4nigc2.0001.usw2.cache.amazonaws.com
  • Port: 6379

With these two values you can type the following command into your terminal:

  • redis-cli -c -h <endpoint> -p <port>
  • For me this is: redis-cli -c -h tutorial-prototype.4nigc2.0001.usw2.cache.amazonaws.com -p 6379
Redis endpoint and port information

Make sure you enter this command from your EC2 instance command prompt, and not the failed redis-cli command prompt that we entered into earlier. For reference, the redis-cli command prompt looks like this: [not connected>, while the EC2 command prompt looks like this: ubuntu@some-ip:~$ . Once connected, you’ll see output similar to mine in which the Redis server’s endpoint and port are listed between the [ and > brackets

Connected to the Redis server via Redis CLI tool

Once connected, issue a “ping” command to verify that you get a PONG response from your Redis instance. Continue playing ping pong with your Redis server if you’d like. Once complete, move onto some basic interaction below.

Now that we’re connected to a Redis instance on AWS, we can begin issuing commands! While “ping” is certainly a valid command, maybe try a couple easy ones like get & set:

STILL CAN’T CONNECT? Modify your Redis instance security group

Initially, I couldn’t connect to my Redis instance either. I thought perhaps it was a security group issue, tinkered with my group settings, engaged in a series of google searches, and eventually connected via my EC2 instance. I’m not sure what the default security group settings were, and am unable to reproduce a connection issue. But if you’ve followed this blog post so far and are still having issues connecting, it’s very likely to be security group related.

You can confirm your security group name by locating it in your Redis instance control panel. You’ll see the security group listed in the right column. Mine is sg-5660d932 (VPC) (active).

With this security group name located, you’ll be able to modify your own settings to enable access. My settings for this security group are very liberal, as shown below. I don’t mind, because this is a very short lived prototype, and not a production deployment of a mission critical application. If your use-case is similar to mine, feel free to copy these settings. But PLEASE don’t use these for a mission critical stuff. Instead, consult a security expert for the right configurations.

Inbound traffic rules (very liberal and insecure)
Outbound traffic rules (also very liberal and insecure)

If you have no idea how to locate and edit your security groups as seen above, please refer to the blog entry and section linked below. This goes into this part of AWS in a decent level of detail.

That’s it, we’re done. Hopefully this was helpful, and happy Redis-ing in the AWS cloud!

Posted by: Ben

Fort Chaos 50’s Mode

The idea for this mode comes from the original Fortnite 50v50 announce trailer (above). As you can see, this trailer shows two teams with their own forts. These two teams start to fight it out together, but that never actually happens in 50s. So I had an idea were two teams of 20 (or more) spawn in their own pre-built forts that are really big and have lots of vehicles. The area that they spawn is in the storm eye, placed somewhere random in the map. Every one jumps out of a low flying bus with infinite materials, lands in their forts, and spends one minute picking their inventory. During this time, you get 100% freedom with your choices: you can have 5 rocket launchers, a heavy shot gun, a mini gun, etc.

Fort Chaos 50's
Fort Chaos 50’s

Once the timer goes to zero, the battle begins. Each team has their own spawn points in the fort. Because player respawn is on in this game mode, you can be reckless and not have to worry about being killed. As the vehicles break or are not used for an amount of time outside of the fort, the vehicles will re-spawn back at your fort in the vehicle spawn zone.

The battle begins
The battle begins

After an amount of time (like the time it takes for re-spawning to turn off in disco domination) re-spawn turns off. At that point the game becomes “elimination” were you kill the enemy team for the win.

Ready for Chaos
Ready for Chaos

As you can see, the point of this mode is to bring out the chaos of the large squad modes. I hope you guys like this idea of a Fort Chaos 50’s Mode. 🙂

Posted by: Benjamin

Fortnite Xbox One S – Eon Bundle – On a PS4

Since buying my first gaming console (the Super Nintendo) in 1993, and following up with the PlayStation 1 two years later in 1996, I’ve been pretty much buying every significant gaming console to date. Which means: I have a lot of gaming consoles sitting in storage. The Super Nintendo, Game Cube, Wii, Wii U, DreamCast, PlayStation 1, PlayStation 2, PlayStation 3, Xbox, and Xbox 360. Sitting outside of storage I have multiple PS4s, a PS4 Pro, and Switch. But it wasn’t until recently that I finally considered purchasing an Xbox One.

XBOX ONE S FORTNITE BUNDLE
XBOX ONE S FORTNITE BUNDLE

Sure, I’m a huge Fortnite fan, but that alone wasn’t enough to convince me to purchase the Xbox One S featured in this article. You see, while all of my original game consoles are in excellent working condition, the Xbox consoles aren’t. I’ve taken great care of each console, but regardless, my older Xbox systems won’t perform basic functions any more. Functions like: ejecting a disc, stopping disc spin before ejecting (the 360 literally spits out spinning discs), booting normally, entering into low power mode when asked, powering on when asked, etc. Basically, both of my older Xbox consoles are junk. So until recently, I’ve decided to skip out on the Xbox experience for this console generation.

PlayStation 1
The 90’s are calling, they know you have their PS1.

PlayStation however? Those devices are a totally different story. Each and every PlayStation I own runs flawlessly to this day, same as the day I bought it. In fact, the PS1 was plugged in a few months ago, wired into a modern TV, and booted up Crash Bandicoot 2, Tekken 3, and Ridge Racer perfectly. Same with the PS2 and PS3. Not a single problem with any one of them. Just some dust.

So why did I finally buy an Xbox One? Well, a few reasons aligned recently:

  1. Fortnite crossplay has been enabled across all gaming devices since Sony’s announcement that they will officially support the functionality. Read: Cross-platform play coming to PS4, starting with Fortnite
  2. Fortnite account merging is in progress, which means cool exclusives for Xbox, Switch, and PS4 owners (like the Eon cosmetic) are no longer locked to a platform. Now these can be used on any device. And if you have a previously linked and locked account, it’ll soon be able to merge with your main Epic games account properly. Read: Players Will Soon Be Able To Merge Fortnite Accounts Across Consoles
  3. Finally, Sony recently announced the release of a next generation console. Read: PS5? Sony at work on PlayStation 4 successor, company CEO says

While none of these scream: “buy an Xbox One”, they did make me realize that right now is an exciting time to be a gamer. The ability to have a Switch, Xbox One, PS4, mobile phone, and PC playing in the same lobby is insanely cool!  With all this potential, I don’t want to miss out on an entire generation of Xbox and the cross play experience that comes with it.

So, in comes the Xbox One S Fortnite bundle, and this article walking you through the account linking process, some interesting findings regarding account linking, and video of a sick Fortnitemares dub (actually, we failed to record the dub… feelsbadman). If you’re like me and interested in getting an Xbox One this late in the current generation, you can purchase it directly from Microsoft like I did: $299 from Microsoft.com.


Before we get started, a few things have already been established:

  • I have a PlayStation Network account already (PSN: augustc4). This has been actively used by me for years.
  • I have an Epic games account already as well. It was generated automatically when I first launched Fortnite on my PS4, which means my PSN account was tied to it right away (Epic: augustc4).
  • I had a stagnant Xbox Live account sitting around for years, untouched, hailing from my days on the 360 playing Halo and Rainbow Six Vegas (Xbox Live: beginner).

Now let’s jump right in:

  1. Before starting up my Xbox, I removed the system, components, and paperwork from the box. Among the paperwork, there were two voucher cards. Locate these. They contain codes for redeeming the following items:
    • 1 month free trial of Xbox Live Gold (allows you to play online games)
    • 1 month free trial of Xbox Game Pass <- this article ignores Game Pass
    • 1 full game of Fortnite (which is free anyway, just sayin), the Eon cosmetic set, and 2000 V-Bucks (this is the “bundled” content).
  2. On your computer, log into your Xbox Live account. Navigate to Sign in > account icon (upper right) > redeem code > enter the code
  3. Redeem Xbox Live gold voucher code. This will give your XBox account the free month of online game play, which is required for Fortnite on the platform.
  4. Next, redeem the Eon bundle voucher code in the same manner. This will entitle you to the Eon cosmetics and 2000 V-Bucks, which is the equivalent of $20. (Don’t worry, it won’t last you long. Cosmetics are super expensive in this game)
  5. On your computer, log into the Epic games website: https://www.epicgames.com/site/en-US/home
  6. Navigate to your user icon > account > connected accounts > xbox > connect > link your account > log into the Microsoft website > allow epic to access your XBox account info (this is standard practice, similar to facebook). Once complete, you’ll be directed back to the epic website with your XBox account connected! Epic will now email you something like this: “You Have Linked Xbox Live To Your Epic Games Account”

    Xbox Live Linked
    Xbox Live Linked

Finally, we’re done with the laptop and can move onto the Xbox.

  1. On your new Xbox One, you’ll be asked to sign into your Xbox Live account. For me, this was possible after roughly 30 minutes of system updating, then choosing selecting language preferences, and other setup tasks.
  2. Navigate your way through the Xbox startup tutorials and information screens
  3. Launch the Xbox store and search for “Fortnite”.
  4. Download Fortnite from the game page. You’ll notice that it’s already marked as owned by you. This “entitlement” to the game happened when you entered the voucher code in the prior step 4 above. (Please remember, you’re downloading the FREE version of Fortnite, specifically the battle royale mode. You are NOT downloading or purchasing “Save the World”. This is a completely different paid mode.)
  5. Once Fortnite is downloaded onto your device, launch it! Because you’re logged into the Xbox from step 1, and because the Xbox account is linked on epic.com in the earlier step 6, you will receive the Eon outfit and 2000 V-Bucks!

Xbox One - Eon Bundle Redeemed
Xbox One – Eon Bundle Redeemed

Xbox One - 2000 V-Bucks On Account
Xbox One – 2000 V-Bucks On Account

PS4 - 2250 V-Bucks Remains Unchanged
PS4 – 2250 V-Bucks Remains Unchanged

Some observations:

V-Bucks are NOT cross platform! You’ll notice based on the screenshots above that the V-Bucks purchased on one platform won’t appear on another platform. The first image is the Xbox One, and the second is PS4. Note the difference in V-Bucks in the top right corner.

This makes sense to me, as the purchase of V-Bucks is performed on a platform store. Thus, redemption of those V-Bucks should happen on the same platform. Of course, this is an artificial decision (not a technical one), so it may change at some point in the future.

Cosmetics ARE cross platform! This is great news, because it would be a shame to “invest” a lot of money into a single platform, only to find that none of the cosmetics you’ve purchased are playable on any new platform you adopt. As I’ve stated, $20 worth of V-Bucks doesn’t go very far in this game, so users with a large locker of cosmetics have spent a LOT of money. Besides that, it’s so cool to see exclusive skins in single-platform lobbies. The Eon skin got a lot of attention in the PS4-only lobbies.

As indicated by the screenshots below, I’ve spent my $20 worth of V-Bucks on Jack Gourdon and the Head Banger emote while on the Xbox One, and both display as owned on the PS4. Additionally, you can see the Eon skin in my locker on the PS4, and in a game of Disco Domination.

Xbox One - Jack Gourdon Purchased for $15 (1500 V-Bucks)
Xbox One – Jack Gourdon Purchased for $15 (1500 V-Bucks)

PS4 - 2250 V-Bucks Remain, Jack & Headbanger Show as Purchased
PS4 – 2250 V-Bucks Remain, Jack & Headbanger Show as Purchased

PS4 - Eon in Locker
PS4 – Eon in Locker

PS4 - Eon in Disco Domination
PS4 – Eon in Disco Domination

Achievements are cross platform! Remember that video I mentioned, of a sick Fortnitemares dub on the new Xbox? Still doesn’t exist, because I failed to record it (but I can confirm that it was awesome). Well, my kids wanted to try out the new Xbox, so we took turns playing solo games on my account. The rule was that they had to help me with my week 5, and Fortnitemares challenges. This consisted of destroying cube monsters, eliminations in corrupted zones, etc.  Based on this, I can confirm for you: all of these challenges are tied to your Epic account, and not a specific gaming platform. So achievements earned on an Xbox will remain as earned on a PS4. This is great news for Switch and mobile users who use an Xbox, PS4, or PC as their primary.

That’s it! Hope this post was helpful to somebody, and I hope that my Xbox One experience is an improvement over the Xbox and Xbox 360 experiences I’ve had so far. This Eon bundle is awesome, the skin looks amazing in game, the ability to join a PS4 lobby with an Xbox exclusive is super cool, the console looks sick, and best of all: I can enjoy more gaming experiences with the family, including Xbox exclusives, and Fortnite crossplay with PS4 and Switch.

Look out for more Xbox one posts in the future as I get into how to stream gameplay on multiple platforms, and other random explorations.

Posted by: Ben

Large Squad Participation Umbrella

My Dad, my Sister, and I, came up with the participation umbrella a while ago. The idea is if you win a large squad mode (which isn’t difficult) you get a participation umbrella. They don’t mean much in terms of status because the odds of you getting the win is very high. They don’t have to change seasonally like the solo and squad umbrellas. But they do change each time you win a large squad mode, like the 3rd concept with the star and a number next to it.

Posted by: Benjamin

3 Llama Disco!

I was just dropping into Disco Domination and I found two llamas right next to each other right off the bat. Then I was wandering around again on my way to a corrupted zone, and found the third llama! I can’t believe I found all the llamas in the game! For those who are struggling with the week one challenge, I am sorry, it is because of people like me.

MY LLAMA NOW BOI

Posted by: Bella

Hosting Your Own WordPress Blog – Step 6 – Download and Install WordPress on Your Server

Step 6 – EASY

Downloading WordPress is super easy, and so is copying it to your server. But you may run into some small issues when “starting up” WordPress for the first time.

 

WordPress Logo
WordPress Logo

First, download the WordPress software from this page: Download | WordPress.org. This is the blog software that we’ll be running on our server. With it we can create blog entries, post pictures, moderate comments, etc. This software is the reason we’re all following this tutorial.

 

 

FileZilla Logo
FileZilla Logo

Then, download the FileZilla FTP Client from this page: FileZilla – The free FTP solution. This will be used copy the WordPress software to our server. It’s a simple drag and drop operation. Once downloaded, get this installed.

 


Second, launch the FileZilla FTP client and connect it to your EC2 cloud server instance. To connect, you’ll need to add your server by clicking the little icon in the upper left corner. This will open the Site Manager dialog.

FileZilla Application
FileZilla Application

From the Site Manager dialog, you need to make a few entries as described below:

  • Host: your EC2 instance domain name, either the Amazon domain name like I’ve done below, the IP address, or the host name.
  • Protocol: select “SFTP – SSH File Transfer Protocol”
  • Logon Type: select “Key File”
  • User: “ubuntu”
  • Key file: the path to your key file from step 2: /home/MY_SERVER_KEY_PAIR.pem
  • Also, on the left under “My Sites” you can click the server icon and give your site a memorable name. I tend to keep mine short, as you can see. Sometimes I have multiple sites for testing, so you may see something like SAMP-PROD and SAMP-TEST listed.

Once entered, click OK or Connect. On subsequent connection, click the icon we used to open this dialog, select your server from “My Sites” and click “Connect”.

FileZilla - Site Manager
FileZilla – Site Manager

The first time you connect, you’ll be asked if the server is something you trust. Of course, you trust your own server. So check the box provided and click Ok. This will be the last time you’ll see this dialog when connecting.

Filezilla - Unknown host key
Filezilla – Unknown host key

If everything goes well, you’ll connect and see “Remote site: /home/ubuntu” in the right column, and the contents of the /home/ubuntu folder below that. From here, you want to navigate to /var/www/html. This is where you will upload your WordPress files from earlier. You can navigate to this folder by typing “/var/www/html” in the “Remote site:” text field, or clicking on the folder icons in the “Remote site” window pane. Once you arrive at the /html folder, you’ll see that it has a single html file. This is the Ubuntu Apache start page we observed when connecting to our server in our web browsers in step 4.

FileZilla - Remote site: var/www/html folder
FileZilla – Remote site: var/www/html folder

 

Delete this index.html file from the directory.

If you get a permission denied error (which I have), follow these steps:

Connect via terminal, similar to prior steps.  Next, execute these two commands. The first command says: “as a root user, I want to change ownership of all files in the html folder from their current owner to “www-data.www-data” owner. The second command says we should be able to fully control the files in the html folder.

sudo chown -Rf www-data.www-data /var/www/html/
sudo chmod 777 /var/www/html

Now you can delete the index.html file.

After deleting, run the chmod command one more time. 775 is a much better permission setting than 777, as it isn’t as broad:

sudo chmod 775 /var/www/html

Third, upload the WordPress software into the /var/www/html directory you’ve navigated to. Do so by unzipping the WordPress file, navigating into the WordPress folder. The contents in this folder are what you want to upload, and not the “WordPress” folder itself.

wordpress zip file
wordpress zip file

unzipped wordpress
unzipped wordpress

wordpress folder contents
wordpress folder contents (upload these)

You can perform the upload by dragging the files into the “Filename” window right below the “Remote site” window (lower right corner). This file transfer will take a while, because we’re uploading a LOT of files. Even though the total file size doesn’t add up to much (9.5MB is small), there are a lot of transfer operations. So grab a coffee and relax.

FileZilla - Uploading files to /var/www/html
FileZilla – Uploading files to /var/www/html

Once complete, your /var/www/html folder should look similar to mine. If you visit your server via web browser now, you will no longer see the Ubuntu/Apache start page. Instead you’ll see a directory listing generated by the server. Shown below on the left is our FileZilla window, while on the right we see our web browser. They both show the same content.

FileZilla - uploaded successfully
FileZilla – uploaded successfully

Web Browser - directory list
Web Browser – directory list

 

 

 

 

 

 

 


 

 

WordPress - Welcome
WordPress – Welcome

 

Fourth step is to run the WordPress installation process. We can start this by visiting our website at the following URL. Note yours will look different because you have a different server than this sample:

<your URL>/wp-admin/setup-config.php

http://ec2-34-221-223-243.us-west-2.compute.amazonaws.com/wp-admin/setup-config.php

Visiting this page will display the WordPress welcome page. Click “Let’s go!”

You will now be asked to enter your database connection details. These are the same details we entered into MySQL Workbench earlier. Feel free to keep the Table Prefix value as “wp_”, and hit Submit.

WordPress - Database Setup
WordPress – Database Setup

After submitting, WordPress will connect to your RDS database instance, create a number of tables required by the WordPress software, initialize a new index file, and perform whatever additional bootstrapping is required. This will result in a success message:

WordPress - All right, sparky!
WordPress – All right, sparky!

 

Click “Run the installation” and you’ll move to the next step in which you name your blog, setup a user name and password for the blog owner, and set the email. If you’re excited like me, you may even misspell the title of your blog! What was meant to be “Infinite Dab Sample Blog” came out as “Samples”. Lol. Thankfully we can change this later from the WordPress controls if needed.

Once you’ve made your entries and written down your password, click “Install WordPress”.

WordPress - Welcome & Installation Screen
WordPress – Welcome & Installation Screen

WordPress - Success!
WordPress – Success!

From the above “Success!” screen, you can pat your self on the back for a job well done, then click the “Log In” button to start using the WordPress software.

WordPress - Login
WordPress – Login

Note: the login screen you see here is a page that you’ll want to bookmark. It’s location at wp-login.php is probably not something you’ll remember at a later time. So do yourself a favor.

Also, note: if you’re logging in with the many different URLs that you have available, the logins DO NOT carry over to each other! In other words, if you login at www.yourblog.com/wp-login.php, that same login will not apply to a link to your blog at 127.0.0.1/wp-login.php, and will not apply to a link to your blog at 12345.us-west-2.compute.amazonaws.com/wp-login.php. So make sure the URL you’re bookmarking here is the URL you want your users to see, and that it’s the same URL you’re logging into consistently.

Why is this important? Well, when blogging, it’s very common to create a post that links to another post. If you’re logged into the WordPress software via your blog IP address (e.g. 127.0.0.1), the WordPress software will generate URLs for you which look like: 127.0.0.1/index.php/<date>/<your post name>/. These are valid, but ugly. If you log into yourblog.com, you’ll get something much prettier:  yourblog.com/index.php/<date>/<your post name>.

Now visit your blog! As you can see below, WordPress generates a beautiful sample theme for you. Look at the top, you’ll see tools (because you’re logged in). Scroll down, you’ll see a sample post.

WordPress - Default Blog
WordPress – Default Blog


Congratulations!

You’ve completed step 6, which is ranked at EASY difficulty.  Now your blog is ready to go!

Because you’ve followed these steps, you have full flexibility to control your branding and monetize your blog however you wish! Start posting and have fun. Drop me a comment or a link if this series of articles was helpful for you!

 


All Steps:

Introduction & Overview- Hosting Your Own WordPress Blog

  1. (EASY) Buying a Domain Name
  2. (HARD) Create a Cloud Server Using Amazon AWS
  3. (EASY) Create a Hosted Zone Using Amazon Route 53
  4. (HARD) Install Apache and PHP on Your Cloud Server
  5. (EASY) Create MySQL Cloud Database Using Amazon RDS
  6. (EASY) Download and Install WordPress on Your Server

Hosting Your Own WordPress Blog – Step 5 – Create MySQL Cloud Database Using Amazon RDS

Step 5 – EASY

Amazon makes it really easy to create a cloud database, but once again: the control interface may not be easy to understand. In this step, we will create an Amazon RDS cloud database, jot down important information about how to connect to it, then use the MySQL Workbench application to confirm our connection succeeds. Once we connect via the Workbench, connecting our blog software the same way should be very easy.

MySQL Workbench Logo
MySQL Workbench Logo

First, Download & Install the MySQL Workbench application. As stated, we will use this application to connect to the RDS Database we create later, but we won’t use it for much else. This is an important method of “sanity checking” our RDS database connection, and prevents us from going crazy when we try to install WordPress later. https://dev.mysql.com/downloads/workbench/

 

AWS Management Console Login
AWS Management Console Login

Second, log into your Amazon AWS console. You’ve already done this in earlier steps, so you’re possibly still logged in now. The AWS console is located here:  AWS Management Console.

 

 

 

 

 

Third, locate the RDS option from the AWS Services list. If you can’t find it, type “RDS” into the search bar provided and hit enter. This will take you to the RDS home page.

AWS services - Search for RDS
AWS services – Search for RDS

 

Fourth, click the “Create Database” button. This button can be found on the RDS dashboard, and within the instances list. From the “Select Engine” page, choose the “MySQL” option and click Next:

Amazon RDS - Select Engine
Amazon RDS – Select Engine

On the “Choose Use Case” screen, click on the Production – MySQL option and click Next. Other options would also work, but we will go with the production option for this tutorial.

Amazon RDS - Choose use case
Amazon RDS – Choose use case

On the “Specify DB Details” screen, we’ll choose the following options:

  • : MySQL Community Edition
  • License model: general-public-license
  • DB engine version: MySQL 5.6.40 (but you should choose whichever is the latest version. 5.6.40 was the most recent version at time of writing.
  • DB instance class: db.t2.micro – 1 vCPU, 1GiB RAM. For our purposes, we’re keeping the size of our instance as small as possible. But this is really a decision you’ll need to make for your own blog. Do you anticipate a lot of traffic immediately? Do you expect things to be a bit slow at first while you build content and gain a following? Regardless of what you choose, you’ll be paying for it monthly, so choose whichever works for you.
  • Multi-AZ deployment: No. I always choose Create replica in different zone because I like the idea of high availability, but it’s not needed unless you expect a lot of traffic immediately. Basically, your data is made available in multiple locations, taking the load off the central location, and allowing your database to work fast.
  • Storage type: General Purpose (SSD)
  • Allocated storage: 20 GiB

With the above settings, the cost per month is estimated and displayed. As you can see, our cost per month is quite low, coming in at $14.71. Feel free to play with the settings above and find the price that works best for you. Note that some things such as Milti-AZ deployments will double your cost immediately.

Amazon RDS - Instance Cost Estimate
Amazon RDS – Instance Cost Estimate

Next, we create our connection info. This part is super important, as it will define how our MySQL Workbench application will connect to our database for sanity checking, and how our blog software will connect during the installation phase. I generally name my instance identifier similar to my EC2 names, with “prod” or “test” somewhere in the mix. Master user name is for the user that has “god level” permissions on the database. Meaning, this user will have the power to create other users, destroy information, run dangerous commands, etc. Finally, create a strong password and click Next. Be sure you don’t forget any of this information, or you’ll need to delete your database and start over!

Amazon RDS - Instance Settings
Amazon RDS – Instance Settings

Next is the “Configure advanced settings” page. Most options on this page can be kept as-is. But there are a couple to mention:

  • Under Database Options, be sure to add a database name. I recommend something similar to the instance name, such as: sample_prod_database.
  • For Port, be sure the value is 3306. If it isn’t, or you wish to change it, be sure to write the new value down in your notes.

Once complete, press the Create database button. This will take a while, as illustrated by the following status on the “instance” page. You’ll have to be patient while this completes. Until then, we will not be able to continue with the sanity checking step below. If you observe this status, you may see it change from “creating” to “modifying”, “backing-up”, then “available”.

Amazon RDS - Creating
Amazon RDS – Creating

Fifth, we sanity check our RDS connection. We will use MySQL Workbench and our connection info for this. To start with, launch the MySQL Workbench application. You should see a home screen similar to mine, minus the “localhost:3306” connection:

MySQL Workbench - Home Screen
MySQL Workbench – Home Screen

From this screen, click the little “+” icon at the top. We will use this dialog to create a  connection to our RDS instance, similar to below. Please make the following entries then click Ok.

  • Connection Name: sampleprod
    Give the connection any name here, but I suggest that you use your RDS instance name you created earlier. This will help you identify and connect to the proper instances, and help you avoid mistakes.
  • Hostname: sampleprod.cdjamybnca2v.us-west-2.rds.amazonaws.com.
    You’re probably wondering where I got this value from? Visit your Amazon RDS instances page, click on your instance name, then scroll down to the “Connect” summary. In this summary, you’ll see an “Endpoint” value. I’ve copied a screenshot below.
  • Port: 3306
    This field will default to 3306, so you probably won’t need to change anything. But if you’ve decided on a different port when creating your RDS instance earlier, you’ll need to place that value here. Alternately, you can see “port” listed in your instance’s “Connect” summary below.
  • Username: hostingtutorial
    This is the master username created earlier.
  • Password: click the “Store in Keychain …” button and enter the password you chose during the Create Database steps. Note that MySQL Workbench doesn’t want to store your password directly, so they’re using your system’s “Keychain”, since this is generally more secure.

MySQL Workbench - Setup New Connection
MySQL Workbench – Setup New Connection

Amazon RDS - Instance Connection Endpoint
Amazon RDS – Instance Connection Endpoint

 

After pressing OK, a connection will be added to the MySQL Workbench home screen. Double click on that connection icon and a new tab will open. If you’ve connected successfully you’ll see a list of Schemas on the left (innodb, sample_prod_database, sys). If you’re having trouble, you can close that tab, go back to the home screen, right click on your connection icon, and choose “Edit Connection”. From the edit dialog, you can make changes and click “Test Connection”.

MySQL Workbench - Connection Icon
MySQL Workbench – Connection Icon

MySQL Workbench - Connected in new tab
MySQL Workbench – Connected in new tab

MySQL Workbench - Test Connection in Connection Editor
MySQL Workbench – Test Connection in Connection Editor

 

Finally, we edit our RDS instance security rules. Much like our EC2 instance, our new RDS instance has a lot of security applied by default. This is a great thing, but means we need to update our security rules to allow our WordPress blog the ability to connect to the RDS database on our behalf.

From the RDS instance control panel, scroll down to the “Connect” section and find the security group links. Click on the “rds-launch-wizard” link to open the editor:

Amazon RDS - Instance Security Group
Amazon RDS – Instance Security Group Link

From the editor, click the “Inbound” tab and click the “Edit” button. This will spawn the following “Edit inbound rules” dialog. You may notice that you already have an entry and “Source” is listed as “My IP”. Change this entry by selecting “Anywhere” as seen below, then click “Save”.

Amazon RDS - Inbound Rules Editor
Amazon RDS – Inbound Rules Editor

 

Congratulations!

You’ve completed step 5, which is ranked at EASY difficulty. Now onto step 6.

 


All Steps:

Introduction & Overview- Hosting Your Own WordPress Blog

  1. (EASY) Buying a Domain Name
  2. (HARD) Create a Cloud Server Using Amazon AWS
  3. (EASY) Create a Hosted Zone Using Amazon Route 53
  4. (HARD) Install Apache and PHP on Your Cloud Server
  5. (EASY) Create MySQL Cloud Database Using Amazon RDS
  6. (EASY) Download and Install WordPress on Your Server

Hosting Your Own WordPress Blog – Step 4 – Install Apache and PHP on Your Cloud Server

Step 4 – HARD

Installing Apache and PHP on your cloud server with command line tools will feel awkward to the uninitiated. But mostly you’re just copying and pasting commands, then… waiting for them to finish.

First, we log into the server via our Terminal application, similar to step 2, right after we created our EC2 cloud server instance. See below, copied from the step 2 blog post:

Open an SSH client (the Terminal application), then run the example SSH command. Note that the file “MY_SERVER_KEY_PAIR.pem” should be in the same folder that you’re executing the command from. On my device, we default to the “home” folder, so I’ve copied the file there. Full path to the file looks like: /home/MY_SERVER_KEY_PAIR.pem. Execute the command like so:

Connect via Terminal
Connect via Terminal

A lot of the information provided in the terminal will not be interesting to you, so you can ignore it. What you’re looking for is a successful connection as indicated by the green line at the bottom:  ubuntu@ip-172-31-19-107:~$ This indicates that you’re connected and able to execute commands as the “ubuntu” user. Type “exit” into the terminal if you wish to disconnect for now.


Second, we need to issue a list of commands to install the Apache server software:

Command 1 will update your system, preparing it to grab the latest Apache version.

sudo apt-get update && sudo apt-get upgrade

While command 1 executes, you will see a bunch of “Get” statements executing, the reading of package lists, and a list of packages that will be upgraded. Then you will be prompted to continue: “After this operation, 165 kB of additional disk space will be used. Do you want to continue? [Y/n]”. Answer with a “Y” and hit Enter. You’ll then see a flood of “Preparing” and “Unpacking” statements.

Note: If you are prompted with questions like the following: “A new version of [XYZ] is available, but the version installed currently has been locally modified, What do you want to do about modified configuration file?”, simply select “Keep the local version currently installed” and hit Enter.

When the process is complete, you’ll be returned to the command prompt: ubuntu@ip-172-31-19-107:~$

Command 2 will install everything you need for the Apache software:

sudo apt-get install apache2 apache2-doc apache2-utils

Similar to command 1, you will see a bunch of  statements executing. When prompted to continue: “After this operation, 31.0 MB of additional disk space will be used. Do you want to continue? [Y/n]”. Answer with a “Y” and hit Enter. You’ll then see a flood of “Preparing” and “Unpacking” statements.

When the process is complete, you’ll be returned to the command prompt: ubuntu@ip-172-31-19-107:~$

Command 3 will restart Apache. Enter this in your terminal.

sudo service apache2 restart

Third, we need to modify our security groups. You may not know this, but all Amazon EC2 instances have very high security by default. Try connecting to your EC2 instance from your web browser now by typing in the amazon address, IP address, or your domain name. Notice it fails? This means, NOBODY can connect to your server except you, and that requires a special connection with your key/pair file.

This level of security is obviously no good for our purposes. We want our users to connect to our website in their web browsers, so we need to modify our security policy to allow for HTTP connections.

AWS Management Console Login
AWS Management Console Login

Once again, log into the AWS console with our account here:  AWS Management Console. This is the same console we’ve been using all along.

 

 

 

 

 

Navigate to your EC2 instance and click on it. In the panel that appears at the bottom of the console, you’ll notice the following. It’s the inbound rules that we need to modify. Click on the “launch-wizard-7” link to open the editor:

Security Groups
Security Groups

Security Group Editor - Inbound
Security Group Editor – Inbound

 

Click on the “Edit” button, and you’ll be presented with a dialog similar to the below. Make the following changes then click “Save”. This will add two new rules to the inbound rules above:

  • Type: HTTP
  • Source: Anywhere

Edit Inbound Rules
Edit Inbound Rules

Apache 2 Ubuntu Default Page
Apache 2 Ubuntu Default Page

Now you can confirm access via your own web browser, and see the Apache start page. You can copy and paste the Amazon URL, the IP address of your instance, or the website name you connected in step 3: Create a Hosted Zone Using Amazon Route 53. As a reminder, these would look like so:

ec2-34-221-223-243.us-west-2.compute.amazonaws.com
54.189.133.122
infinitedab.com

 

 

 

 

Finally, we need to install PHP 7. This the server-side run time environment for WordPress. If you don’t have PHP installed, the .php scripts required by WordPress will not be able to execute.

Command 4 will get PHP installed and run as an Apache module. Enter this in your Terminal. When asked if you wish to continue, type “Y”. When the process is complete, you’ll be returned to the command prompt once again: ubuntu@ip-172-31-19-107:~$

sudo apt install php libapache2-mod-php php-mysql

Command 5 will restart Apache. Enter this in your terminal.

sudo service apache2 restart

Congratulations!

You’ve completed step 4, which is ranked at HARD difficulty. Now onto step 5.

 


All Steps:

Introduction & Overview- Hosting Your Own WordPress Blog

  1. (EASY) Buying a Domain Name
  2. (HARD) Create a Cloud Server Using Amazon AWS
  3. (EASY) Create a Hosted Zone Using Amazon Route 53
  4. (HARD) Install Apache and PHP on Your Cloud Server
  5. (EASY) Create MySQL Cloud Database Using Amazon RDS
  6. (EASY) Download and Install WordPress on Your Server