Working on the development of #pozr, a free developer hosting service, I decided to use different flavors of BSD and Linux. Yes Linux… Anyway I decided to use NetBSD as the web server. Having usually used FreeBSD, I am now an equal fan of both BSD distributions.
You will need…
• Amazon AWS account • Terminal
You will learn…
• AWS Basics
• How to configure an EC2 Instance • Creating a NetBSD Virtual Server
Moving forward in this article I will provide you with the steps you will need to deploy your own Net- BSD cloud server on AWS EC2.
Registration and Initial Setup
Register or Log into your Amazon Web Services (AWS) account.
Once you are logged into the AWS account you will see a list of all the AWS offerings. For the sake of simplicity this article will only cover Elastic Cloud Compute (EC2), which provides the deployment services for virtual servers in the cloud. (Figure 1)
Figure 1. Amazon Web Services 6
Figure 2. Create Key Pair
In the NETWORK & SECURITY section choose the Key Pairs option. Next click “Create Key Pair”, name your key and click Yes. You will be prompted to save your newly created your_key.pem file; save in a directory. (Figure 2)
We will now begin creating an Amazon Machine Image (AMI). Back in the EC2 Dashboard click on the “Launch Instance” button. (Figure 3)
Figure 3. Create Instance
Inside the Choose an Amazon Machine Image screen, we will be accessing Community AMIs and searching for all public NetBSD images. (Figure 4) For this article I chose the following configuration.
Figure 4. Choose an AMI
NetBSD-x86_64-6.1.3-20140123-0824 ami-1d90ad74 NetBSD 6.1.3 64Bit
Choose an Instant Type.
Instances range from tiny to very large; the greater the processing power and ram the more you will pay. AWS provides a handy calculator so you can calculate your monthly costs. For new AWS account holders you may enroll in the Free Tier program. (Figure 5)
Figure 5. Micro Instances
Once in Configure Instance Details choose an Availabil- ity Zone, us-east-1c for example. When deploying addi- tional EBS images make sure they are created in the same Availability Zone as your EC2 instance. If not you will not be able to attach the extra storage to your instance.
When creating an instance you will be given the option of using Elastic Block Storage (EBS) which in short is an attached storage which is independent of the virtual ma- chine. EBS provides a layer of data protection, for exam- ple if your VM becomes corrupted or must be recreated, your EBS can always be reattached to another instance without data loss.
Once in the Configure Security Group screen you will be given the option of using a new or existing security group. I would recommend creating your own; that way you can open and close ports as you see fit.
Security groups work as a firewall between open ports and your instance. For example web traffic on port 80 (0.0.0.0/0) or SSH port 22 (0.0.0.0/0). (0.0.0.0./0) allows traffic from any ip address.
In the last screen before you launch your instance you will be able to review and edit all options. Once you have reviewed your configuration click Launch. You will now be prompted to Select an existing key pair or create a new key pair. Choose the key pair you created in step four of this tutorial. (Figure 6)
Figure 6. Create a New Key Pair
Check the “I Acknowledge that…” and click Launch In- stances. The creation process sh – ould take a few min- utes. Once the instance is up and running a green dot will appear under the Instance State tab of EC2 Dashboard.
Connecting to Your Instance
Launch the terminal and type the following SSH connec- tion command while changing your pem file location and EC2 public address. (Figure 7)
# ssh -v -i /your-pem-file_location/diego/diego_aws.pem [email protected]
Figure 8. Welcome to NetBSD Screen
Having read through this article you should have a basic understanding of AWS EC2 and most importantly a fully functional NetBSD cloud server. In part two of this article, I will cover installation of the NetBSD pkgsrc tree, PHP, Nginx and more. So until next time, keep it moving!
About the Author
Diego is the chief architect at #pozr. When he is not coding or building web technology, Diego is ranching and skateboarding. He currently re- sides in both Hebbronville, Texas and San Diego, California. If you have any questions or comments you can contact him at [email protected]
Source of the article: BSD Mag issue VOL. 08 No. 03 03/2014 (56)