Using Key Pairs, Amazon Marketplace & EC2
by Benji Zamora on September 25, 2016
Okay people, I have a technical blog to write. This blog is more of an instructional tutorial that was promised last week on how to setup WordPress, and may not be suited for most readers. But this was a great learning experience for me and I would love to share!
So let’s build you a website. It’s going to take you about an hour (probably less) and shouldn’t be too hard if you understand what’s going on as we go through it. I will try and explain different pieces of each module of AWS, but know that I found this service very overwhelming the first time I tried to tackle setting up a server, so don’t feel alone if that is your experience with this.
How-To
We’re going to create an EC2 Key Pair and install a Bitnami WordPress stack from the AWS Marketplace, thus deploying an EC2 instance with our new EC2 key file as a “password”.
EC2 Key Pair
A .pem key file is important for being able to connect to the server as an admin outside of WordPress, allowing you to do things like manipulate the files directly on the server. When you login to the server via SSH from the terminal (which we’ll do in a minute), you provide this very specific key file which identifies you and your computer as a legitimate admin. This is a common technique for logging in remotely, and it is very secure and very simple once it’s set up.
Step one is to make sure you have an AWS account, since everything we’re doing requires you to be signed in. If you don’t have an account, sign up for one here: AWS Login/Signup
Once you’re logged in to the console, open the EC2 service by clicking on Services -> EC2 (it’s a big list).
On the left hand side click ‘Key Pairs’ (link)
Click ‘Create Key Pair’
Type in the name of your website and append key (i.e. passthepiece-demokey) or your preferred name for this key.
Once you click ‘Create’ it should create a key and download a .pem file to your computer’s downloads folder with the given name.
Now we’re going to move the key into your .ssh key folder by opening the terminal and typing:
mv path/to/newly/downloaded/key.pem .ssh
(i.e. mv ~/Downloads/passthepiece-demokey.pem .ssh)
Note: We’ve moved the .pem file here for convenience of referencing it later when we connect to the server over SSH.
AWS Marketplace & Deploying WordPress powered by Bitnami
Bitnami is a company that specializes in building and hosting different types of cloud application-stacks for you to build your apps inside of. This helps developers focus more on developing and deploying an app, rather than learning ALL of the ins and outs of AWS. In our case, this will be launching WordPress. While it is highly encouraged to set up a WordPress site on AWS manually, this is a quick, simple, and free setup that is highly powerful when utilized by the right people. We all start somewhere!
This Bitnami stack launches a pre configured EC2 instance that has WordPress already installed and ready to go. Nice and easy.
Head to the AWS Marketplace and find this page (or follow that link). We’re going to deploy WordPress powered by Bitnami.
Click ‘Continue’ on the AWS Marketplace product page for WordPress powered by Bitnami.
Under ‘EC2 Instance Type’ go ahead and leave that at it’s default m3.medium setting. This will incur monthly charges on your account. Should be about $40/mo. EC2 Instance Types however are fundamental for understanding how EC2 instances work. Learn more about EC2 Instance Types here.
Leave ‘Security Group’ alone for now. This can be adjusted later if needed. Learn more about security groups here.
Click on ‘Key Pair’ and select the key we created earlier.
Scroll back up and click ‘Accept Software Terms & Launch with 1-click’
Accessing WordPress
If all went well you should be able to open your WordPress site now!
Make your way back to the EC2 console and click on ‘Instances’ on the left hand side.
If this is the first time doing anything with AWS you should only have 1 running instance. Click on it and find the ‘Public DNS’ url (i.e. ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com). Copy/paste that into a new tab and voila! Hello, World!
Now if you type your Public DNS url into the browser and add ‘/wp-admin’ (i.e. ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com/wp-admin) you will be taken to a log in screen. The default admin username is ‘user’. But what’s the password?
Since Bitnami configured WordPress for us, they’ve already set a master admin password. We need to find out what that is. Check the box next to your EC2 Instance and click ‘Actions -> Instance Settings -> Get System Log’
This should open up a console window with a bunch of green text. Scroll down to the bottom of that text and it will have printed the password: “Setting Bitnami Application Password to: ‘xxxxxxxxxxxxx’”
Note: The application password can’t be copied and pasted from this window. Type it into a notes app somewhere and copy/paste it from there.
Head back to your own personal login screen (ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com/wp-admin)
Type ‘user’ for the username
Enter the application password we just found in the Log for the password. If it didn’t log you in, something’s wrong!
Logging in via SSH
Now that you have made it this far, let’s use the key that we made in the very beginning to log in and look at the files directly!
Open Terminal and send this command (change yourkey.pem to your key name/path, and enter your Public DNS you found earlier):
ssh -i .ssh/yourkey.pem [email protected]
You should see this text:
bitnami@ip-xxx-xx-xx-xxx:~$
Now you’re able to use the console to talk directly to the server!
Setting up FileZilla on macOS
FileZilla is an app for macOS that allows you to access your files on your server without needing to type all sorts of commands. You can download it here. Make sure to download the Client version and not the Server version.
Open FileZilla and open ‘File -> Site Manager…’
Click ‘New Site’
Under Host type in your ‘Public DNS’
Protocol should say ‘SFTP – SSH File Transfer Protocol’
Logon Type Should say ‘Key File’
User: bitnami
Key file: ‘/Users/youruser/.ssh/yourkey.pem’ (Please replace the youruser with your username, and yourkey.pem with your key file.)
Click ‘Connect’
Now you can browse around your server files and see what makes it all tick!
Tips
The first thing I always do is go through each and every setting of the WordPress admin panel and try and learn what is what. If you don’t understand a given component of WordPress, I encourage you to search the web for what it is and how it works before changing any settings.
Themes and Plugins are the most powerful aspects of WordPress. However sometimes just installing them can mess up configurations you have in place. Be wary of installing too many plugins!
If you have questions about WordPress check our last blog all about the software we used, including this setup explained in this tutorial.
Wrapping up
And you’re in! Congratulations on venturing into the world of servers and WordPress sites. If you have any hiccups or clarifications please let me know in the comments.
There is much, much more to talk about and many more tutorials to write. Stay tuned for much more!
~ Pass The Piece Team
www.passthepiece.com/blog
Hi! I am a content-detection robot. I found similar content that readers might be interested in:
http://www.passthepiece.com/how-to-deploy-install-distribute-wordpress-on-amazon-web-services-aws/
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Good Work passthepiece, It’s a very good tutorial for WordPress installation on AWS. You can also deploy WordPress on AWS through Cloudways, there tutorial about installation of WordPress on AWS is very good: https://www.cloudways.com/blog/host-wordpress-on-aws-cloud/
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you ✌️
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit