• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Featured
    • C# Tutorials
      • LinQ Tutorials
      • Facebook C# API Tutorials
    • PHP Tutorials
      • CodeIgniter Tutorials
    • Amazon AWS Tutorials
  • Categories
    • Programming
    • Development
    • Database
    • Web Server
    • Source Control
    • Management
    • Project
  • About
  • Write
  • Contact

CodeSamplez.com

Programming, Web development, Cloud Technologies

You are here: Home / Web Server / Getting Started With Amazon EC2 Linux Instance

Getting Started With Amazon EC2 Linux Instance

January 5, 2013 by Rana Ahsan 1 Comment

Set Up Amazon EC2 Linux Instance

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:

  1. 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:
    Amazon EC2 Dashboard
  2. 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:
    AWS EC2 Instances Screen

  3. 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:
    EC2 Launch Instance Window

  4. 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:
    Request New Instance Wizard

  5. 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:
    EC2 Instance Key-Value Pair Entry

  6. 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:
    Amazon EC2 Linux Instance Details

  7. 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:
    ec2 instance storage configuration

  8. 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:
    EC2 Instance advance options

  9. 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:
    EC2 Instance Firewall Configuration

  10. 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:
    EC2 Instance Configuration Review

  11. 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:
    instances section with one running

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.
public DNS of EC2 instance

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:
Attaching Elastic IP To EC2 Instance

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.

Share If Liked

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pocket (Opens in new window)

You may also like

Filed Under: Web Server Tagged With: aws, cloud server

About Rana Ahsan

Rana is a passionate software engineer/Technology Enthusiast.
Github: ranacseruet

Reader Interactions

Trackbacks

  1. Amazon Route 53 Tutorial - CodeSamplez says:
    November 28, 2020 at 10:17 am

    […] by the IP instead of the big ugly public DNS name. I have already discussed how to do that while setting up your EC2 linux instance. Follow that if you haven’t this setup […]

    Reply

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3,774 other subscribers

Follow Us

  • Twitter
  • Facebook

Top Posts & Pages

  • How To Work With JSON In Node.js / JavaScript
    How To Work With JSON In Node.js / JavaScript
  • PHP HTML5 Video Streaming Tutorial
    PHP HTML5 Video Streaming Tutorial
  • How To Work With C# Serial Port Communication
    How To Work With C# Serial Port Communication
  • Facebook C# API Tutorials
    Facebook C# API Tutorials
  • Using Supervisord Web Interface And Plugin
    Using Supervisord Web Interface And Plugin
  • LinQ Query With Like Operator
    LinQ Query With Like Operator
  • Get Facebook C# Api Access Token
    Get Facebook C# Api Access Token
  • Getting Started With UDP Programming in Java
    Getting Started With UDP Programming in Java
  • Utilizing Config File In C#.NET Application
    Utilizing Config File In C#.NET Application
  • Generate HTTP Requests using c#
    Generate HTTP Requests using c#

Recent Posts

  • Building Auth With JWT – Part 2
  • Building Auth With JWT – Part 1
  • Document Your REST API Like A Pro
  • Understanding Golang Error Handling
  • Web Application Case Studies You Must Read

Tags

.net angularjs apache api audio auth authenticatin aws c# cloud server codeigniter deployment docker doctrine facebook git github golang htaccess html5 http javascript jwt linq mysql nodejs oop performance php phpmyadmin plugin process python regular expression scalability server smarty socket.io tfs tips unit-test utility web application wordpress wpf

Footer

Archives

Follow Us

  • Twitter
  • Facebook

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3,774 other subscribers

Copyright © 2023