Simple tutorial for Amazon EC2

Source: Internet
Author: User
Tags ssh access cloudwatch

This article is based on a piece of text in the previous Amazon EC2 system and I hope you will like it.

The entire tutorial will show you how to create an EC2 instance from scratch and run a common Apache Web Service, which consists of three parts: account preparation, instance creation, and service startup.

Prepare an account

Before using the EC2 service, you must prepare an AWS (Amazon Web Service) account that has activated the EC2 service. The entire account preparation process consists of three steps:

    1. Register an account on the AWS main site.
    2. Click the account confirmation link to go to a page named "security credentials, on this page, the user will obtain the key pair, secure access key, And X.509 security certificate bound to the account. These security certificates will be used for SSH access and API calls.
    3. Navigate to the EC2 page and click "sign up for Amazon EC2" to activate the EC2 service.

 

Create an instance

You can create an EC2 instance in seven steps.

Figure 1. EC2 Management Interface

Step 1: Go to the Web management interface of Amazon EC2. The page displays the number of resources currently used, running status of the data center, document links, and function lists. Then, click the "launch instance" button to go to the process of creating an EC2 instance.

Figure 2. Select an AMI

Step 2: select an appropriate ami. On the AMI selection page (Figure 2), you can select three types of AMI: the first category is "Quick Start", which is a very simple AMI recommended by Amazon and suitable for beginners, it mainly includes Fedora Core 8, Windows Server 2008, and centos 5.4 Based on hvm technology. The second category is "My amis ", this type of AMI contains custom or feature-loaded applications, and these AMI permissions are private to users; The third type is "community amis ", this type of AMI is created and maintained by users in the EC2 community, and is shared. In terms of quantity, these AMI categories are very rich, so far, A large number of EC2 users have uploaded more than 5300 such kinds of AMI. Because the main purpose of this example is to start an apache service, "fedora lamp web starter" is selected here. The operating system of this Ami is Fedora Core 8 with a 32-bit architecture, install software such as PHP 5.2, Apache 2.2, and MySQL 5.

Figure 3. select an appropriate instance

Step 3: select an appropriate instance for the AMI, that is, the number of large virtual machines to load the AMI image. On the right instance selection page (figure 3), you can set the number of instances, the zone where the instance is located (availability zone), and the instance size (for example, small or high-CPU medium) and instance type (for example, common instance and spot instance ). Here, because it is just for the purpose of writing the tutorial, so only select a common small instance to load the selected AMI, and select the first us-east-1a in the zone ", that is, in Area A, data center, East USA 1.

Figure 4. Advanced instance options

Step 4: set some advanced instance options, mainly including four: the first is the kernel ID, which is to select the appropriate kernel for this instance and the AMI, for example, the latest kernel will be installed with the latest security patch and upgrade package; the second is the RAM disk ID, set the RAM disk corresponding to the kernel, because the kernel needs a RAM disk to load the corresponding driver, therefore, you need to select the appropriate one. The third is monitoring. To set this instance, you need to enable the cloudwatch observation service to check the CPU, hard disk, and network usage of the instance, note that the cloudwatch service requires additional charges; the fourth is user data, that is, entering data that you want the instance to receive when it starts. Because the kernel ID and RAM disk ID are difficult to select, you can directly select the default kernel ID and RAM disk ID and enable the cloud watch service without entering any user data. In addition, when creating a Windows instance, the selection of the kernel ID and RAM disk ID is not blocked.

Figure 5 key pair Configuration)

Step 5: There are three options for configuring the key pair for this instance: one is to select an existing key pair, for example, the key pair generated when an AWS account is created; the second is to create a new key pair. However, when creating a new key pair, you must ensure that the PEM key file of the new key pair is saved. The third is that no key pair is required, that is, the user knows the password of this Ami.

Figure 6. configure a Security Group

Step 6: When configuring a security group, you can select a created group or create a new security group for this instance.

Figure 7. running successfully

Step 7: confirm the previous input again and click "launch" to deploy the instance. After a few minutes, the Web Management page displays the message of successful running (figure 7 ),

 

Start the service

There are three main steps:

    1. Use the previous or just generated PEM key file to generate the putty PPK key on the puttygen tool.
    2. Use the generated PPK key and the Public DNS name of the instance to log on to the instance using the putty tool.
    3. Run the "chkconfig httpd on" command under the root account in the instance command to enable the apache service.

 

Note: Recently, EC2 is not very stable in China.

References:

    1. Use Amazon Web Services for cloud computing. Part 1: Use EC2 to provide servers as needed
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.