This topic describes how to create and manage Linux instances in the Elastic Compute Service (ECS) console. In this topic, Apache is configured for an ecs.g6.large instance that runs an Alibaba Cloud Linux 2.1903 LTS 64-bit operating system.

Preparations

  1. Create an Alibaba Cloud account and complete the account information.
  2. Optional: Create a virtual private cloud (VPC). Alibaba Cloud provides a default VPC. If you do not want to use the default VPC, you can create a VPC and a vSwitch in the region where you want to create an ECS instance.
    For more information, see Create a VPC with an IPv4 CIDR block.
  3. Optional: Create a security group. Alibaba Cloud provides a default security group. If you do not want to use the default security group, you can create a security group in the region where you want to create an ECS instance.
    For more information, see Create a security group.

Step 1: Create an ECS instance

  1. Go to the Custom Launch tab of the instance buy page in the ECS console.
  2. In the first four steps of the instance creation wizard on the Custom Launch tab, configure parameters for the instance.
    The following table describes the parameters that are used in this topic. For parameters that are not described in this topic, use the default values.
    StepParameterExampleDescription
    Basic ConfigurationsBilling MethodPay-as-you-goThe pay-as-you-go billing method allows flexible operations. For more information, see Billing overview.
    Note If an Internet content provider (ICP) filing is required for your domain name, you must select Subscription.
    Region
    • Region: China (Hangzhou)
    • Zone: Random
    You cannot change the region or zone after the instance is created. Proceed with caution when you set this parameter.
    Instance Type
    • Family: General Purpose Type g6
    • Instance Type: ecs.g6.large
    Instance types that are available are determined by the region that you select and the resource inventory in the region.

    You can go to the ECS Instance Types Available for Each Region page to view the instance types available in each region.

    Image
    • Type: Public Image
    • Version: Alibaba Cloud Linux 2.1903 LTS 64-bit
    After the instance is started, the operating system and application data of the image are copied to the system disk.
    NetworkingVPC[Default]vpc-bp1opxu1zkhn00g****Select an existing VPC. VPCs that are prefixed with [Default] are automatically created in the ECS console.
    Public IP AddressSelect Assign Public IPv4 AddressIf you select Assign Public IPv4 Address, the system assigns a public IPv4 address to the instance.
    Bandwidth BillingPay-By-TrafficIn Pay-By-Traffic mode, you are charged based on the amount of data transferred to the Internet. For more information, see Public bandwidth.
    Peak Bandwidth5 MbpsNone.
    Security Group[Default]sg-bp1bhjjsoiyx44hd****Select an existing security group. Security groups that are prefixed with [Default] are automatically created in the ECS console.
    System Configurations (Optional)Logon CredentialsPasswordIn this topic, Password is selected. You must set a password for connections and logons to the ECS instance.
    Logon PasswordEcs123456If you set Logon Credentials to Password, you must set the Logon Password and Confirm Password parameters. When you connect to the ECS instance, you must use the root or ecs-user username and the corresponding password that you specify in this section.
    Instance NameEcsQuickStartIn this topic, EcsQuickStart is used as the instance name.
    Grouping (Optional)TagsECS:DocumentationIf you create multiple instances, we recommend that you add tags to facilitate management.
  3. Click Next. In the Preview step, confirm the configurations in the Configurations Selected section or click the Edit icon icon to modify configurations.
  4. Optional:Click Save as Launch Template. In the Save as Launch Template dialog box, set Template Name and Version Description.
    Note Save the instance configurations that you made as a launch template. You can create an instance by using the template without the need to configure the required parameters again.
  5. Read and select ECS Terms of Service and Product Terms of Service. Then, click Create Order.
  6. In the Created message, click Console to view the instance creation progress on the Instances page.
    If the instance is created, it is in the Running state. Copy the public IP address for use when you connect to the ECS instance.

Step 2: Add security group rules

If you did not add rules to the default security group or if you added the instance to a new security group when you create the instance, perform the following steps:

  1. Click the instance ID to go to the Instance Details page.
  2. On the Instance Details page, click the Security Groups tab. Click the ID of a security group to go to the security group details page.
  3. In the Access Rule section, click the Inbound tab.
  4. Click Quick Add to add security group rules as described in the following table. For parameters that are not described in this topic, use the default values.
    ActionPort RangeAuthorization Object
    Allow
    • SSH 22
    • RDP 3389
    • HTTP 80
    • HTTPS 443
    0.0.0.0/0
    Note
    • For the Port Range section, select the ports that must be enabled for the applications that run on the ECS instance. For example, if you want to use SSH and Apache in Step 4: Configure Apache, select SSH (22) and HTTP (80). Otherwise, the instance does not respond in subsequent operations.
    • 0.0.0.0/0 indicates that access from all CIDR blocks is allowed to the specified ports. If you know the IP address of the requester, we recommend that you set Authorization Object to a specific IP address range that contains this IP address.
  5. Click OK.

Step 3: Connect to the ECS instance

  1. Go back to the Instances page and find the instance to which you want to connect. In this topic, the EcsQuickStart instance is used.
  2. In the Actions column, click Connect.
  3. In the Connection and Command dialog box, click Connect in the VNC Connection section.
  4. In the Enter VNC Password dialog box, click Reset VNC Password.
  5. Reset the password. In the Enter VNC Password dialog box, enter your new password and click OK.
  6. Configure the logon credentials.
    • Username: Enter ecs-user.
    • Password: Enter the Logon Password value that you set in the Logon Credentials section when you create the instance. In this example, Ecs123456 is used.
    When you are entering the password, the section next to Password: remains black and no messages appear. login

Step 4: Configure Apache

  1. Install Apache.
    yum install -y httpd
  2. Start Apache.
    systemctl start httpd
  3. Configure Apache to run on system startup.
    systemctl enable httpd
  4. Check whether Apache is running.
    systemctl status httpd
    If active (running) is returned, Apache is running.
  5. Open a website page in your browser. Enter the public IP address of the instance in the address bar and press the Enter key.
    http://<Public IP address of the instance>
    apache

Step 5: (Optional) Resolve a domain name

Direct access to Apache by using the public IP address of the instance may compromise server security. If you already have a domain name or if you want to register one for the Apache website, perform the following steps:

  1. Register a domain name.
    For more information, see Register a domain name on Alibaba Cloud.
  2. If the website to which the domain name points is hosted on an ECS instance in a Chinese mainland region, you must apply for an ICP filing for the domain name.
  3. Resolve the domain name to point to the public IP address of the instance.
    Domain name resolution is a prerequisite for using domain names to access your website. For more information, see Configure the DNS settings for a domain name .
  4. Use the resolved domain name to access Apache. Example: https://ecs-quickstarts.info.

Step 6: (Optional) Release the ECS instance

You can release the instance if you no longer need it. After the instance is released, the billing stops, and its data is lost and cannot be restored.

Note Only pay-as-you-go instances can be released by using the method described in this step.
  1. Go back to the Instances page and find the instance that you want to release. In this topic, the EcsQuickStart instance is used.
  2. In the Actions column, choose More > Instance Status > Release.
  3. In the Release dialog box, set Release Mode to Release Now and click Next.
  4. In the Release message, verify the instance to be released and click OK.

Step 7: View bills

  1. In the top navigation bar, choose Expenses > User Center.
  2. In the left-side navigation pane, choose Spending Summary > Spending Summary. On the Bills page, click the Details tab.
  3. Set Instance Name to EcsQuickStart and press the Enter key to start a search.

What to do next