Amazon EC2


Creating your first virtual server (EC2 instance ) on AWS

What is Amazon EC2:
EC2 stands for Elastic Compute Cloud. there's basically two C's so, that's why it is called EC2. Amazon Elastic Compute Cloud is a part of Amazon.com's cloud-computing platform, Amazon Web Services, that allows users to rent virtual computers on which to run their own computer applications.







But the question arises why we need EC2😟😟???
But No worries the answer is here:

Search Results

Featured snippet from the web

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster.
So, now we have a basic understanding of EC2 So, let's create our first EC2 instance.

The following steps describe the process of creating an EC2 instance: 
Log in to the AWS console using valid credentials and go to the EC2 dashboard.
1. Click on the Launch Instance command button.
2. Select the appropriate AMI based on the OS, root device type, and virtualization type.
3. The screen which displays a number of AMIs to choose from is shown below.
4. By default, you can see a number of AMIs in Quick Start. If required, you can select My AMIs, which contains all the custom AMIs created in a user's account. If you select AWS Marketplace from the left menu, it displays a number of third-party AMIs available in AWS Marketplace. Marketplace AMIs may not be free. You can also choose Community AMIs that contain a number of AMIs contributed by AWS community members. Alternatively, if you just want to create a free tier instance, you can select the checkbox against Free tier only:


Next Question Arises that What is AMI😦😦??? 
But the answer is below👇👇

Search Results

Featured snippet from the web

Image result for what is ami in aws
An Amazon Machine Image (AMI) provides the information required to launch an instance. Launch permissions that control which AWS accounts can use the AMI to launch instances. A block device mapping that specifies the volumes to attach to the instance when it's launched.
 

5.Once you select an AMI, it displays on the screen as shown in Figure 5.6. Select4. the appropriate instance type from the screen:


6.After selecting the instance type from the screen, click on Next: Configure5. Instance Details. The subsequent screen provides options to Configure Instance details, such as the number of instances to launch, payment option (spot or ondemand), VPC and subnet, public IP, IAM role, shutdown behavior, termination protection, advanced monitoring, and user data. The following screenshot displays the screen with options to configure instance details:

7. Add additional EBS volumes as required. Amazon allows up to 30 GB of General6. Purpose volume in the free tier. Also, while creating the EC2 instance, at this stage, it is possible to change the Delete on Termination option to true or false for each EBS volume, including the root volume. Once an instance is created, you can change the Delete on Termination option for EBS only through CLI or API. After selecting the appropriate option, click on the Next: Add Tags button, as shown in the following screenshot:

8. In the subsequent screen, as shown, you can add tags to your EC2 instance.7. Amazon assigns a distinct instance ID to every EC2 instance for uniquely identifying an instance. On top of that, you can also add additional tags to the instance for grouping them based on environment, that is, development, testing, preproduction or production, and so on. These tags are key value pairs and are case-sensitive:

9. The next screen shows provided options to Configure Security Group. You can8. open the required port on a specific protocol and source IPs. Generally, inbound rules are defined based on what ports and protocols are used by the application hosted on the server. You can either use an existing security group or you can create a new one based on the requirement. Figure 5.10 shows security group configuration options. After configuring the security group, you can click on Review and Launch:

10. In the subsequent screen of the wizard, you can finally review the configuration9. options you have selected during the launch instance wizard. If required, you can click on the Previous button and modify the options as needed:

11. After verifying all the options, you can click on the Launch button. Click on the Launch button, it asks you to either Select an existing key pair or create a new key pair. Select an existing key pair or give a suitable key name to create a new key pair. Remember to download the key. The key is available to download during this wizard only. AWS does not provide an option to download the key later on. After providing the key pair detail, you can click on the Launch Instance button. It may take a few minutes for the instance to launch. The time for an EC2 instance to come to running state depends on the AMI type and instance type.

Another Question Arises, What is this Key Pair😕😕????
But the answer is below👇👇

Search Results

Featured snippet from the web

Amazon EC2 key pairs and Linux instances.The public and private keys are known as a key pair. Public key cryptography enables you to securely access your instances using a private key instead of a password. The keys that Amazon EC2 uses are 2048-bit SSH-2 RSA keys.


Finally we have all done with creating our EC2 instance. So, now we need to Access (SSH) our instance. there are basically three ways to SSH to EC2. These are the following:
Just click on your instance, click on Connect and you will see the following screen.
Here you can see the three connection methods.
we are going to use the first one.


copy the example's first  line that you can see in above picture.
open your command prompt and paste it there. you will be shown the following error " test1.pm is not accessible" that's because you have to set some permissions and also need to add the path of your key. so, let's do that.


Just go to your file, right click on it, open it's properties , go the security and the click on advanced settings , Disable inheritance and remove everything except which contain your user name and click on apply then okay and save.
 

Just do like that as shown below. Finally we are into our instance.
Now let's create a small webpage on our server

we need to add the following command So, just follow me.

  • sudo su                                /// for go to root mod 
  • yum update                         /// to update your machine
  • yum upgrade                      /// to upgrade any packages
  • sudo yum -y install httpd   /// to install apache server on your linux machine
  • sudo service httpd start     /// to start httpd service
  • service httpd status          //// to check the status of Apache service whether it is running or not


  • cd /var/www/html/                 // to go to html directory
  • vim index.html                       // to insert text into your html file

rum the above vim command then click "i" to go to insert mode, write your html text then enter "esc" then write ":wq!" to save and exit to Vim then click enter.

we have all done. now copy the public IPv4 address and hit on browser.


you will see the following page.

Congrats and feel proud of yourself 😄. You have launched your first Virtual server.😇😇 

Hurrah! Congratulations we have done 🎊🎊…….!!!!!!!!
Hope you enjoy this.

if you are facing any issue then please let me know in comments.
 
Thanks!!!




Comments

Post a Comment

Popular posts from this blog

Static Website Hosting using Amazon S3