Amazon Elastic Compute Cloud (EC2) is the Amazon Web Service used for creating and run virtual machines (instances) in the cloud.
Now, let us start with Amazon EC2 by launching and connecting to ec2 instance for free. An instance is a virtual server in the AWS cloud. With EC2 you can set up and configure a virtual machine in the cloud and applications that run on your instance.
Creating an Instance
- Sign up : Before beginning with EC2, you have to create an account on AWS on this link http://aws.amazon.com/ Creating account on AWS is free, it will charge a minor amount which will also be credited back to your account.
- Choose an Amazon Machine Imge (AMI) : After clicking on Launch an Instance, it will ask for machine image. It is a template that contains the software configuration (operating system, application server, and applications) required to launch your instance. Let us take the following image to launch an instance
- On the Choose an Instance Type page, you can select the hardware configuration of your instance. Select the t2.micro type, which is selected by default as it is free-tier eligible.
- Now in Configure Instance Details, there is no need any change, only you have to click Next: Add Storage .
- On Add Storage page, it will ask if you want to add any volume. The root device is given by default having 8GB of memory and if you want to add a volume click on Add New Volume. You can add any amount of size of your EBS but upto 30GB its free above that it will be going to charge some amount.
- On Tag Instance page, you can give it any key name and value name like this
- Under Configure Security Group page, you can choose Select an existing security group.You will be asked for type of protocol below, SSH will be selected by default, you have to just click on Add Rule and select HTTP
- Click on Review and Launch and then click on Launch.
- When prompted for a key pair, select Choose an existing key pair, if you have any and then select the key pair that you created when getting set up.
- Alternatively, you can create a new key pair. Select Create a new Key Pair, enter a name for the key pair and then choose Download Key Pair.This is the only chance for you to save the private key file, so be sure to download it and keep in safe place. Save the private key file in a safe place. You’ll need to provide the name of your key pair when you launch an instance and the corresponding private key each time you connect to the instance.
NOTE: Don’t select Proceed without a key pair option. If you launch your instance without a key pair then you can not connect to it.
- A confirmation page lets you know that your instance is launching. Choose View Instances to close the confirmation page and return to the console.
- On the Instances screen, you can view the status of the launch. It takes a short time for an instance to launch. When you launch an instance, its initial state is
pending. After the instance starts, its state changes to
runningand it receives a public DNS name.