Today, we will explore how to set up an amazon EC2 Linux instance (micro) in the cloud and get it running successfully. We will also see how to attach an elastic ip to our instance and discuss about some points/facts which we will need to be aware of. This is my second article among the amazon tutorials series. I hope you already signed up with AWS free usage tier and ready to claim your free server.
What Is EC2 Regions?
Well, understanding the term ‘region’ is a vital and important as a AWS user. Amazon has their data centers distributed in various area around the world. Each key area are referred as a region. Some EC2 resources are shared by regions and some aren’t. Depending on region, price also varies. Please check the ec2 pricing section for more details. However, as this tutorial series will walk you through the free trial, so, no need to worry about region selection at this moment. Its enough to get only familiar with it.
Create A New Amazon EC2 Linux Instance:
First Log in to your AWS console and select EC2 service console. After you reach the EC2 dashboard, you should see a page like as follows, which summarizes your EC2 statistics like number of instances/elastic IP/EBS volume, service status etc:
Though you can launch a new instance right from this dashboard page, let’s have a look at the instances page without any instance running, as well. Click on the ‘instances’ link on left menu and you will reach a window which should look like as follows:
Now click on the ‘launch instance’ button and it will bring a new instance launch window with three different ‘wizard’ options to assist you: classic, quick launch and AWS marketplace as follows:
Quick launch will show minimal options and AWS marketplace is for who want to buy environment ready instance. As we will learn to set up the environment ourselves, we will use the classic wizard for exploring all possible options. Lets select it(if not already) and click next. You will see a request instance wizard as follows:
Here, you will be able to choose what type of instance you wish to launch with all available operating system(32/64 bit) options. Note that, not all instance types are under free tier. Only the ones with a star mark next to it. In my case, I did choose a Ubuntu Server 12.04 LTS(64 bit) instance. You can do so or a different one. Then you will be taken to next stage to enter ‘instance details’ as follows:
Now this stage has few sub stages. Firstly, you will get a simple window for entering key-value pairs. you can simply add ‘name’ key with your desired value (optional) and move to next sub stage:
Here, you will be able to select number of instances you want to launch, instance type availability zone etc. You will have option to request spot instance here as well. Lets select 1 micro instance with no preference for availability zone(one will be assigned automatically) and forward to next sub stage for storage configuration:
For Linux micro instance, it’s provided with default 8GB root storage (for windows storage, it’s bigger though), which is enough to get started. We don’t need to configure EBS storage now, we will do it later. Now lets move to next sub-stage of advance options:
As a beginner, we can skip it easily. However, you can use the option for ‘prevent accidental termination of instance’ and ‘shutdown’ behavior if you need at all. Lets move to next stage of security/firewall configuration:
Here, you can either select an existing security group or create a new one. If you have no intention of use more than one instance at all or want to use similar security for more than one instance, then its easy to just select the ‘default’ group given automatically. You can change/modify security group anytime, so no worry at all if you are not sure what to do at this moment. After completing the section, we are done with all option. On last stage you will be shown the full summary configuration for review:
After you complete the review an submit, it will take a while to get the instance running and you will now see a new look of instances page:
Congratulation! You made it. We now have an active amazon ec2 linux instance up and running.
Start/Stop/Terminate/Rebooting Of An Instance:
These operations are fairly easy to perform. Just you need to check besides the instance(s) you want operated and use the ‘Actions’ drop-down’s ‘Actions’ commands to do so. Right clicking on an instance will work as well. To remind you, free tier are counted as hours utilized, not by the number of instances. So, you can have multiple ec2 instances up and running under AWS free tier as long as you don’t overflowed per month allowed hours. Keeping some instances stopped will help you a lot in this case 🙂 . Also, be aware that, amazon has an advance option which causes termination of an instance upon shut down(see step 9 above). So, be careful whether you have this settings or not and using it accordingly.
Attaching An Elastic IP To EC2 Instance:
Attaching your EC2 instance to a dedicated IP address is a wise decision. By default, even without a IP, you will be able to access your instance with a DNS name assigned by amazon, randomly.With which you can connect to your server or access your web application using it as an HTTP URL.
The bad news is, this public DNS name will be changed over time whenever you stop and run or reboot your instance. So, not a very good idea even for development/testing purpose at all. To get relief, elastic IP came on board. You can get it free as well during your free trial time.
To get a new IP, please go to “NETWORK & SECURITY” -> “Elastic IPs” menu option on the left panel and create ‘allocate new address’ button. You will ask to accept for a confirmation dialogue. As soon as you accept it, a new available ip will be shown up on the list. Now, check the IP and click ‘associate address’ option. You will be shown with a small dialogue as follow:
Select your desired instance(if have more than one) and click OK. Now, We are done! now you can access/recognize your cloud server with this dedicated IP.
References:
As I said before, amazon has a good documentation for their services. Please read their documentation for launching an instance also if you have some confusion on any of this article’s section. Still have a question in mind? Feel free to ask here by commenting. Also, stay tuned for the next post about working with EC2 security groups and connect to your EC2 instance.
var JetpackInstantSearchOptions=JSON.parse(decodeURIComponent("%7B%22overlayOptions%22%3A%7B%22colorTheme%22%3A%22light%22%2C%22enableInfScroll%22%3Atrue%2C%22enableFilteringOpensOverlay%22%3Atrue%2C%22enablePostDate%22%3Atrue%2C%22enableSort%22%3Atrue%2C%22highlightColor%22%3A%22%23FFC%22%2C%22overlayTrigger%22%3A%22submit%22%2C%22resultFormat%22%3A%22expanded%22%2C%22showPoweredBy%22%3Atrue%2C%22defaultSort%22%3A%22relevance%22%2C%22excludedPostTypes%22%3A%5B%5D%7D%2C%22homeUrl%22%3A%22https%3A%5C%2F%5C%2Fcodesamplez.com%22%2C%22locale%22%3A%22en-US%22%2C%22postsPerPage%22%3A5%2C%22siteId%22%3A18994550%2C%22postTypes%22%3A%7B%22post%22%3A%7B%22singular_name%22%3A%22Post%22%2C%22name%22%3A%22Posts%22%7D%2C%22page%22%3A%7B%22singular_name%22%3A%22Page%22%2C%22name%22%3A%22Pages%22%7D%2C%22attachment%22%3A%7B%22singular_name%22%3A%22Media%22%2C%22name%22%3A%22Media%22%7D%7D%2C%22webpackPublicPath%22%3A%22https%3A%5C%2F%5C%2Fcodesamplez.com%5C%2Fwp-content%5C%2Fplugins%5C%2Fjetpack%5C%2Fjetpack_vendor%5C%2Fautomattic%5C%2Fjetpack-search%5C%2Fbuild%5C%2Finstant-search%5C%2F%22%2C%22isPhotonEnabled%22%3Afalse%2C%22isFreePlan%22%3Atrue%2C%22apiRoot%22%3A%22https%3A%5C%2F%5C%2Fcodesamplez.com%5C%2Fwp-json%5C%2F%22%2C%22apiNonce%22%3A%22155bc22a78%22%2C%22isPrivateSite%22%3Afalse%2C%22isWpcom%22%3Afalse%2C%22hasOverlayWidgets%22%3Afalse%2C%22widgets%22%3A%5B%5D%2C%22widgetsOutsideOverlay%22%3A%5B%5D%2C%22hasNonSearchWidgets%22%3Afalse%2C%22preventTrackingCookiesReset%22%3Afalse%7D"));
Leave a Reply