How To Create AWS EC2 Instance.

Running your application on ec2 instance


They are many companies which offers cloud-services like AMAZON, GOOGLE, RACKSPACE , MICROSOFT , AT&T and so on. Now i am going to share how to run your application on ec2 instance (server) on aws. You can register for 12 months free tier AWS account .once your account is created login into your console . To create ec2 instance and launch your application you need to follow below steps:

  • Launching the instance.
  • Connecting to instance.
  • Launching your application.

#1.Launching the instance amazon web server

  • Login into the AWS Console , In the dashboard top left corner ( navbar) click on services drop-down and select ec2 option.

  • techhawa-ec2-instance-select-option
  • you can launch your instance in desired location by selecting on the top navbar right side as show in the image.

  • techhawa-ec2-server-location
  • Click on instance in the left side panel and click on launch button.

  • techhawa-ec2-instace-create
  • Now the actual process goes on seven steps. In Step 1 ( choose Choose an Amazon Machine Image) you need to select the machine on which you application what to run. Please select anyone of AMI (NOTE : Here i am going to show you Amazon Linux AMI , Ubuntu Server 16.04 and Ubuntu Server 14.04 ).

  • techhawa-ec2-choose-ami
  • In Step 2 (Choose an Instance Type ) based on the storage and data-transfer of your application, by default t2.micro is selected. choose types of instance and click on next button

  • techhawa-ec2-instace-create
  • Step 3 ( Configure Instance Details ) in this you can select the number of instance ( you can also set-up auto-scaling ) Network settings ,IAM role , Shutdown behavior and more. Keep all the settings as default if you don’t know anything and click on next button

  • techhawa-ec2-instace-create
  • Step 4 ( Add Storage ) Enter the storage capacity required for your application by default it will 8GB and click on next button

  • techhawa-ec2-instace-create
  • Step 5 ( Add Tags ) you can add as number of add the tags as you could define a tag with key = Name and value = Web-server and Tags will be applied to all instances and volumes

  • techhawa-ec2-instace-create
  • Step 6 ( Configure Security Group ) A security group is a set of firewall rules that control the traffic for your instance, you can add rules to allow specific traffic to reach your instance. If you want to set up a web server and allow Internet traffic to reach your instance, add rules that allow unrestricted access to the SSH, HTTP HTTPS and MYSQL ports as shown below and click on review and launch

  • techhawa-ec2-instace-create
  • Step 7 ( Review Instance Launch ) Its like summary of all the above six steps you done above if everything is fine click on launch button. Now a pop-up box appears asking you to Select an existing key pair or create a new key pair since you are launching for first time select create a new key pair in the dropdown as shown in the image below and enter the key name ( key name can be any name ) NOTE: You have to download the private key file (*.pem file) before you can continue. and finally click on launch button

Live Demo