HCIP-Cloud Service Solutions Architect V3.0 Lab Guide
HCIP-Cloud Service Solutions Architect V3.0 Lab Guide
Lab Guide
ISSUE: 3.0
1
Copyright © Huawei Technologies Co., Ltd. 2022. All rights reserved.
No part of this document may be reproduced or transmitted in any form or by any
means without prior written consent of Huawei Technologies Co., Ltd.
and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.
All other trademarks and trade names mentioned in this document are the property of
their respective holders.
Notice
The purchased products, services and features are stipulated by the contract made
between Huawei and the customer. All or part of the products, services and features
described in this document may not be within the purchase scope or the usage scope.
Unless otherwise specified in the contract, all statements, information, and
recommendations in this document are provided "AS IS" without warranties,
guarantees or representations of any kind, either express or implied.
The information in this document is subject to change without notice. Every effort has
been made in the preparation of this document to ensure accuracy of the contents, but
all statements, information, and recommendations in this document do not constitute
a warranty of any kind, express or implied.
Introduction
This document is intended for readers who are preparing for the HCIP-Cloud Service
Solutions Architect exam or interested in the basics of the HCIP-Cloud Service Solutions
Architect courses, including the evolution of enterprise IT, cloud-based architecture of
traditional applications, solution design of cloud-based compute, storage, network,
database, and security, containers and cloud native, and Huawei Cloud O&M.
three object versions in the OBS bucket using FunctionGraph, and use and configure
FunctionGraph.
Exercise 7 is about microservice application deployment, including microservice
deployment and weathermap microservice building through ServiceStage, helping
you understand the methods and principles of building ServiceStage microservices.
Exercise 8 is about cloud O&M, including Cloud Eye and Application Operations
Management (AOM), helping you understand their architectures, principles, and
usage.
Knowledge Background
This document is part of the Huawei certification courses. Before reading this document,
readers should understand:
Basics of the HCIA-Cloud Service courses and cloud computing
Basics of Linux
Lab Environment
The lab environment of these exercises is Huawei Cloud
(https://www.huaweicloud.com/intl/en-us/). You do not need to purchase any equipment
and all the operations described in this document are performed in this environment. Log
in to Huawei Cloud Help Center (https://support.huaweicloud.com/intl/en-us/) if you
need technical help.
HCIP-Cloud Service Solutions Architect Lab Guide Page 5
Contents
1.1 Introduction
1.1.1 About This Exercise
In this exercise, you will be guided on how to create a WordPress website using Elastic Cloud
Server (ECS) and Relational Database Service (RDS) in Virtual Private Cloud (VPC) on Huawei
Cloud. In the cloud architecture, Elastic Load Balance (ELB) will be used to distribute traffic
and improve fault tolerance of the website. Auto Scaling (AS) will be used to ensure high
service quality and compute resource utilization. Text injection will be used to keep the
address of the backend database connected to ECSs created by AS unchanged during resource
scaling. After completing this exercise, you will understand how to use Huawei Cloud compute
services.
1.1.2 Objectives
Understand how to use cloud services in the cloud computing architecture design.
Master the methods for designing the availability, scalability, and performance of cloud
resources.
1.1.4 Networking
Figure 1-1
1.2 Procedure
1.2.1 Creating VPCs and Security Groups
Step 1 Visit https://intl.huaweicloud.com/en-us/ and log in using your Huawei Cloud
account. Select CN-Hong Kong region (The CN-Hong Kong region is used as an
example in this exercise), and choose Networking > Virtual Private Cloud in the
service list.
Figure 1-2
Step 2 Click Create VPC. (Resources in this exercise will be created in this VPC.)
HCIP-Cloud Service Solutions Architect Lab Guide Page 11
Figure 1-3
Step 3 Configure the following parameters and click Create Now.
Basic Information
Region: CN-Hong Kong (The CN-Hong Kong region is used as an example in this
exercise.)
Name: vpc-1
IPv4 CIDR Block: 192.168.0.0/16
Default Subnet
AZ: AZ3 (AZ3 is used as an example in this exercise.)
Name: vpc-1-subnet
IPv4 CIDR Block: 192.168.1.0/24
Figure 1-4
Step 4 On the Network Console, choose Access Control > Security Groups, and click Create
Security Group in the upper right corner.
HCIP-Cloud Service Solutions Architect Lab Guide Page 12
Figure 1-5
Step 5 Create a security group. (This security group is used by the RDS service and traffic
should be allowed on port 3306.)
Name: sg-rds
Template: Select a required one.
Figure 1-6
Step 6 In the dialog box displayed, click Manage Rule.
Figure 1-7
Step 7 Click the Inbound Rules tab, and then click Add Rule.
HCIP-Cloud Service Solutions Architect Lab Guide Page 13
Figure 1-8
Step 8 Add a rule as follows:
Priority: 1
Action: Allow
Protocol: TCP
Port: 3306
Source: IP address and 0.0.0.0
Figure 1-9
Step 9 Click OK.
Figure 1-10
Step 10 Create the security group sg-web and select General-purpose web server as its
template. (This security group is used by the ECS in this exercise.)
HCIP-Cloud Service Solutions Architect Lab Guide Page 14
Figure 1-11
Figure 1-12
Step 2 Click Buy DB Instance in the upper right corner.
Figure 1-13
Step 3 Configure parameters as follows:
Billing Mode: Pay-per-use
Region: CN-Hong Kong (The CN-Hong Kong region is used as an example in this
exercise.)
HCIP-Cloud Service Solutions Architect Lab Guide Page 15
Figure 1-14
Figure 1-15
VPC: vpc-1
Subnet: vpc-1-subnet
Security Group: sg-rds
Administrator Password: User-defined
HCIP-Cloud Service Solutions Architect Lab Guide Page 16
Figure 1-16
Step 4 Click Next. Confirm the configurations and click Submit.
Step 5 On the Instances page, locate the instance and choose More > Log In in the
Operation column.
Figure 1-17
Step 6 Enter the username and password, click Test Connection, and then click Log In.
HCIP-Cloud Service Solutions Architect Lab Guide Page 17
Figure 1-18
Step 7 On the displayed page, click Create Database. The created database will be used to
interconnect with WordPress.
Figure 1-19
Step 8 Enter wordpress for Name, retain the default character set, and click OK.
HCIP-Cloud Service Solutions Architect Lab Guide Page 18
Figure 1-20
Step 9 Switch back to the RDS console. On the Instances page, click the instance name to
go to the Basic Information page.
Figure 1-21
Step 10 Record the floating IP address and port number of the instance for future use.
Note: When configuring WordPress, you need to enter such information in the
configuration file.
Figure 1-22
Figure 1-23
Step 2 Configure settings for the ECS.
Region: CN-Hong Kong (The CN-Hong Kong region is used as an example in this
exercise.)
AZ: AZ 2 (AZ 2 is used as an example in this exercise.)
CPU Architecture: x86
Specifications: 2 vCPUs | 4 GiB
Image: Public image | CentOS 7.6 64bit(40GB)
Host Security: Enable (Basic)
Network: vpc-1 | vpc-1-subnet | Automatically assign IP address
Security Group: sg-web
EIP: Auto assign
EIP Type: Premium BGP
Billed By: Traffic
Bandwidth Size: 10 Mbit/s
System Disk: High I/O | 40 GiB
ECS Name: ecs-wordpress
Password: User-defined (with the username of root)
HCIP-Cloud Service Solutions Architect Lab Guide Page 20
Figure 1-24
Step 3 Confirm the configurations and click Submit.
HCIP-Cloud Service Solutions Architect Lab Guide Page 21
Figure 1-25
Step 2 Install Linux, Apache, MySQL, PHP/Perl/Python (LAMP) and start related services.
[root@ecs-wordpress ~]# yum install -y httpd php php-fpm php-server php-mysql mysql
Figure 1-26
Step 3 Configure httpd.
Step 4 In the configuration file, press Shift+G to go to the last line of the configuration file,
press I to enter the editing mode, move the cursor to the end of the configuration
file, and press Enter. Then copy and paste the following code.
Note: This step is used to set the host name and port number for the server. To enhance
reliability and predictability, use the host name and port number specified by
ServerName.
ServerName localhost:80
HCIP-Cloud Service Solutions Architect Lab Guide Page 22
Figure 1-27
Step 5 Press Esc to exit the editing mode, enter :wq, and press Enter to save and exit the
configuration file.
Figure 1-28
Step 6 Download the WordPress installation package.
Figure 1-29
Step 7 Decompress the WordPress installation package to /var/www/html.
Figure 1-30
Step 8 Create a wp-config.php file.
Figure 1-31
Step 9 Configure database parameters in the wp-config.php file to interconnect with the
wordpress database.
Figure 1-32
Step 10 Grant read and write permissions to the directory where the package is
decompressed.
Figure 1-33
Step 11 Enable httpd and php-fpm.
Step 12 Check the httpd service status. The status active (running) indicates that the httpd
service has been enabled.
Figure 1-34
Step 13 Check the php-fpm service status. The status active (running) indicates that the
php-fpm service has been enabled.
HCIP-Cloud Service Solutions Architect Lab Guide Page 25
Figure 1-35
Step 14 Set httpd and php-fpm to automatically start upon system startup.
Figure 1-36
Step 15 Open a browser and enter http://External IP address of ECS-
WordPress/wordpress/index.php in the address bar (in this exercise, enter
http://119.3.199.107/wordpress/index.php). If the information shown in the
following figure is displayed, the ECS is successfully interconnected with the
database.
HCIP-Cloud Service Solutions Architect Lab Guide Page 26
Figure 1-37
Figure 1-38
Step 2 In the upper right corner, click Create Image.
Figure 1-39
Step 3 Configure the following parameters and click Next.
Region: CN-Hong Kong (The CN-Hong Kong region is used as an example in this
exercise.)
Type: System Disk Image
Source: ECS (Select ecs-wordpress you created.)
Name: wordpress
Figure 1-40
Step 4 Locate wordpress in the image list and click Apply for Server in the Operation
column.
The ECSs created here and ecs-wordpress created previously will be added to a backend
server group of Elastic Load Balance (ELB).
HCIP-Cloud Service Solutions Architect Lab Guide Page 28
Figure 1-41
Note: The EIP will be bound to the load balancer in the follow-up exercise.
Figure 1-42
Step 2 In the service list, choose Networking > Elastic Load Balance.
HCIP-Cloud Service Solutions Architect Lab Guide Page 30
Figure 1-43
Step 3 Click Buy Elastic Load Balancer in the upper right corner.
Figure 1-44
Step 4 Configure the parameters as follows:
Type: Shared
Region: CN-Hong Kong (The CN-Hong Kong region is used as an example in this
exercise.)
Network Type: Public network
VPC: vpc-1
Subnet: vpc-1-subnet
Private IP Address: Automatically-assigned IP address
HCIP-Cloud Service Solutions Architect Lab Guide Page 31
Figure 1-45
EIP: Use existing (Assign the above unbound EIP to this load balancer.)
Name: elb-wordpress
Figure 1-46
Step 5 Locate the elb-wordpress in the load balancer list and click Add listener.
Figure 1-47
Step 6 Configure the parameters as follows:
Name: listener-wordpress
Frontend Protocol: TCP
Frontend Port: 80 (Used by this load balancer to receive requests from clients.)
HCIP-Cloud Service Solutions Architect Lab Guide Page 32
Figure 1-48
Enable Sticky Session to ensure that requests from a client always are routed to the
same server before a session ends. Use the default values for other parameters and
click Next: Add Backend Server.
Figure 1-49
Click Add.
HCIP-Cloud Service Solutions Architect Lab Guide Page 33
Select ECS ecs-wordpress and the ECS ecs-wordpress-0001 created using the image.
Figure 1-50
Set Batch Add Ports to 80 (used by backend servers to receive requests from this
load balancer). Use the default values for other parameters, and click Finish.
Figure 1-51
HCIP-Cloud Service Solutions Architect Lab Guide Page 34
After the load balancer is created, choose Listeners > Backend Server Groups to
ensure the health check result is Healthy.
Figure 1-52
View the created load balancer on the load balancer page.
Figure 1-53
Step 7 Log in to http://119.3.199.107 (EIP bound to this load balancer)
/wordpress/index.php again. If the following information is displayed, the load
balancer is successfully deployed.
HCIP-Cloud Service Solutions Architect Lab Guide Page 35
Figure 1-54
1.2.7 Creating an AS Group
Step 1 In the service list, choose Data Encryption Workshop under Security & Compliance.
Figure 1-55
Step 2 Choose Key Pair Service in the left navigation pane and click Create Key Pair.
HCIP-Cloud Service Solutions Architect Lab Guide Page 36
Figure 1-56
Set Key Pair Name to KeyPair-wordpress and click OK.
Note: In this exercise, the key pair is used to create an AS group only.
Figure 1-57
Step 3 In the service list, choose Auto Scaling under Compute.
HCIP-Cloud Service Solutions Architect Lab Guide Page 37
Figure 1-58
Step 4 Click Create AS Configuration in the upper right corner.
Figure 1-59
Step 5 Configure the parameters as follows:
Billing Mode: Pay-per-use
Region: CN-Hong Kong (The CN-Hong Kong region is used as an example in this
exercise.)
Name: as-config-wordpress
Configuration Template: Create new template
HCIP-Cloud Service Solutions Architect Lab Guide Page 38
Figure 1-60
Specifications: 2 vCPUs | 4 GiB
Image: Private image | wordpress
Disk: EVS | High I/O | 40 GB
Security Group: sg-web
EIP: Do not use
Figure 1-61
Select Key Pair for Login Mode and select the key pair you created from the drop-
down list. Select Configure now for Advanced Settings, leave User Data to As text,
and copy the following content to the box to modify the database address in the wp-
config.php file in the selected image. (In this exercise, the IP address following
DB_HOST is changed from 192.168.1.137 to 192.168.1.207.)
#!/bin/bash
sed -i -E "s/'DB_HOST',\s*'.*?'/'DB_HOST', '192.168.1.207'/" /var/www/html/wordpress/wp-config.php
HCIP-Cloud Service Solutions Architect Lab Guide Page 39
Note: 192.168.1.207 is the private IP address of the backend database in this lab. Replace
it with the actual IP address.
Figure 1-62
Step 6 After the AS configuration is created, click Create AS Group in the upper right
corner.
Figure 1-63
Step 7 Configure the parameters as follows:
Region: CN-Hong Kong (The CN-Hong Kong region is used as an example in this
exercise.)
AZ: Retain the default setting.
Multi-AZ Scaling Policy: Balanced
Name: as-config-wordpress
Max. Instances: 4
Expected Instances: 2 (Considering the lab environment capacity, you are advised to
set the expected number of instances to 2 in this exercise.)
Min. Instances: 1
AS Configuration: as-config-wordpress
VPC: vpc-1
Subnet: vpc-1-subnet
Load Balancing: Elastic load balancer
HCIP-Cloud Service Solutions Architect Lab Guide Page 40
Figure 1-64
Retain the default settings for other parameters and click Create Now.
HCIP-Cloud Service Solutions Architect Lab Guide Page 41
Figure 1-65
Step 8 In the AS group list, check that the created AS group is enabled.
Figure 1-66
Step 9 Click Elastic Cloud Server in the left navigation pane. Check that two ECSs are
created by AS and displayed in the ECS list.
Figure 1-67
Step 10 Locate an ECS and click Remote Login to log in to the ECS. Then run the following
command to view the wp-config.php file on the ECS. Check that the value of
DB_HOST has been changed from 192.168.1.137 to 192.168.1.207. (This step is
performed to verify the text injection is successful and does not affect login.)
Note: You can use text injection to easily modify the backend database address. In this
way, you can keep services run during resource scaling without the need to create
images.
HCIP-Cloud Service Solutions Architect Lab Guide Page 42
Figure 1-68
Step 11 Delete the two ECSs named ecs-wordpress you created manually in previous
sections.
Note: This step is to check whether the ECSs scaled out by AS can provide services
properly.
Figure 1-69
Step 12 Open a browser and enter http://(EIP of the load balancer)/wordpress/index.php.
HCIP-Cloud Service Solutions Architect Lab Guide Page 43
Figure 1-70
Step 13 Enter the registration information as follows and click Install WordPress. After the
installation is complete, log in to WordPress. If the login is successful, the ECS
created by AS can provide services properly.
Site Title: HCIP
Username: huawei (user-defined)
Password: User-defined
Your Email: User-defined
HCIP-Cloud Service Solutions Architect Lab Guide Page 44
Figure 1-71
Figure 1-72
On the AS Groups tab, locate the row containing the AS group to be deleted and
choose More > Delete in the Operation column.
Click the AS Configurations tab, locate the row containing the AS configuration to be
deleted, and click Delete in the Operation column.
Figure 1-73
On the Listeners tab, delete the listener purchased in this exercise.
Figure 1-74
Back to the load balancer list and click Delete in the Operation column to delete the
load balancer.
In the displayed dialog box, select Release the EIP and click Yes.
HCIP-Cloud Service Solutions Architect Lab Guide Page 46
Figure 1-75
Step 4 Delete the image created in this exercise.
In the service list, choose Image Management Service under Compute. In the private
image list, locate the image created in this exercise and choose More > Delete in the
Operation column.
Figure 1-76
Step 7 Delete the security group.
In the service list, choose Virtual Private Cloud under Networking. In the security
group list, locate the security group created in this exercise and click Delete in the
Operation column.
1.4 Quiz
Question: If health check is enabled without specifying a health check port, how will the
health check be performed?
Answer: If you do not specify a health check port, a port of the backend server will be
used for health checks by default. If you specify a port, the port will be used for health
checks.
HCIP-Cloud Service Solutions Architect Lab Guide Page 48
2.1 Introduction
2.1.1 About This Exercise
This exercise uses Huawei Cloud resources in different regions to represent on-premises
and cloud resources, describes how on-premises resources can communicate with cloud
resources and manage cloud resources for O&M, and how cloud resources can
communicate with each other and access the internet.
VPC 1 in the CN-Hong Kong region represents an on-premises network, and its ECS
represents an on-premises server used for O&M. VPC 2, VPC 3, and their ECSs in the AP-
Singapore region represent cloud resources.
To enable ECSs in VPC 2 and VPC 3 in the AP-Singapore region to communicate with
each other, a VPC peering connection is required. To enable the on-premises ECS used for
O&M in the CN-Hong Kong region to manage cloud resources in AP-Singapore region,
Virtual Private Network (VPN) and VPC peering connections are required. To enable
internet access, a NAT gateway is deployed in VPC 2 in the AP-Singapore region so that
ECSs in VPC 3 and VPC 2 can access the internet through the NAT gateway.
This exercise uses regions CN-Hong Kong and AP-Singapore as an example. Trainees can
select regions based on their own needs.
2.1.2 Objectives
Understand how to use the cloud services involved in the cloud network architecture.
Understand how to design cloud networks with scalability, manage cloud and on-
premises resources in unified manner, and allow cloud and on-premises communications.
HCIP-Cloud Service Solutions Architect Lab Guide Page 49
2.1.3 Networking
Figure 2-1
2.2 Procedure
2.2.1 Creating VPCs
Step 1 Visit https://intl.huaweicloud.com/en-us/ and log in using your Huawei Cloud
account. If you are an IAM user, log in as an IAM user.
Figure 2-2
HCIP-Cloud Service Solutions Architect Lab Guide Page 50
Figure 2-3
Step 2 Click Console and select CN-Hong Kong.
Step 3 In the service list, choose Networking > Virtual Private Cloud.
Figure 2-4
Step 5 Configure the following parameters and click Create Now.
Figure 2-5
Step 6 Repeat the preceding steps to create VPC 2 and VPC 3 as follows.
Basic Information
Region: AP-Singapore
Name: vpc-2
IPv4 CIDR Block: 192.168.0.0/16
Default Subnet
AZ: AZ1
Name: vpc-2-subnet
IPv4 CIDR Block: 192.168.2.0/24
Basic Information
Region: AP-Singapore
Name: vpc-3
IPv4 CIDR Block: 192.168.0.0/16
Default Subnet
AZ: AZ1
Name: vpc-3-subnet
IPv4 CIDR Block: 192.168.3.0/24
HCIP-Cloud Service Solutions Architect Lab Guide Page 52
Figure 2-6
Figure 2-7
Step 2 Configure the parameters as follows and click OK.
Note: This security group is used by ECSs in VPC 1. You need to allow all ICMP traffic and
traffic on port 22. ICMP is used for connectivity tests, and port 22 is used for SSH login
tests.
Name: sg-1
Template: Select a required one.
Figure 2-8
Step 3 In the dialog box displayed, click Manage Rule.
Figure 2-9
Step 4 Add the first inbound rule as follows:
HCIP-Cloud Service Solutions Architect Lab Guide Page 53
Priority: 1
Action: Allow
Protocol: ICMP
Port: All
Source: IP address and 0.0.0.0/0
Figure 2-10
Step 5 Add the second inbound rule as follows:
Priority: 1
Action: Allow
Protocol: TCP
Port: 22
Source: IP address and 0.0.0.0/0
Figure 2-11
Step 6 Repeat the preceding steps to create security group sg-4 in the AP-Singapore
region.
Note: Security group sg-4 is used by ECSs in the AP-Singapore region. You also need to
allow all ICMP traffic and traffic on port 22.
HCIP-Cloud Service Solutions Architect Lab Guide Page 54
Figure 2-12
Step 2 Configure the parameters as follows.
Figure 2-13
Step 3 Repeat the preceding steps to purchase ecs-02 and ecs-03 in the AP-Singapore
region.
Figure 2-14
ecs-03 configuration:
Billing Mode: Pay-per-use
Region: AP-Singapore
AZ: Random
CPU Architecture: x86
Specifications: 1 vCPUs | 2 GiB
HCIP-Cloud Service Solutions Architect Lab Guide Page 58
Figure 2-15
Note: This VPC peering connection is used to enable cloud resources in VPC 2 and VPC 3
to communicate.
HCIP-Cloud Service Solutions Architect Lab Guide Page 60
Figure 2-16
Step 2 Configure the parameters as follows:
Name: vpc2-vpc3
Local VPC: vpc-2
Account: My account
Peer Project: ap-southeast-3
Peer VPC: vpc-3
Figure 2-17
Step 3 Return to the VPC peering connection list, view the created VPC peering connection
vpc2-vpc3, and click the connection name vpc2-vpc3.
HCIP-Cloud Service Solutions Architect Lab Guide Page 61
Figure 2-18
Step 4 Click Route Tables on the Local Routes tab to go to the details page of the rtb-vpc-
2 route table.
Figure 2-19
Step 5 Click Add Route.
Figure 2-20
Step 6 Configure the parameters as follows and click OK.
Note: This route is added to the route table of VPC 2 to forward traffic to the subnet in
VPC 3.
Destination: 192.168.3.0/24
Next Hop Type: VPC peering connection
Next Hop: vpc2-vpc3
HCIP-Cloud Service Solutions Architect Lab Guide Page 62
Figure 2-21
Step 7 In the route table list, click the name of the rtb-vpc-3 route table to add a peer
route.
Figure 2-22
Step 8 Click Add Route.
Figure 2-23
Step 9 Configure the parameters as follows and click OK.
Note: This route is added to the route table of VPC 3 to forward traffic to the subnet in
VPC 2.
Destination: 192.168.2.0/24
Next Hop Type: VPC peering connection
Next Hop: vpc2-vpc3
HCIP-Cloud Service Solutions Architect Lab Guide Page 63
Figure 2-24
Step 10 Log in to ecs-03 and verify the communication between ecs-02 and ecs-03.
Locate the row that contains ecs-03 and click Remote Login in the Operation
column.
Figure 2-25
Enter the password to log in to ecs-03.
Figure 2-26
Ping ecs-02 from ecs-03 to test the communication between them.
Note: 192.168.2.23 is the private IP address of ecs-02 in the VPC.
HCIP-Cloud Service Solutions Architect Lab Guide Page 64
Figure 2-27
Figure 2-28
Step 2 Set the following parameters to create a VPN gateway.
Note: This VPN gateway connects the on-premises site in the CN-Hong Kong region to
cloud resources in the AP-Singapore region.
Billing Mode: Pay-per-use
Region: CN-Hong Kong
HCIP-Cloud Service Solutions Architect Lab Guide Page 65
Figure 2-29
VPN gateway configuration:
Name: vpngw-vpc1
VPC: vpc-1
Type: IPsec
Billed By: Bandwidth
Bandwidth (Mbit/s): 5 Mbit/s
Figure 2-30
VPN connection configuration:
Name: vpn-1
Local Subnet: Select subnet | vpc-1-subnet
Remote Gateway: 100.100.100.100 (Change this IP address to the actual IP address
of the remote gateway after you create the remote gateway.)
Remote Subnet: 192.168.2.0/24,192.168.3.0/24
Note: Enter the subnets of both VPC 2 and VPC 3. This configuration specifies the
traffic of interest in IPsec on the local end. IPsec encapsulation will be performed on
the specified traffic.
PSK: User-defined
HCIP-Cloud Service Solutions Architect Lab Guide Page 66
Figure 2-31
Step 3 Confirm the configuration and click Submit.
Step 4 View the created VPN gateway, and record its IP address (159.138.15.141 in this
example).
Note: You need to enter this VPN gateway IP address when creating a remote VPN
gateway.
Figure 2-32
Step 5 In the AP-Singapore region, click Console, choose Virtual Private Network > VPN
Gateway, and click Buy VPN Gateway. Set parameters as follows to create a VPN
gateway:
Note: This VPN gateway is created on the cloud (AP-Singapore region) to connect to the
VPN gateway at the on-premises site (CN-Hong Kong region).
Region: AP-Singapore
Name: vpngw-vpc2
VPC: vpc-2
Type: IPsec
Billed By: Bandwidth
Bandwidth (Mbit/s): 5
HCIP-Cloud Service Solutions Architect Lab Guide Page 67
Figure 2-33
Step 6 Set the following parameters to create a VPN connection.
Name: vpn-1-2
Local Subnet: Select subnet | vpc-2-subnet
Remote Gateway: 159.138.15.141 (IP address of the VPN gateway created in Step 2)
Remote Subnet: 192.168.1.0/24
Note: Enter the subnet of VPC 1. This configuration specifies the traffic of interest in
IPsec on the local end. IPsec encapsulation will be performed on the specified traffic.
PSK: User-defined
Advanced Settings: Default
HCIP-Cloud Service Solutions Architect Lab Guide Page 68
Figure 2-34
Step 7 View the created VPN gateway, and record its IP address (159.138.81.15 in this
example).
Note: You need to change the value of Remote Gateway to this gateway IP address for
the VPN gateway in the CN-Hong Kong region.
Figure 2-35
Step 8 Switch to the CN-Hong Kong region, and choose Virtual Private Network > VPN
Connections.
HCIP-Cloud Service Solutions Architect Lab Guide Page 69
Figure 2-36
Step 9 Choose More > Modify in the Operation column.
Figure 2-37
Step 10 Change the value of Remote Gateway to 159.138.81.15, and click OK.
Before change
Figure 2-38
After change
HCIP-Cloud Service Solutions Architect Lab Guide Page 70
Figure 2-39
Step 11 Check that the VPN connection status is Updating.
Note: When no traffic triggers IPsec SA negotiation, the VPN connection remains in the
Updating state.
Figure 2-40
Step 12 Log in to ECS01, and run the ping command to test connectivity with ECS02. Then,
traffic of interest in IPsec is sent, which triggers IPsec SA negotiation.
Figure 2-41
Step 13 Refresh the VPN connection page. The VPN connection status is changed to
Normal.
This means that the VPN connection is successfully established, IPsec SA negotiation is
successful, and packets can be properly transmitted.
HCIP-Cloud Service Solutions Architect Lab Guide Page 71
Figure 2-42
Step 1 Go to the route table management page of the AP-Singapore region, and select the
rtb-vpc-3 route table of VPC 3.
Figure 2-43
Step 2 Click Add Route.
Figure 2-44
Step 3 Add a route to 192.168.1.0/24, with the next hop set to a VPC peering connection.
Then, click Confirm.
HCIP-Cloud Service Solutions Architect Lab Guide Page 72
Note: This configuration adds a route destined for VPC 1 to the route table of VPC 3.
Destination: 192.168.1.0/24
Next Hop Type: VPC peering connection
Next Hop: vpc2-vpc3
Figure 2-45
Step 4 In the AP-Singapore region, click Console, and choose Virtual Private Network >
VPN Connections. Change the value of Local Subnet to Specify CIDR block for the
VPN connection vpn-1-2, and add the CIDR block 192.168.3.0/24.
Before change
Figure 2-46
After change
HCIP-Cloud Service Solutions Architect Lab Guide Page 73
Figure 2-47
Note: After the modification, VPC 3 has a route to 192.168.1.0/24, and the local subnet of
the VPN connection in the AP-Singapore region contains the CIDR block 192.168.3.0/24.
When packets on 192.168.3.0/24 reach VPC 2, IPsec encapsulation is triggered for the
packets.
This NAT gateway is created in vpc-2 to enable Internet access for resources in vpc-2 and
vpc-3.
Billing Mode: Pay-per-use
Region: AP-Singapore
EIP Type: Dynamic BGP
Billed By: Traffic
Bandwidth (Mbit/s): 5
Bandwidth Name: NAT-IP
Retain the default settings for other parameters.
HCIP-Cloud Service Solutions Architect Lab Guide Page 74
Figure 2-48
Step 2 In the AP-Singapore region, choose NAT Gateway under Networking. On the
displayed Public NAT Gateway page, and click Buy Public NAT Gateway in the
upper right corner.
Figure 2-49
Step 3 Configure required parameters.
Billing Mode: Pay-per-use
Region: AP-Singapore
Name: nat-vpc2
VPC: vpc-2
Subnet: vpc-2-subnet
Specifications : Small
HCIP-Cloud Service Solutions Architect Lab Guide Page 75
Figure 2-50
Step 4 In the displayed dialog box, click Add Rule.
Figure 2-51
Step 5 Add the first SNAT rule to enable servers in 192.168.2.0/24 of vpc-2 to access the
Internet.
Scenario: VPC
Subnet: Existing | vpc-2-subnet
EIP: 121.36.79.241 (Select the newly created EIP.)
HCIP-Cloud Service Solutions Architect Lab Guide Page 76
Figure 2-52
Step 6 Add the second SNAT rule to enable servers in 192.168.3.0/24 of vpc-3 to access the
Internet.
Scenario: Direct Connect/Cloud Connect | 192.168.3.0/24
EIP: 121.36.79.241 (Select the newly created EIP.)
HCIP-Cloud Service Solutions Architect Lab Guide Page 77
Figure 2-53
Step 7 View the SNAT rule list. Check whether the SNAT rules you added are displayed in
the SNAT rule list.
Figure 2-54
Step 8 In route table rtb-vpc-3 of vpc-3, click Add Route.
Figure 2-55
Step 9 Add a default route pointing to the VPC peering connection and click OK.
The default route is used to divert Internet access traffic generated from vpc-3 to vpc-2
through a VPC peering connection. Then servers in vpc-3 can use the SNAT rule added in
vpc-2 to access the Internet.
Destination: 0.0.0.0/0
Next Hop Type: VPC peering connection
Next Hop: vpc2-vpc3
HCIP-Cloud Service Solutions Architect Lab Guide Page 78
Figure 2-56
Figure 2-57
The preceding information indicates that you can log in to ECS02 and ECS03 using SSH
from ECS01, and the on-premises O&M host (ECS01) can perform remote O&M on cloud
resources.
HCIP-Cloud Service Solutions Architect Lab Guide Page 79
Figure 2-58
Step 2 In the AP-Singapore region, Log in to ECS02 and ping a public IP address.
Figure 2-59
The preceding command output indicates that servers in vpc-2 and vpc-3 can access the
Internet through the public NAT gateway in vpc-2.
Choose NAT Gateway from the service list. Locate the public NAT gateway created in this
experiment and choose More > Delete in the Operation column.
Figure 2-60
Step 4 Delete the VPC peering connection.
In the service list, choose Virtual Private Cloud under Networking. On the network
console, choose VPC Peering, locate the VPC peering connection created in this
experiment and click Delete in the Operation column.
In the service list, choose Virtual Private Cloud under Networking. On the network
console, choose Access Control > Security Groups. In the security group list, locate the
security group created in this exercise and choose More > Delete in the Operation
column.
2.5 Quiz
Question: In the VPN connection configuration, how do I configure Local Subnet and
Remote Subnet?
Answer: Set Local Subnet to a VPC subnet that needs to access an on-premises network
through VPN. Set Remote Subnet to an on-premises subnet that needs to access a VPC
through VPN.
HCIP-Cloud Service Solutions Architect Lab Guide Page 81
3.1 Introduction
3.1.1 About This Exercise
In this exercise, you will establish an environment on Huawei Cloud to run video
streaming services. Initially, Huawei Cloud ECS, Elastic Volume Service (EVS), Scalable File
Service (SFS), and Object Storage Service (OBS) will be used to set up a video website.
Then, ELB will be used for distributing requests to different AZs for HA deployment.
This exercise uses region CN-Hong Kong as an example. You can use any region they
want.
3.1.2 Objectives
Acquire the operation principles and configuration methods of storage services.
Understand the service scenarios of cloud data management and configuration.
3.1.3 Networking
Figure 3-1
3.2 Procedure
3.2.1 Preparations
Step 1 Download video files.
Open a browser on the local PC, enter https://cloudservice-v3.obs.cn-east-
3.myhuaweicloud.com/video_en.zip in the address box, and press Enter to download
the exercise files.
Obtain the exercise files shown in the following figure:
huawei-cloud.jpg, index.html, nginx-1.15.9.tar.gz, SampleVideo_1280x720_5mb.mp4,
video.js, and more
Figure 3-2
Basic Information
Region: CN-Hong Kong
Name: vpc-video
IPv4 CIDR Block: 10.1.0.0/16
Default Subnet
Name: subnet-video
IPv4 CIDR Block: 10.1.10.0/24
HCIP-Cloud Service Solutions Architect Lab Guide Page 83
Figure 3-3
Figure 3-4
Step 2 View the security group rules. You can see that there is an inbound rule that allows
traffic on port 80.
Figure 3-5
Note: The file system created in this step will be mounted to the ECSs.
HCIP-Cloud Service Solutions Architect Lab Guide Page 85
Figure 3-6
Step 2 Configure the parameters as follows, confirm the configuration, and click Create
Now.
Billing Mode: Pay-per-use
Region: CN-Hong Kong
AZ: AZ1
Storage Class: Standard
Capacity (GB): 500
Protocol Type: NFS
Figure 3-7
VPC: vpc-video | subnet-video
Security Group: sg-video
Name: sfs-video
Retain the default settings for other parameters.
HCIP-Cloud Service Solutions Architect Lab Guide Page 86
Figure 3-8
Step 3 View the created SFS file system.
Figure 3-9
Note: The video.zip file downloaded during preparations needs to be uploaded to the
bucket created in this step.
HCIP-Cloud Service Solutions Architect Lab Guide Page 87
Figure 3-10
Step 2 Configure the parameters as follows, confirm the configuration, and click Create
Now.
Region: CN-Hong Kong
Bucket Name: video-hcip
Default Storage Class: Standard
Bucket Policy: Public Read
Direct Reading: Disable
Figure 3-11
Step 3 Click the name of the created OBS bucket to go to the bucket management page.
Figure 3-12
Step 4 Choose Objects > Upload Object.
HCIP-Cloud Service Solutions Architect Lab Guide Page 88
Figure 3-13
Step 5 Click add file, find the video_en.zip file in the local directory, and click Upload.
Figure 3-14
Step 6 In the object list, view the uploaded file.
HCIP-Cloud Service Solutions Architect Lab Guide Page 89
Figure 3-15
Note: This ECS will be used to deploy the video streaming service.
Billing Mode: Pay-per-use
Region: CN-Hong Kong
AZ: Random
Specifications: 2 vCPUs | 4 GiB
Image: Public image | CentOS 7.6 64 bit(40 GB)
Host Security: Basic (free)
System Disk: High I/O | 40 GiB
Network: vpc-video | subnet-video | Automatically assign IP address
Security Group: sg-video
EIP: Auto assign
EIP Type: Premium BGP
Billed By: Traffic
Bandwidth Size: 10 Mbit/s
ECS Name: ecs-video
Password: User-defined (with the username of root)
HCIP-Cloud Service Solutions Architect Lab Guide Page 90
HCIP-Cloud Service Solutions Architect Lab Guide Page 91
Figure 3-16
Figure 3-17
Step 2 Run the following commands to create the video folder and install the NFS client:
Figure 3-18
If Complete is displayed, the NFS client has been installed:
Figure 3-19
Step 3 Go back to the Huawei Cloud console, choose Scalable File Service > SFS Turbo, and
click the name of the created SFS file system to go to the details page.
Figure 3-20
Step 5 Log in to esc-video and run the following command to mount the SFS file system:
Note: Replace the "mount -t nfs -o vers=3,nolock 10.1.10.25:/" part in the preceding
command with what you have taken note of in the last step.
Figure 3-21
Step 6 Run the following command to verify the mounting:
If the following information is displayed, the file system has been mounted.
Figure 3-22
Step 7 Run the following command to configure automatic mounting at system start:
Note: The IP address in the command varies with the file system. Use the actual IP
address of the file system.
HCIP-Cloud Service Solutions Architect Lab Guide Page 94
Figure 3-23
Step 8 Run the following commands to verify automatic mounting:
Figure 3-24
Figure 3-25
Step 2 On the Objects page, click the name of video.zip in the object list.
HCIP-Cloud Service Solutions Architect Lab Guide Page 95
Figure 3-26
Step 3 View and take note of the object link.
Figure 3-27
Step 4 Log in to esc-video and run the following commands to download the object file:
Note: The object link in the command varies with the object. Use the one you have taken
note of in the last step.
HCIP-Cloud Service Solutions Architect Lab Guide Page 96
Figure 3-28
Note: This disk will be attached to ecs-video, and Nginx will be installed on this disk.
Figure 3-29
Step 2 Configure the parameters as follows, confirm the configuration, and click Next.
Billing Mode: Pay-per-use
Region: CN-Hong Kong
AZ: AZ2
Disk Type: Ultra-high I/O
Disk Size: 10 GB
Automatic Backup: Do not use
Disk Name: volume-video
HCIP-Cloud Service Solutions Architect Lab Guide Page 97
Figure 3-30
Step 3 In the EVS disk list, view the created ecs-video disk and click Attach.
HCIP-Cloud Service Solutions Architect Lab Guide Page 98
Figure 3-31
Step 4 In the displayed dialog box, select ECSs, select ecs-video, and click OK.
Figure 3-32
Step 5 Log in to ecs-video and run the following command to view the disk information:
Figure 3-33
Step 6 Run the following command to create a file system for the disk: (Use the device
name you have obtained in the last step.
Figure 3-34
Step 7 Run the following commands to mount the disk on /opt and check whether the
mounting is successful:
Figure 3-35
Step 8 Run the following command to configure automatic mounting at system start:
Figure 3-36
Step 9 Run the following commands to verify automatic mounting:
Figure 3-37
cd /video
yum install -y unzip
unzip -o video_en.zip
cd video
cp nginx-1.15.9.tar.gz /opt/
cd /opt
yum install -y pcre*
yum install -y zlib*
tar -xvf nginx-1.15.9.tar.gz
cd nginx-1.15.9
./configure --prefix=/opt/nginx
make && make install
Figure 3-38
Step 3 # Run the following commands to start Nginx:
Figure 3-39
Step 4 Run the following commands to configure automatic startup:
Figure 3-40
Step 5 Use a browser on the local PC to log in to ecs-video using the public IP address and
verify that the video can be played. If the following figure shows up, the video can
be played, indicating that the video streaming service has been set up.
Figure 3-41
3.2.11 Configuring HA
Step 1 In the CN-Hong Kong region, choose Storage > Cloud Backup and Recovery > Cloud
Backup Backups and click Buy Server Backup Vault in the upper right corner.
Configure the parameters as follows to create a server backup vault.
Note: A full-ECS image will be created in this exercise, so a cloud server backup vault
needs to be purchased in the first place.
Billing Mode: Pay-per-use
Region: CN-Hong Kong
Protection Type: Backup
Associated Server: Skip
Vault Capacity: 100 GB
Auto Backup: Skip
Retain the default settings for other parameters.
HCIP-Cloud Service Solutions Architect Lab Guide Page 102
Figure 3-42
Step 2 View the server backup vault you have created.
Figure 3-43
Step 3 In the CN-Hong Kong region, choose Image Management Service and click Create
Image in the upper right corner.
Note: An ECS will be provisioned using the full-ECS image. The new ECS and ecs-video
will then be used as the ELB backend servers.
Figure 3-44
Step 4 Configure the parameters as follows, confirm the configuration, and click Next.
Region: CN-Hong Kong
Type: Full-ECS image
Source: ECS | ecs-video
HCIP-Cloud Service Solutions Architect Lab Guide Page 103
Figure 3-45
Step 5 Click Apply for Server to create ecs-video2 in AZ1 using the created image. (ecs-
video resides in AZ2.)
Note: To ensure HA, ecs-video and ecs-video2 are deployed in different AZs. You can
select the AZs based on site requirements.
Figure 3-46
Step 6 Configure the parameters as follows:
Billing Mode: Pay-per-use
Region: CN-Hong Kong
AZ: AZ1
Specifications: 2 vCPUs | 4 GiB
Image: Private image | ecs-video
System Disk: High I/O | 40 GiB
Data Disk: Extreme SSD | 10 GB
Network: vpc-video | subnet-video
HCIP-Cloud Service Solutions Architect Lab Guide Page 104
Figure 3-47
Step 7 In the ECS list, locate the created esc-video2 and click Remote Login to log in to the
ECS using CloudShell.
Figure 3-48
Step 8 Run the following command to check the service status:
If the following information is displayed, the Nginx service has been enabled.
HCIP-Cloud Service Solutions Architect Lab Guide Page 106
Figure 3-49
Step 9 In the service list, choose Elastic IP. In the EIP list, locate the EIP bound to ecs-video
and click Unbind to unbind the EIP from ecs-video.
Figure 3-50
Step 10 In the CN-Hong Kong region, choose Elastic Load Balance and click Buy Elastic Load
Balancer in the upper right corner.
Figure 3-51
Step 11 Configure the parameters as follows:
Type: Shared
Region: CN-Hong Kong
Network Type: Public network
VPC: vpc-video
Subnet: subnet-video
Private IP Address: Automatically-assigned IP address
EIP: Use existing | 114.115.155.72 (select the EIP unbound from the ECS in step 9).
Name: elb-video
HCIP-Cloud Service Solutions Architect Lab Guide Page 107
Figure 3-52
Step 12 View the purchased load balancer and click Add listener.
Figure 3-53
Step 13 Configure the parameters as follows to create a listener:
Name: listener-video (can be customized)
Frontend Protocol: TCP
Frontend Port: 80 (Used by this load balancer to receive requests from clients.)
Retain the default settings for other parameters.
HCIP-Cloud Service Solutions Architect Lab Guide Page 108
Figure 3-54
Step 14 Configure a backend routing policy:
Name: server-group-video (can be customized)
Backend Protocol: TCP
Load Balancing Algorithm: Weighted round robin
Retain the default settings for other parameters.
Figure 3-55
Step 15 Click Add. On the displayed page, select the two video servers and click Next.
HCIP-Cloud Service Solutions Architect Lab Guide Page 109
Figure 3-56
Step 16 Set Batch Add Ports to 80. (This port is used by backend servers to provide network
services.)
HCIP-Cloud Service Solutions Architect Lab Guide Page 110
Figure 3-57
Step 17 Confirm the configuration and click Submit.
Step 18 View the created load balancer and take note of the EIP for future use.
Figure 3-58
Figure 3-59
Figure 3-60
On the Listeners tab, delete the listener purchased in this exercise.
Figure 3-61
Back to the load balancer list and click Delete in the Operation column to delete the
load balancer.
In the displayed dialog box, select Release the EIP and click Yes.
HCIP-Cloud Service Solutions Architect Lab Guide Page 112
Figure 3-62
Step 2 Delete the ECSs.
In the service list, choose Elastic Cloud Server. In the ECS list, locate the ECS
purchased in this exercise and choose More > Delete in the Operation column.
In the displayed dialog box, select the check boxes displayed in the following picture
and click Yes.
Figure 3-63
Step 3 Delete the SFS file system.
In the service list, choose Scalable File Service. In the file system list, locate the file
system purchased in this exercise and choose More > Delete in the Operation column.
In the service list, choose Object Storage Service. In the bucket list, locate the bucket
purchased in this exercise and click Delete in the Operation column.
In the service list, choose Virtual Private Cloud. On the network console, choose Access
Control > Security Groups. In the security group list, locate the security group created in
this exercise and click Delete in the Operation column.
3.5 Quiz
Question: In this exercise, when HA is configured, a full-ECS image is used to provision an
ECS. Why a system disk image is not used instead?
Answer: In this exercise, an EVS disk was attached to ecs-video. So a full-ECS image is
required to create the image, in which the OS data, application data, and service data are
all included.
HCIP-Cloud Service Solutions Architect Lab Guide Page 114
4.1 Introduction
4.1.1 About This Exercise
This exercise describes how to set up a WordPress website using an ECS and RDS for
MySQL instance on Huawei Cloud and how to deploy a DCS instance to speed up access
to the WordPress website.
This exercise uses region CN-Hong Kong as an example. Trainees can select regions
based on their own needs.
4.1.2 Objectives
Understand how to use the cloud services involved in the cloud database architecture.
Understand how to manage cloud databases and keep them available.
4.1.3 Networking
Figure 4-1
4.2 Procedure
4.2.1 Creating a Security Group
Step 1 Log in to the Huawei Cloud console and select region CN-Hong Kong. Then choose
Networking > Virtual Private Cloud. On the network console, choose Access
Control > Security Groups, click Create Security Group, and configure parameters as
follows to create security group sg-rds.
Note: This security group is for a RDS database instance, so port 3306 has to be enabled.
Name: sg-rds
Template: Custom
Figure 4-2
Step 2 Add an inbound rule to allow access to database port 3306.
Priority: 1
Action: Allow
Protocol & Port: TCP and 3306
Type: IPv4
Source: IP address and 0.0.0.0/0
HCIP-Cloud Service Solutions Architect Lab Guide Page 116
Figure 4-3
Step 3 Create security group sg-wordpress.
Note: This security group is for the ECSs used to set up WordPress. A general-purpose
web server template is required.
Name: sg-wordpress
Template: General-purpose web server
Figure 4-4
Figure 4-5
Step 2 Configure the required parameters to create VPC vpc-2.
Basic Information
Region: CN-Hong Kong
Name: vpc-2
IPv4 CIDR Block: 192.168.0.0/16
Default Subnet
AZ: AZ1 (This exercise uses AZ1 as an example. Trainees can select AZs based on
their needs. This note is valid for all similar resources and will not be described
later.)
Name: vpc-2-subnet
IPv4 CIDR Block: 192.168.2.0/24
Figure 4-6
Figure 4-7
Step 2 Click Buy DB Instance in the upper right corner.
Figure 4-8
Step 3 Configure the following parameters and click Next.
Billing Mode: Pay-per-use
Region: CN-Hong Kong
DB Instance Name: rds-wordpress
DB Engine: RDS for MySQL
DB Engine Version: MySQL 8.0
DB Instance Primary/Standby
AZ: AZ1
Time Zone: (UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi
Instance Class: Dedicated Edition | 4 vCPUs | 16 GB
VPC: vpc-2 | vpc-2-subnet | Automatically-assigned IP
Security Group: sg-rds
Administrator Password: User-defined
Parameter Template: Default-MySQL-8.0
Quantity: 1
HCIP-Cloud Service Solutions Architect Lab Guide Page 119
HCIP-Cloud Service Solutions Architect Lab Guide Page 120
Figure 4-9
Step 4 Confirm configurations, click Submit, and wait for 5 to 10 minutes until the instance
is created.
Figure 4-10
Step 2 In the displayed window, enter the instance login username and password and click
Test Connection. After a successful connection message is displayed, click Log In.
HCIP-Cloud Service Solutions Architect Lab Guide Page 121
Figure 4-11
Step 3 On the home page, click Create Database. The created database will be used to
interconnect with WordPress.
Figure 4-12
Step 4 In the displayed dialog box, enter a database name and specify a character set as
follows and click OK.
Name: wordpress
Character Set: utf8 (default setting)
HCIP-Cloud Service Solutions Architect Lab Guide Page 122
Figure 4-13
Figure 4-14
Step 2 Configure parameters as follows to create an ECS:
Billing Mode: Pay-per-use
Region: CN-Hong Kong
AZ: AZ1
Specifications: 2 vCPUs | 4 GiB
HCIP-Cloud Service Solutions Architect Lab Guide Page 123
Figure 4-15
Step 3 In the ECS list, locate the created ECS and click Remote Login to log in to ECS esc-
wordpress using Remote Login.
Figure 4-16
Step 4 Run the following command to install Apache:
Figure 4-17
Step 5 Run the following command to install PHP:
Figure 4-18
Step 6 Enter y twice for confirmation.
Figure 4-19
Step 7 Run the following commands to download the WordPress installation package,
decompress the package, and copy the obtained files to Apache directory
/var/www/html:
Figure 4-20
Step 8 Run the following commands to switch to the httpd working directory and copy the
configuration file:
Figure 4-21
Step 9 Run the following command to configure database parameters in the wp-
config.php file to interconnect with the wordpress database:
Figure 4-22
Step 10 Run the following commands to configure permissions for the WordPress directory:
Figure 4-23
Step 11 Run the following commands to enable Apache. If information similar to the
following is displayed, Apache is running normally:
Figure 4-24
Step 12 Open a browser on your local PC and enter EIP of ECS-WordPress/wordpress, for
example, enter 121.36.79.241/wordpress/index.php. After you log in to WordPress,
configure parameters as follows and click Install WordPress:
Site Title: HCIP
Username: huawei (user-defined)
Password: User-defined
Your Email: User-defined
HCIP-Cloud Service Solutions Architect Lab Guide Page 129
Figure 4-25
Step 13 Click Log in.
Figure 4-26
Step 14 Enter the username and password configured in the previous step to log in to
WordPress. If the following page is displayed, WordPress is set up:
HCIP-Cloud Service Solutions Architect Lab Guide Page 130
Figure 4-27
Step 15 In the navigation pane on the left, choose Plugins and then click Add New.
Figure 4-28
Step 16 Enter redis in the search box on the right, locate Redis Object Cache, and click
Install Now.
HCIP-Cloud Service Solutions Architect Lab Guide Page 131
Figure 4-29
Note: This exercise uses the DCS instance to provide Redis services for WordPress.
Billing Mode: Pay-per-use
Region: CN-Hong Kong
Project: CN-Hong Kong (default)
Cache Engine: Redis
Version: 5.0
Instance Type: Single-node
Replicas: 2
AZ: AZ1
Instance Specifications: redis.single.xu1.large.2
VPC: vpc-2
Subnet: vpc-2-subnet
Administrator Password: user-defined
Quantity: 1
Name: redis-wordpress
HCIP-Cloud Service Solutions Architect Lab Guide Page 132
Figure 4-30
Step 2 In the instance list, locate the instance that you bought and click its name.
Figure 4-31
Step 3 On the Connection page, view and write down the administrator, IP address, port
number.
HCIP-Cloud Service Solutions Architect Lab Guide Page 133
Figure 4-32
Step 4 Log in to ECS ecs-wordpress and run the following commands to modify its
configuration file:
Add the following information to the file to interconnect with the DCS instance:
/*redis config*/
define('WP_REDIS_HOST', '192.168.2.IP');
define('WP_REDIS_PORT', '6379');
define('WP_REDIS_PASSWORD', 'DCS PASSWORD');
Note: 192.168.2.IP is the IP address of the DCS instance recorded in step 3. Configure the
IP address based on service requirements. DCS PASSWORD is the password of the DCS
instance set in step 1. Enter the required password.
Figure 4-33
Step 5 Run the following command to exit:
:wq
HCIP-Cloud Service Solutions Architect Lab Guide Page 134
Figure 4-34
Step 2 Log in to WordPress on your local PC, choose Plugins > Installed Plugins, locate
Redis Object Cache, and click Activate.
HCIP-Cloud Service Solutions Architect Lab Guide Page 135
Figure 4-35
Step 3 On the displayed page, click the Overview tab and click Enable Object Cache.
Figure 4-36
Step 4 Check whether the status is Connected. If yes, Redis Object Cache is enabled.
Figure 4-37
Figure 4-38
Choose Service List > DCS. In the instance list, locate the DB instance that you bought in
this exercise and click Delete in the Operation column.
Choose Service List > RDS. In the instance list, locate the DB instance that you bought in
this exercise and click Delete in the Operation column.
Choose Service List > Virtual Private Cloud > Access Control > Security Groups. In the
security group list, locate the security group that you created in this exercise and click
Delete in the Operation column.
4.5 Quiz
Question: What Service Can I Use If I Want to Improve Database Storage and
Performance by Configuring Multiple Database Instances?
Answer: You can use Huawei Cloud Distributed Database Middleware (DDM). It can scale
out your compute and storage resources linearly, helping you handle high concurrency
and real-time interactions
HCIP-Cloud Service Solutions Architect Lab Guide Page 138
5.1 Introduction
5.1.1 About This Exercise
This exercise involves the following operations:
Damn Vulnerable Web Application (DVWA) server deployment: Deploy a DVWA
server on ECS to provide an exercise environment, and perform subsequent security
operations on the server.
Host Security Service (HSS): Purchase HSS for the DVWA server. Obtain server status
and check server risks on the HSS console. Improve server security management
capabilities.
Two-factor authentication: Configure two-factor authentication for the DVWA server,
and log in to the server through two-factor authentication. Learn the basic functions
of two-factor authentication.
Host security group: Verify the access control function of the host security group by
deleting and adding port 8080 to the security group.
IP address group: Verify how to configure the address group and security group and
learn how they work. Add a test cloud server address to an address group, and add
the address group to the deny rule of a security group.
Data Encryption Workshop (DEW): In this exercise, create a key on the DEW console,
create an agency on the IAM page, and install the KooCLI client on the ECS. With
these configurations, the KooCLI client can obtain information about the keys
managed in DEW.
5.1.2 Objectives
To understand how HSS works.
To learn how to configure and use two-factor authentication, security groups, and
address groups.
To learn how to configure and use Web Application Firewall (WAF).
To learn how to use ECS to obtain the keys managed in DEW.
HCIP-Cloud Service Solutions Architect Lab Guide Page 139
5.1.3 Networking
Figure 5-1
5.2 Procedure
5.2.1 Deploying DVWA
Step 1 In the CN-Hong Kong region, choose Networking > Virtual Private Cloud in the
service list.
Figure 5-2
Step 2 Click Create VPC in the upper right corner. (Resources in this exercise will be
created in this VPC.)
Figure 5-3
Step 3 Configure the following parameters and click Create Now.
Basic Information
Region: CN-Hong Kong
Name: vpc-1
IPv4 CIDR Block: 192.168.0.0/16
Default Subnet
AZ: AZ1
Name: subnet-20
IPv4 CIDR Block: 192.168.20.0/24
HCIP-Cloud Service Solutions Architect Lab Guide Page 141
Figure 5-4
Step 4 In the navigation pane on the left, choose Access Control > Security Groups, and
click Create Security Group in the upper right corner.
Note: This security group is used by DVWA ECSs and should allow all ICMP traffic and
traffic on ports 22, 443, 80, and 8080.
Figure 5-5
Step 5 Configure the parameters as follows and click OK.
Name: sg-dvwa
Template: Select a required one.
HCIP-Cloud Service Solutions Architect Lab Guide Page 142
Figure 5-6
Step 6 In the dialog box displayed, click Manage Rule.
Figure 5-7
Step 7 On the Inbound Rules tab, add the following inbound rules.
Priority: 1
Action: Allow
Protocol & Port: TCP | 22
Type: IPv4
Source: IP address | 0.0.0.0/0
HCIP-Cloud Service Solutions Architect Lab Guide Page 143
Figure 5-8
Priority: 1
Action: Allow
Protocol & Port: TCP | 8080
Type: IPv4
Source: IP address | 0.0.0.0/0
Figure 5-9
Priority: 1
Action: Allow
Protocol & Port: TCP | 443
Type: IPv4
Source: IP address | 0.0.0.0/0
HCIP-Cloud Service Solutions Architect Lab Guide Page 144
Figure 5-10
Priority: 1
Action: Allow
Protocol & Port: TCP | 80
Type: IPv4
Source: IP address | 0.0.0.0/0
Figure 5-11
Priority: 1
Action: Allow
Protocol & Port: ICMP | All
Type: IPv4
Source: IP address | 0.0.0.0/0
HCIP-Cloud Service Solutions Architect Lab Guide Page 145
Figure 5-12
Step 8 Check the added inbound rules. There are inbound rules that allow ICMP traffic and
traffic on ports 80, 22, 8080, and 443.
Figure 5-13
Step 9 In the service list, choose Elastic Cloud Server under Compute. On the displayed
page, click Buy ECS in the upper right corner.
Figure 5-14
Step 10 Configure settings for the ECS.
Figure 5-15
Step 11 Log in to the ECS and install Docker.
Figure 5-16
Step 12 Download the DVWA container image.
Figure 5-17
Step 13 View the current image.
Figure 5-18
Step 14 Run the image as a container and map the container service port 80 to port 8080.
Figure 5-19
Step 15 Open a local browser, enter http://182.160.6.0:8080 in the address bar to open the
DVWA web page and click Create/Reset Database. (182.160.6.0 is the EIP bound to
the ECS ecs-dvwa.)
Figure 5-20
Step 16 After the initialization is complete, the login page is displayed. Enter the username
and password for logging in to DVWA. If the following information is displayed, the
DVWA host is successfully deployed.
Figure 5-21
Step 17 Log in to the ECS and download XAMPP.
Figure 5-22
Modify permissions and install XAMPP.
Note: After running the command, perform operations as instructed in the following
figure to complete the installation.
HCIP-Cloud Service Solutions Architect Lab Guide Page 151
Figure 5-23
Step 18 In the local browser, enter http://182.160.6.0 in the address bar. If you can access
XAMPP, the installation is successful.
Note: In this exercise, 182.160.6.0 is the EIP bound to the ECS ecs-dvwa. Replace it with
the actual value.
Figure 5-24
Figure 5-25
Step 2 Click Buy HSS in the upper right corner.
Figure 5-26
Step 3 Configure HSS parameters, as shown in the following figure. Click Pay Now.
Billing mode: Pay-per-use
Region: Hong Kong
Edition: Enterprise
HCIP-Cloud Service Solutions Architect Lab Guide Page 153
Figure 5-27
Step 4 After you are directed to the server list, click Switch Edition.
Figure 5-28
Step 5 Configure edition parameters, as shown in the following figure. Read the disclaimer,
select I have read and agree to the Host Security Service Disclaimer, and click OK.
Note: The basic edition is free of charge and provides only part of HSS functions. It does
not provide protection capabilities or support for DJCP MLPS compliance.
The enterprise edition supports DJCP MLPS L2 compliance, virus and Trojan scan and
removal, one-click vulnerability fix, and intrusion detection.
Billing Mode: On-demand
Edition: Enterprise
HCIP-Cloud Service Solutions Architect Lab Guide Page 154
Figure 5-29
Step 6 Return to the Host Security Service home page. Click Dashboard to check the server
risk and protection statistics.
Figure 5-30
Step 7 Click the Asset Management > Servers & Quota tab, click the server’s name.
HCIP-Cloud Service Solutions Architect Lab Guide Page 155
Figure 5-31
Step 8 Click the Intrusions tab and check intrusions.
Note: The HSS the enterprise edition provides the intrusion detection function. It can
identify and block intrusions in real time, detect internal risks, and detect and remove
malicious programs.
You can log in to the ECS by tools like PUTTY but keep entering incorrect passwords to
simulate brute force attack.Then Haddle it by Add to Login Whitelist.
HCIP-Cloud Service Solutions Architect Lab Guide Page 156
Figure 5-32
Step 9 Click the Detection > Alarms to view blocked IP addresses and click cancel
interception.
Figure 5-33
Step 1 Create topics and add subscriptions on the Simple Message Notification (SMN)
console.
On the Service List page, select Simple Message Notification under Management &
Governance.
Figure 5-34
On the Dashboard page, click Topics under My Resources.
Figure 5-35
In the upper right corner, click Create Topic.
Figure 5-36
Set Topic Name to Auth and click OK.
HCIP-Cloud Service Solutions Architect Lab Guide Page 158
Figure 5-37
In the Operation column of the topic, click Add Subscription.
Figure 5-38
Configure the following parameters:
Protocol: SMS
Endpoint: personal mobile number (customized by trainees)
HCIP-Cloud Service Solutions Architect Lab Guide Page 159
Figure 5-39
Confirm the subscription on your mobile phone (SMS message) to make the
subscription take effect.
Figure 5-40
On the displayed page, in the navigation pane on the left, choose Installation &
Configuration. Choose the Two-Factor Authentication tab, locate the protected
server, and click Enable 2FA in the Operation column.
Figure 5-41
Select the newly created SMN topic Auth and click OK.
HCIP-Cloud Service Solutions Architect Lab Guide Page 160
Figure 5-42
Use PUTTY to Log in to the DVWA host.
Enter the username and password, enter the mobile number in the subscription, and
enter the received SMS verification code to log in to the host. If the login is successful,
the two-factor authentication configuration is successful. This section describes how to
verify the basic functions and usage of two-factor authentication.
Figure 5-43
Figure 5-44
Step 2 Click the Inbound Rules tab and delete the rule whose Protocol & Port is TCP: 8080.
Note: This rule is deleted to reject traffic on port 8080 and then we can verify the access
control function of the security group.
Figure 5-45
Step 3 In the displayed dialog box, click Yes.
Figure 5-46
Step 4 Check the inbound rule list. The rule that allows traffic on port 8080 does not exist.
HCIP-Cloud Service Solutions Architect Lab Guide Page 162
Figure 5-47
Step 5 Visit http://119.3.196.178 (EIP address of the DVWA ECS):8080. Refresh the page
and find that the login fails. This indicates that the security group sg-dvwa blocks
traffic on port 8080.
Figure 5-48
Step 6 Add an inbound rule to allow traffic on port 8080 again.
Figure 5-49
Step 7 Refresh the page. The login is successful. This indicates that the security group sg-
dvwa allows traffic on port 8080. The above operations exercise the basic functions
of security groups.
HCIP-Cloud Service Solutions Architect Lab Guide Page 163
Figure 5-50
Step 1 Create a test ECS in the VPC subnet created in "DVWA Deployment".
Note: This ECS is used only for connectivity test and verification and is not used for
application deployment.
Configure the ECS test as follows:
Billing Mode: Pay-per-use
Region: CN-Hong Kong
AZ: Random
CPU Architecture: x86
Specifications: 1 vCPUs | 2 GiB
Image: Public image | CentOS 7.6 64bit(40GB)
Host Security: Enable | Basic (free)
Network: vpc-1 | subnet-20 | Automatically assign IP address (Same network
configuration as ecs-dvwa)
Security Group: default (Select a security group different from that of ecs-dvwa.)
EIP: Not required
System Disk: High I/O | 40 GiB
ECS Name: test
Password: User-defined (with the username of root)
HCIP-Cloud Service Solutions Architect Lab Guide Page 164
HCIP-Cloud Service Solutions Architect Lab Guide Page 165
Figure 5-51
Step 2 Log in to the test ECS.
Figure 5-52
Step 3 Ping the DVWA ECS from the test ECS to verify the connectivity between them.
Note: Before configuring an IP address group, ensure that the two ECSs can communicate
with each other.
Figure 5-53
Step 4 Use the ifconfig command to query the IP address of the test ECS and make a note
of the IP address.
Figure 5-54
Step 5 On the Network Console, choose Access Control > IP Address Groups and click
Create IP Address Group in the upper right corner.
Note: This IP address group will be configured in the security group for traffic blocking
tests.
Figure 5-55
Step 6 Configure the parameters as follows and click OK.
Name: test
IP Address: Enter the private IP address of the test ECS.
HCIP-Cloud Service Solutions Architect Lab Guide Page 167
Figure 5-56
Step 7 In the security group list, locate the row that contains the security group sg-dvwa
and click Manage Rule in the Operation column.
Figure 5-57
Step 8 Click the Inbound Rules tab and then click Add Rule.
Priority: 1
Action: Deny
Protocol & Port: ICMP | All
Source: IP address group | test
Figure 5-58
Step 9 Log in to the test ECS again and check the connectivity between the test ECS and
the DVWA ECS. The communication fails. The security group with the IP address
group configured takes effect and blocks the corresponding traffic. This indicates
that IP address groups can work together with security groups.
Step 1 Click the username in the upper right corner and choose My Credentials.
HCIP-Cloud Service Solutions Architect Lab Guide Page 168
Figure 5-59
Step 2 On the Access Keys page, click Create Access Key.
Figure 5-60
Step 3 Enter a description as needed and click OK.
HCIP-Cloud Service Solutions Architect Lab Guide Page 169
Figure 5-61
Step 4 Wait until the creation is successful, and click Download.
Figure 5-62
Step 5 Properly save the AK/SK on your local PC for later use.
Figure 5-63
Step 1 In the service list, choose Data Encryption Workshop under Security & Compliance.
HCIP-Cloud Service Solutions Architect Lab Guide Page 170
Figure 5-64
Step 2 On the Cloud Secret Management Service page, click Create Secret.
Figure 5-65
Step 3 Configure secret parameters, as shown in the following figure.
Secret Name: test
Secret Value: Set a value as needed. Example: HCIP@123
Retain the default settings for other parameters.
Figure 5-66
Step 4 Click the secret name to view details. The current version is v1.
HCIP-Cloud Service Solutions Architect Lab Guide Page 171
Figure 5-67
Step 1 In the upper right corner of the page, hover the mouse over the username and
select Identity and Access Management.
Figure 5-68
Step 2 Choose Agencies in the navigation pane on the left and click Create Agency.
HCIP-Cloud Service Solutions Architect Lab Guide Page 172
Figure 5-69
Step 3 Configure the agency and click Next.
Agency Name: ECS-password
Agency Type: Cloud service
Cloud Service: Elastic Cloud Server (ECS) and Bare Metal Server (BMS)
Validity Period: Unlimited
Figure 5-70
Step 4 Select CSMS FullAccess and KMS CMKFullAccess.
HCIP-Cloud Service Solutions Architect Lab Guide Page 173
Figure 5-71
Step 5 Retain the default authorization scope and click OK.
Figure 5-72
Step 6 After the agency is created, view the assigned permissions on the Permissions page.
Figure 5-73
Note: This ECS is used only for installing KooCLI and obtaining keys.
Configure the ECS ecs-test as follows:
Billing Mode: Pay-per-use
Region: CN-Hong Kong
AZ: Random
CPU Architecture: x86
Specifications: 1 vCPUs | 2 GiB
Image: Public image | CentOS 7.6 64bit(40GB)
Host Security: Enable (Basic)
Network: vpc-1 | subnet-20 | Automatically assign IP address
Security Group: default
EIP: Auto assign
EIP Type: Premium BGP
HCIP-Cloud Service Solutions Architect Lab Guide Page 174
Figure 5-74
If your current environment language is Chinese. To switch the language, run the hcloud
configure set --cli-lang=en command.
Step 2 View information about the key created in DEW. As shown in the following figure,
key HCIP@123 has been obtained, indicating that ECS can obtain the DEW-
managed key through the KooCLI client.
Figure 5-75
Figure 5-76
Choose Agencies in the left navigation pane. Locate the row containing the agency
created in this exercise click Delete in the Operation column.
Figure 5-77
Step 4 Delete two-factor authentication.
On the Service List page, select Host Security Service under Security & Compliance.
Choose Installation & Configuration, click the Two-Factor Authentication tab, and click
Delete in the Operation column of a record.
In the service list, choose Simple Message Notification. In the navigation pane on the left,
choose Topic Management > Topics. In the right pane, locate the topic created in this
exercise, choose More > Delete in the Operation column, and click OK.
In the service list, choose Virtual Private Cloud under Networking. On the network
console, choose Access Control > IP Address Groups. In the IP address group list, locate
the IP address group created in this exercise and click Delete in the Operation column.
In the service list, choose Virtual Private Cloud under Networking. On the network
console, choose Access Control > Security Groups. In the security group list, locate the
security group created in this exercise and click Delete in the Operation column.
5.4 Quiz
Question: Besides real-time intrusion detection, what functions does the HSS enterprise
edition provide?
Answer: Virus and Trojan detection and removal, baseline check, one-click vulnerability
fix, and security configuration
HCIP-Cloud Service Solutions Architect Lab Guide Page 178
6.1 Introduction
6.1.1 About This Exercise
This exercise consists of two parts:
1. Deploy Docker engine and containers on ECSs to provide web services. Use
Dockerfiles to build and push images to SoftWare Repository for Container (SWR).
To test whether the pushed image is available, use Cloud Container Engine (CCE) to
pull and deploy the image. Use a local browser to access the EIP of the CCE node to
check whether the web page is normal.
2. Use FunctionGraph to update object versions in an OBS bucket and retain only the
latest three versions.
This exercise uses the Hong Kong or Singapore region as an example.
6.1.2 Objectives
Understand how to use and configure Docker engine.
Understand how to use and configure SoftWare Repository for Container (SWR).
Understand how to use and configure Cloud Container Engine (CCE).
Understand how to use and configure FunctionGraph.
6.1.3 Networking
HCIP-Cloud Service Solutions Architect Lab Guide Page 179
6.2 Procedure
6.2.1 Deploying Containers & CCE
6.2.1.1 Creating a VPC
Step 1 On the upper area of the console, select CN-Hong Kong.
Step 2 In the service list, choose Networking > Virtual Private Cloud.
Step 3 Click Create VPC in the upper right corner. (Subsequent resources will be created in
the VPC.)
Figure 6-2
Step 4 Configure the following parameters and click Create Now.
Region: CN-Hong Kong
Name: vpc-1
IPv4 CIDR Block: 192.168.0.0/16
Default Subnet
Name: vpc-1-subnet
IPv4 CIDR Block: 192.168.1.0/24
Note: This security group is used by the ECS where the Docker engine will be deployed.
Name: sg-docker
General-purpose web server
HCIP-Cloud Service Solutions Architect Lab Guide Page 180
Figure 6-3
Figure 6-4
Figure 6-5
Step 2 Run the following command to install the yum unit:
Figure 6-6
Step 3 Run the following command to add the yum source:
Figure 6-7
Step 4 Run the following command to install Docker:
Figure 6-8
Step 5 Enter y twice.
Figure 6-9
Step 6 If Complete! is displayed, the installation is complete.
HCIP-Cloud Service Solutions Architect Lab Guide Page 184
Figure 6-10
Step 7 Run the following command to start Docker:
Figure 6-11
Step 8 Run the following command to check whether the Docker engine works properly: If
Hello from Docker is displayed, the Docker engine is working properly.
Figure 6-12
Figure 6-13
Step 2 Run the following command to view the local image:
Figure 6-14
Figure 6-15
Step 2 Run the following command to run the image as a container in the background and
map port 80 of the container to port 80 of the host:
Figure 6-16
Step 3 Log in to the public network address of ecs-docker.
Figure 6-17
Figure 6-18
Step 2 Run cat to view the index.html file in the htdocs directory. It works is displayed on
the web page. Record file directory: /usr/local/apache2/htdocs.
root@511b4079be09:/usr/local/apache2# cd htdocs/
root@511b4079be09:/usr/local/apache2/htdocs# cat index.html
HCIP-Cloud Service Solutions Architect Lab Guide Page 187
Figure 6-19
Step 3 Run exit to exit the container and run the following commands to create an HTML
file in the new path:
Figure 6-20
Step 4 Run the following commands to create and edit the HTML file and write HCIP-
Cloud Service to the file:
Figure 6-21
Step 5 Run the following commands to create and edit the Dockerfile:
Figure 6-22
Step 6 Run the following commands to build a new image httpd2 using the Dockerfile:
Figure 6-23
Step 7 Run the following commands to stop the httpd container:
[root@ecs-docker ~]# docker ps -a # View the container list and find the ID of the
httpd container.
[root@ecs-docker ~]# docker stop e1 # Stop the httpd container. e1 is the ID of the
httpd container.
Figure 6-24
Step 8 Run the following command to run the image as a container:
Step 9 Log in to the public network address of ecs-docker again and view the content. If
the following information is displayed, the Dockerfile image is successfully built.
HCIP-Cloud Service Solutions Architect Lab Guide Page 189
Figure 6-25
Figure 6-26
Step 2 Enter the organization name hcip (which is user-defined) and click OK.
HCIP-Cloud Service Solutions Architect Lab Guide Page 190
Figure 6-27
Step 3 Click Generate Login Command in the upper right corner to obtain the command.
Figure 6-28
Step 4 Copy the login command.
Figure 6-29
Step 5 Use Huawei Cloud CloudShell to log in to ecs-docker and run the recorded login
command.
Figure 6-30
Step 6 After the login is successful, run the following command on the node to view the ID
of the httpd2:v1 container:
Figure 6-31
Step 7 Pack the httpd2:v1 container into an image and change the image tag.
Figure 6-32
Step 8 Run the following command to push the image to SWR:
Figure 6-33
Step 9 Log in to SWR and view the image. If the following information is displayed, the
image is successfully pushed. Click the image name to view image details.
HCIP-Cloud Service Solutions Architect Lab Guide Page 192
Figure 6-34
Step 10 On the details page, the current image tag is v1.
Figure 6-35
Note: You need to use this cluster to pull the image and use it to deploy the container.
HCIP-Cloud Service Solutions Architect Lab Guide Page 193
Figure 6-36
Step 3 Set CCE cluster parameters as follows:
CCE cluster:
Billing Mode: Pay-per-use
Cluster Name: cluster-hcip (user-defined)
Version: v1.19
Management Scale: 50 nodes
Number of master nodes: 1
Network Model: VPC network
VPC: vpc-1
Subnet: vpc-1-subnet
Container Network Segment: 10.10.0.0/16
Service Network Segment: Default
HCIP-Cloud Service Solutions Architect Lab Guide Page 194
Figure 6-37
Step 4 After the preceding configurations are complete, click Next: Create Node.
Create Node: create now
Billing Mode: Pay-per-use
Current Region: ap-southeast-1
AZ: default
Node Type: VM node
Node Name: default
Specifications: 4 cores | 8 GB
OS: EulerOS 2.5
HCIP-Cloud Service Solutions Architect Lab Guide Page 195
Figure 6-38
Step 5 After the preceding configuration is complete, click Next: Install Add-on. Retain the
default settings for the add-on.
Step 6 After the preceding configuration is complete, click Next. Click Next: Confirm.
HCIP-Cloud Service Solutions Architect Lab Guide Page 197
Step 7 On the Resource Management page, select Clusters to view the created CCE cluster.
If the cluster status is Available, the cluster has been created.
Figure 6-39
Step 8 Click Nodes on the left to check the status of the new node.
HCIP-Cloud Service Solutions Architect Lab Guide Page 198
Figure 6-40
Step 9 Choose Workloads > Deployments on the left, click Create Deployment in the upper
right corner, and set the following parameters to create a workload.
Workload Name: hcip-httpd (user-defined)
Namespace: default
Set Instances to 1.
Select Container Image: My Images | hcip-cloud service
Image Version:v1
Container Name: container-httpd (user-defined)
HCIP-Cloud Service Solutions Architect Lab Guide Page 199
Figure 6-41
Step 10 After the workload is created, click Next: Set Application Access. Skip the service
configuration.
Figure 6-42
Step 11 Retain the default settings and click Create.
HCIP-Cloud Service Solutions Architect Lab Guide Page 200
Figure 6-43
Step 12 Return to the ECS page, purchase an EIP for the node in the CCE cluster, and bind
the EIP to the node. For details, see Compute Service Planning or Network Service
Planning.
Note: You need to use this EIP to implement external network access for the newly
deployed workload.
Billing Mode: Pay-per-use
Billed By: Traffic
Bandwidth Size: 10 Mbit/s
Quantity: 1
Figure 6-44
Step 13 Return to the CCE Clusters page, choose Workloads > Deployments. Click the target
workload, for example, hcip-httpd. Select Services, and click Create Service. Set
Access Type to NodePort, Container Port to 80, and Access Port to 30080. (Port
30080 is used as an example. You can select a port based on the site requirements.)
After the configuration is complete, click Create. The Resource Management >
Network page is displayed. Use a browser to access the EIP.
Service Name: hcip-httpd
HCIP-Cloud Service Solutions Architect Lab Guide Page 201
Figure 6-45
Step 14 Log in to the IP address through http://EIP:30080. (http://49.0.231.46:30080 in this
experiment). If the following information is displayed, the image pushed to SWR is
successfully deployed on CCE.
Figure 6-46
6.2.2 FunctionGraph
FunctionGraph hosts and computes event-driven functions in a serverless context while
ensuring high availability, high scalability, and zero maintenance. All you need to do is
write your code and set conditions.
HCIP-Cloud Service Solutions Architect Lab Guide Page 202
In actual service scenarios, there are too many unnecessary historical object versions
stored in OBS, involving manual deletion and complex maintenance. In this case, you can
retain the latest three versions in the bucket by using FunctionGraph.
Figure 6-47
Step 2 Click Create Bucket in the upper right corner.
Figure 6-48
Step 3 Create an OBS bucket:
Region: AP - Singapore (user-defined)
Bucket Name: obs-flash
Retain the default settings for other parameters.
HCIP-Cloud Service Solutions Architect Lab Guide Page 203
Figure 6-49
Figure 6-50
Step 2 In the navigation pane on the left, choose Agencies and then click Create Agency in
the upper right corner.
Figure 6-51
Step 3 Configure the agency name and type, and cloud service as follows:
Agency Name: fgh-commission
Agency Type: Cloud service
Cloud Service: Select FunctionGraph.
Validity Period: Unlimited
Figure 6-52
Select OBS Administrator and LTS FullAccess, as shown in the following figure.
Note: FunctionGraph needs to call OBS and LTS.
HCIP-Cloud Service Solutions Architect Lab Guide Page 205
Figure 6-53
Retain the default values for other parameters and click OK.
Figure 6-54
Step 4 If you can view the agency in the agency list, as shown in the following figure, the
agency is created successfully.
Figure 6-55
Figure 6-56
Step 2 On the FunctionGraph console, click Create Function in the upper right corner.
HCIP-Cloud Service Solutions Architect Lab Guide Page 206
Figure 6-57
Step 3 Create a function as follows:
Function Type: Event Function
Region: AP-Singapore
Function Name: obs-flash
Agency: fgh-commission
Runtime: Python 3.9
Figure 6-58
Figure 6-59
Step 2 In the navigation pane, choose Topic Management > Topics. Then, click Create
Topic in the upper right corner.
Note: In subsequent exercises, you need to use this SMN topic to trigger FunctionGraph.
Figure 6-60
Step 3 Set Topic Name to obs-flash and click OK.
Figure 6-61
Step 4 Click Add Subscription corresponding to obs-flash and add a subscription as follows:
HCIP-Cloud Service Solutions Architect Lab Guide Page 208
Figure 6-62
Select FunctionGraph (function) for Protocol and obs-flash for Endpoint.
Note: Select the created FunctionGraph function as the endpoint. When SMN is triggered,
FunctionGraph will be notified.
HCIP-Cloud Service Solutions Architect Lab Guide Page 209
Figure 6-63
After the preceding configuration is complete (the version does not need to be
selected), click OK.
Figure 6-64
Step 5 Locate the obs-flash topic, click More in the Operation column, and select Configure
Topic Policy.
Figure 6-65
Select OBS for Services that can publish messages to this topic and click OK.
HCIP-Cloud Service Solutions Architect Lab Guide Page 210
Figure 6-66
Figure 6-67
Step 2 On the function page, click the Code tab.
HCIP-Cloud Service Solutions Architect Lab Guide Page 211
Figure 6-68
Step 3 Copy the content in the code file downloaded in 6.2.2.1 to the index.py file
(overwrite the original content).
Figure 6-69
Step 4 Click Deploy.
HCIP-Cloud Service Solutions Architect Lab Guide Page 212
Figure 6-70
Figure 6-71
Step 3 On the navigation pane on the left, choose Basic Configurations > Event
Notification and click Create on the right.
Figure 6-72
Step 4 Create an event notification as follows:
Note: When an object is created in the bucket, this event notification will trigger an SMN
message and be forwarded to FunctionGraph.
Name: event-xxx(user-defined)
Events: ObjectCreated
HCIP-Cloud Service Solutions Architect Lab Guide Page 213
Figure 6-73
Step 5 On the navigation pane on the left, choose Overview > Objects. Click Edit next to
Versioning.
Note: You need to upload multiple versions of an object to test the execution of a
function.
Figure 6-74
Step 6 In the displayed dialog box, select Enable and click OK.
HCIP-Cloud Service Solutions Architect Lab Guide Page 214
Figure 6-75
Figure 6-76
Step 2 Click add file.
HCIP-Cloud Service Solutions Architect Lab Guide Page 215
Figure 6-77
Step 3 Select a small test file from the local PC and click Upload.
Figure 6-78
Step 4 Repeat this operation twice and click the object name.
HCIP-Cloud Service Solutions Architect Lab Guide Page 216
Figure 6-79
Step 5 Click the Versions tab to view the saved version files. You can determine the version
by viewing the revision time of the files.
Figure 6-80
Step 6 Perform the upload operation again and check the historical versions again. It is
found that only the latest three version files are retained and the earliest uploaded
version is updated. The earlier version has been updated, indicating that the
function workflow has been triggered and taken effect.
HCIP-Cloud Service Solutions Architect Lab Guide Page 217
Figure 6-81
Figure 6-82
Step 2 Go back to the OBS page and upload the same file again (the file can be uploaded
for multiple times) to trigger FunctionGraph to delete the historical version.
Step 3 Return to the obs-flash function page and choose Monitoring > Logs to view the
calling status of the current function. Note: After the OBS file is uploaded, it may
take several minutes to view the log information.
Figure 6-83
Choose Service List > Cloud Container Engine. In the navigation pane, choose
Workloads > Deployments, locate the Deployment created in this exercise and choose
More > Delete in the Operation column.
Choose Service List > Cloud Container Engine. In the navigation pane, choose Resource
Management > Nodes. In the node list, locate the node created in this exercise and
choose More > Delete in the Operation column.
Figure 6-84
Click Images and click the name of the image created in this exercise.
Figure 6-85
On the displayed page, select all image versions and click Delete.
HCIP-Cloud Service Solutions Architect Lab Guide Page 219
Figure 6-86
In the navigation pane, click Organization Management. Locate the organization
created in this exercise, click the organization name to go to the details page, and
click Delete in the upper right corner.
Figure 6-87
Step 4 Delete the ECS.
In the service list, choose Elastic Cloud Server under Compute. In the ECS list, locate
the ECS created in this exercise and choose More > Delete in the Operation column.
In the displayed dialog box, select the check boxes shown in the following figure and
click Yes.
HCIP-Cloud Service Solutions Architect Lab Guide Page 220
Figure 6-88
Step 5 Delete the security groups.
In the service list, choose Virtual Private Cloud under Networking. On the network
console, choose Access Control > Security Groups. In the security group list, locate the
security group created in this exercise and click Delete in the Operation column.
Choose Service List > FunctionGraph. On the Functions page on the left, locate the
function created in this exercise and click Delete in the Operation column.
In the service list, choose Simple Message Notification. In the navigation pane, choose
Topic Management > Topics. In the right pane, locate the topic created in this exercise
and choose More > Delete in the Operation column.
Figure 6-89
In the navigation pane on the left, choose Agencies. In the agency list, locate the
agency created in this exercise and click Delete in the Operation column.
In the service list, choose Object Storage Service. In the bucket list, locate the bucket
purchased in this exercise and click Delete in the Operation column.
6.4 Quiz
Question: What are the advantages of Huawei Cloud CCE?
Answer: Huawei Cloud CCE supports Deployments, StatefulSets, DaemonSets, jobs, and
cron jobs. It supports application upgrade and scaling of nodes and workloads,
streamlines deployment and upgrade, and allows hitless upgrade and automated O&M.
HCIP-Cloud Service Solutions Architect Lab Guide Page 222
7.1 Introduction
7.1.1 About This Exercise
A weather forecast microservice application provides weather forecasts as well as displays
ultraviolet (UV) and humidity indexes. This exercise uses a weather forecast application
to demonstrate the application scenarios of the microservice architecture and best
practices of managing the runtime environment and setting up pipelines on ServiceStage.
A weather forecast service consists of a frontend application and a backend application.
The frontend application weathermapweb is developed using Node.js and connected to a
microservice engine using Mesher to discover the backend application. The backend
application is implemented using the Java microservice development framework and
includes microservices fusionweather, forecast, weather-beta, and weather.
This exercise uses the CN-Hong Kong region as an example. Trainees can select regions
as required. Multiple microservice components are deployed in the environment. You are
advised to configure related names based on this manual.
7.1.2 Objectives
Understand the concepts and application scenarios of the microservice architecture.
Understand methods of using ServiceStage to manage the runtime environment and
build pipelines.
Understand methods and design principles for building and deploying microservices using
ServiceStage.
Figure 7-1
GitHub is a platform for hosting open-source and private software projects. It supports
only Git as the version library format.
7.2 Procedure
7.2.1 Preparations
7.2.1.1 Preparing Resources
Step 1 Log in to Huawei Cloud and choose My Credentials.
Figure 7-2
Step 2 Choose Access Keys and click Create Access Key on the right.
HCIP-Cloud Service Solutions Architect Lab Guide Page 224
Figure 7-3
Step 3 In the dialog box that is displayed, click Download and record the information.
Figure 7-4
Step 4 Create a VPC and subnet. For details, see the previous content.
Figure 7-5
Region: CN-Hong Kong
Billing Mode: Pay-per-use
Cluster Name: cluster-cce
Version: v1.19
Management Scale: 50 nodes
Number of master nodes: 1 (This experiment is a test environment. Therefore, one
node is selected. Three nodes are recommended in the production environment)
HCIP-Cloud Service Solutions Architect Lab Guide Page 226
Figure 7-6
Network Model: VPC network
VPC: vpc-servicestage
Subnet: subnet-servicestage
Container Network Segment: Retain the default value.
Create Node: Create later
HCIP-Cloud Service Solutions Architect Lab Guide Page 227
Figure 7-7
Step 6 After the cluster is created, click Buy Node to create a node for the CCE cluster.
HCIP-Cloud Service Solutions Architect Lab Guide Page 228
Figure 7-8
Step 7 Set the parameters as follows, confirm the configuration, and click Submit.
Billing Mode: Pay-per-use
AZ: Random
Node Type: VM node
Node Name: Use the default name or customize one.
Specifications: 8 cores | 16 GB
Figure 7-9
OS: EulerOS 2.5
System Disk: Use the default setting.
Data Disk: Use the default setting.
Subnet: subnet-servicestage
EIP: Automatically assign
Billed By: Traffic
Bandwidth: 10 Mbit/s
Login Mode: Password
Password: Customize one.
HCIP-Cloud Service Solutions Architect Lab Guide Page 229
Figure 7-10
Step 8 Confirm the configuration and click Finish.
HCIP-Cloud Service Solutions Architect Lab Guide Page 230
Figure 7-11
Step 9 On the Nodes page that is displayed, view the information about the created node.
Figure 7-12
Figure 7-13
Step 2 Set the following parameters and click Add Basic Resource.
VPC: vpc-1
Figure 7-14
Step 3 On the Cloud Container Engine (CCE) tab page, select the created CCE cluster and
click OK.
Figure 7-15
Step 4 Click Add Optional Resource.
HCIP-Cloud Service Solutions Architect Lab Guide Page 232
Figure 7-16
Step 5 On the Cloud Service Engine (CSE) tab page, select Cloud Service Engine, click OK,
and click Create Now.
HCIP-Cloud Service Solutions Architect Lab Guide Page 233
Figure 7-17
Step 6 Choose ServiceStage from Service List. In the Application List, click Create
Application in the upper right corner.
Figure 7-18
Step 7 Set Name to weathermap and click OK.
Figure 7-19
Note:You can also create an ECS and run related commands in the ECS.
Figure 7-20
Step 2 Log in to ServiceStage and choose Application Management > Application
Configuration > Secret > Create.
You can create a secret for the frontend application component weathermapweb that is
based on the Mesher framework. After the component is deployed and running, Mesher
automatically reads the secret information.
Figure 7-21
Step 3 Set the parameters as follows:
Creation Mode: Visualization
Name: mesher-secret
Cluster: cluster-cce
Namespace: default
Secret Type: Opaque
Secret Data: cse_credentials_accessKey | encoded AK; cse_credentials_secretKey |
encoded SK
HCIP-Cloud Service Solutions Architect Lab Guide Page 235
Figure 7-22
Step 4 If the created secret is displayed in the secret list, the secret is created.
Figure 7-23
Step 1 Log in to the GitHub account and click the Repositories tab on the personal
homepage.
HCIP-Cloud Service Solutions Architect Lab Guide Page 236
Figure 7-24
Step 2 Click New to create an organization.
Figure 7-25
Step 3 Create a repository based on the following configurations and click Create
repository.
Repository name: hcip
Retain the default settings for other parameters.
Figure 7-26
Step 4 On the page that is displayed, click Import code to import the source code.
HCIP-Cloud Service Solutions Architect Lab Guide Page 237
Figure 7-27
Step 5 On the page that is displayed, enter the source code address
https://github.com/servicestage-demo/weathermap.git and click Begin import.
Figure 7-28
Step 6 Check whether the source code file of the weather forecast service has been
imported to the hcip repository.
HCIP-Cloud Service Solutions Architect Lab Guide Page 238
Figure 7-29
You will use this repository for authorization to build and deploy microservices.
Figure 7-30
Step 2 Set authorization parameters as follows:
Name: auth-github
Repository Type: GitHub
Method: OAuth
HCIP-Cloud Service Solutions Architect Lab Guide Page 239
Figure 7-31
Step 3 In the displayed dialog box, click Authorize CPE-OAuth.
Figure 7-32
Step 4 In the dialog box that is displayed, enter the password for confirmation.
HCIP-Cloud Service Solutions Architect Lab Guide Page 240
Figure 7-33
Step 5 View the created authorization. If the status is Normal, the repository authorization
is successfully created.
Figure 7-34
Figure 7-35
Step 2 Click Create Organization. On the displayed page, enter the organization name hcip
and click OK.
HCIP-Cloud Service Solutions Architect Lab Guide Page 241
Figure 7-36
Figure 7-37
Step 2 Set build project parameters as follows and click Next to set the environment.
HCIP-Cloud Service Solutions Architect Lab Guide Page 242
Name: weathermap
Code Source: GitHub
Authorization: auth-github (Select the repository authorization created.)
Username/Organization: Retain the default value (username/organization of your
GitHub account).
Repository: hcip (name of the repository created in GitHub)
Branch: master
Cluster: cluster-servicestage (Select the CCE cluster created.)
Figure 7-38
Step 3 Select Custom and click Advanced Settings.
Figure 7-39
Step 4 Select Compile and click Add Plug-in. In the displayed right area, select Build
Common Cmd. Then, select Java for Language, and set parameters.
HCIP-Cloud Service Solutions Architect Lab Guide Page 243
Figure 7-40
Job Name: CommonCmd
Language: Java
Version: java-8
Figure 7-41
Step 5 In the Compile area, click Add Plug-in, select Docker, and add four build jobs with
parameters setting as follows:
HCIP-Cloud Service Solutions Architect Lab Guide Page 244
Figure 7-42
Step 6 Create the first build job:
Job Name: Docker (Retain the default value. You can set this parameter as required.
The same applies to the following.)
Dockerfile Path: ./weather/
Image Name: weather
Image Tag: v1.0.${index}
Figure 7-43
Step 7 Repeat the preceding steps to create the second build job.
Job Name: Docker-4xsb8p
Dockerfile Path: ./weather-beta/
Image Name: weather-beta
Image Tag: v1.0.${index}
HCIP-Cloud Service Solutions Architect Lab Guide Page 245
Figure 7-44
Step 8 Repeat the preceding steps to create the third build job.
Job Name: Docker-5e40k3
Dockerfile Path: ./forecast/
Image Name: forecast
Image Tag: v1.0.${index}
Figure 7-45
Step 9 Repeat the preceding steps to create the fourth build job.
Job Name: Docker-aom49h
Dockerfile Path: ./fusionweather/
Image Name: fusionweather
Image Tag: v1.0.${index}
HCIP-Cloud Service Solutions Architect Lab Guide Page 246
Figure 7-46
Step 10 Select Archive and click Add Plug-in. In the displayed right area, select Publish Build
Image.
Figure 7-47
Step 11 In Archive, select the four created images (weather, weather-beta, forecast, and
fusionweather), retain the default values for Job Name, and select the created
repository organization hcip for Repository Organization.
After jobs are added, the image package is automatically archived to the image
repository for subsequent operations.
HCIP-Cloud Service Solutions Architect Lab Guide Page 247
HCIP-Cloud Service Solutions Architect Lab Guide Page 248
Figure 7-48
Step 12 Click Build to start a build job. If the information shown in the following figure is
displayed, the background application weathermap is successfully built.
HCIP-Cloud Service Solutions Architect Lab Guide Page 249
Figure 7-49
Figure 7-50
Step 2 Set basic configurations as follows and click Next.
Name: weathermapweb
Code Source: GitHub
Authorization: auth-github
Username/Organization: Retain the default value (username/organization of your
GitHub account).
Repository: hcip
Branch: master
Cluster: cluster-cce (Select the CCE cluster created.)
HCIP-Cloud Service Solutions Architect Lab Guide Page 250
Figure 7-51
Step 3 Select a Docker build template.
Compile Docker to add a build job, and specify the job parameters as follows.
Dockerfile Path: ./weathermapweb/
Image Name: weathermapweb
Repository Organization: hcip
Branch: master
Retain the default values for other parameters.
HCIP-Cloud Service Solutions Architect Lab Guide Page 251
Figure 7-52
Step 4 Click Build. If the following information is displayed, the frontend application
weathermapweb is successfully built.
Figure 7-53
Step 1 Log in to ServiceStage and choose Application Management > Application List.
Figure 7-54
Step 3 Select Custom in Configuration Method and Microservice for Select Component
Type, and click Next.
Figure 7-55
Step 4 Select Docker in Select Runtime System and click Next.
HCIP-Cloud Service Solutions Architect Lab Guide Page 253
Figure 7-56
Step 5 Select Java Chassis in Select Framework/Service Mesh and set Name to weather.
Click Create and Deploy to deploy the component.
Figure 7-57
Step 6 Set the parameters as follows and click Next.
Figure 7-58
Step 7 Click Select Image.
HCIP-Cloud Service Solutions Architect Lab Guide Page 255
Figure 7-59
Step 8 In the displayed dialog box, select the weather image. Click OK.
Figure 7-60
Step 9 Retain the default settings for other parameters.
HCIP-Cloud Service Solutions Architect Lab Guide Page 256
Figure 7-61
Step 10 In the Advanced Settings pane, add the following environment variables:
MOCK_ENABLED: false
If an EIP has been bound to the ECS node in the CCE cluster created and the node can
access the public network, set this parameter to false or do not set this parameter. The
weather data used by the application is real-time data.
servicecomb_credentials_accessKey: AK obtained in section 7.2.1.1.
servicecomb_credentials_secretKey: SK obtained in section 7.2.1.1.
If the professional microservice engine is used, you need to configure an AK/SK.
HCIP-Cloud Service Solutions Architect Lab Guide Page 257
Figure 7-62
Step 11 Click Next to confirm the specifications. Click Deploy to deploy the component.
Figure 7-63
Step 12 Check the status of the deployed component. If the weather service is in the
Running state, the component has been deployed.
HCIP-Cloud Service Solutions Architect Lab Guide Page 258
Figure 7-64
Step 13 Repeat the preceding steps to create and deploy the forecast and fusionweather
components.
Figure 7-65
Environment: test-env
Version: default
Deployment System: Cloud Container Engine
Instances: 1
Retain the default settings for other parameters.
HCIP-Cloud Service Solutions Architect Lab Guide Page 260
Figure 7-66
Select the forecast image.
HCIP-Cloud Service Solutions Architect Lab Guide Page 261
Figure 7-67
In the Advanced Settings pane, add the following environment variables:
MOCK_ENABLED: false
servicecomb_credentials_accessKey: AK obtained in section 7.2.1.1.
servicecomb_credentials_secretKey: SK obtained in section 7.2.1.1.
Figure 7-68
Deploy the fusionweather component.
Framework/Service Mesh: Java Chassis
Name: fusionweather
HCIP-Cloud Service Solutions Architect Lab Guide Page 262
Figure 7-69
Environment: test-env
Version: default
Deployment System: Cloud Container Engine
Instances: 1
Retain the default settings for other parameters.
HCIP-Cloud Service Solutions Architect Lab Guide Page 263
Figure 7-70
Select the fusionweather image.
HCIP-Cloud Service Solutions Architect Lab Guide Page 264
Figure 7-71
In the Advanced Settings pane, add the following environment variables:
servicecomb_credentials_accessKey: AK obtained in section 7.2.1.1.
servicecomb_credentials_secretKey: SK obtained in section 7.2.1.1.
Figure 7-72
Step 14 On ServiceStage, click the created application weathermap to view the microservice
deployment status. As shown in the following figure, the three services are Normal,
indicating that the backend application components fusionweather, forecast, and
weather have been deployed.
HCIP-Cloud Service Solutions Architect Lab Guide Page 265
Figure 7-73
Step 2 Click an application. On the Overview tab page, click Create Component.
Figure 7-74
Step 3 Select Custom for Configuration Method. On the page that is displayed, select
Microservice and click Next.
HCIP-Cloud Service Solutions Architect Lab Guide Page 266
Figure 7-75
Step 4 Select Docker for Runtime System and click Next.
Figure 7-76
Step 5 Create a service component as follows and click Next.
Framework/Service Mesh: Mesher
Name: weathermapweb
Figure 7-77
Step 6 Set the parameters as follows: Click Next to configure the component.
Environment: test-env
HCIP-Cloud Service Solutions Architect Lab Guide Page 267
Version: default
Deployment System: Cloud Container Engine
Instances: 1
Retain the default settings for other parameters.
Figure 7-78
Step 7 Click Select Container Image.
Figure 7-79
Step 8 In the displayed dialog box, select the weathermapweb image. Click OK.
HCIP-Cloud Service Solutions Architect Lab Guide Page 268
Figure 7-80
Step 9 Retain the default settings for other parameters,Click Next.
Figure 7-81
Step 10 Click Deploy to deploy the component.
HCIP-Cloud Service Solutions Architect Lab Guide Page 269
Figure 7-82
Step 11 View the deployed microservices. If the weathermapweb service is Running, the
service component has been deployed.
Figure 7-83
Step 12 Log in to ServiceStage and choose Infrastructure > Cloud Service Engines.
Figure 7-84
Step 14 On the Microservice List page, if the following microservices are displayed and the
number of microservice instances is not 0, the deployment is successful:
Figure 7-85
Figure 7-86
Step 4 Choose Access Mode > Add Service.
Figure 7-87
Step 5 Set the parameters as follows:
Service Name: weathermapweb
Access Mode: Public network access
Access Type: Elastic IP address
Service Affinity: Cluster level
Port Mapping: TCP | 3000 | Automatically generated
HCIP-Cloud Service Solutions Architect Lab Guide Page 272
Figure 7-88
Step 2 Click the application created (for example, weathermap). The Overview page is
displayed.
Step 3 Click the link next to External Access Address of the weathermapweb application
component.
HCIP-Cloud Service Solutions Architect Lab Guide Page 273
Figure 7-89
Step 4 If the information shown in the following figure is displayed, the weather forecast
application is successfully deployed.
When you access the application for the first time, it takes some time for the weather
system to be ready. If the preceding page is not displayed, refresh the page.
HCIP-Cloud Service Solutions Architect Lab Guide Page 274
Figure 7-90
Log in to ServiceStage, choose Continuous Delivery > Build, select a build job, and choose
More > Delete.
Choose Cloud Container Engine from Service List. In the navigation pane on the left,
choose Nodes. In the node list, select the node and choose More > Delete.
7.5 Quiz
Question: After an application component is deployed, the status is Not ready, indicating
that the application component fails to be deployed. How do I check the cause of this
failure?
Answer: Log in to ServiceStage, choose Application Management > Application List, and
click the application. On the Overview page that is displayed, select and click the
abnormal component. Then, choose Instance List, click the arrow button before the
instance name, and click Event. In the event list, view the event description to determine
the cause of the application component deployment failure.
HCIP-Cloud Service Solutions Architect Lab Guide Page 276
8.1 Introduction
8.1.1 About This Exercise
This exercise consists of three parts:
1. Cloud Eye: View metrics on Cloud Eye and configure server, site, and event
monitoring.
2. AOM: Connect an ECS to AOM and configure threshold rules, log dump, and log
analysis.
This exercise uses the CN-Hong Kong region as an example. Trainees can select other
regions as required.
8.1.2 Objectives
Understand the configuration and usage principles of Cloud Eye.
Master the methods and principles of alarm monitoring and log collection/analysis using
AOM.
8.2 Procedure
8.2.1 Preparations
8.2.1.1 Creating a VPC by Referring to the Preceding Exercise
Basic settings:
Region: CN-Hong Kong
Name: vpc-1
IPv4 CIDR Block: 192.168.0.0/16
Default subnet:
HCIP-Cloud Service Solutions Architect Lab Guide Page 277
Name: vpc-1-subnet
IPv4 CIDR Block: 192.168.1.0/24
Step 2 In the navigation pane, choose Topic Management > Topics. Then, click Create
Topic in the upper right corner.
Figure 8-1
Step 3 Set a topic name and click OK.
Note: This topic is shared by multiple services. Trainees can customize their own topic
name. abc is used as an example here.
HCIP-Cloud Service Solutions Architect Lab Guide Page 278
Figure 8-2
Step 4 Add a subscription.
In the navigation pane, choose Subscriptions. Then, click Add Subscription in the
upper right corner.
Figure 8-3
Set Topic Name to abc, set Protocol to Email or SMS (Email is used as an example
here), specify Endpoint, and click OK.
HCIP-Cloud Service Solutions Architect Lab Guide Page 279
Figure 8-4
Step 5 In the subscription list, view the created subscription and click Request
Confirmation.
Figure 8-5
Step 6 In the displayed dialog box, click OK.
Figure 8-6
Step 7 Check the subscription email and confirm the subscription.
Step 8 Return to the subscription list and check whether the subscription status changes to
Confirmed. If yes, the subscription is successfully added.
HCIP-Cloud Service Solutions Architect Lab Guide Page 280
Figure 8-7
Figure 8-8
Step 2 Click Create Bucket in the upper right corner.
Figure 8-9
Step 3 Create an OBS bucket:
Region: CN-Hong Kong
Bucket Name: test-aom-hcip (user-defined)
Default Storage Class: Standard
Bucket Policy: Public Read and Write
Retain the default settings for other parameters.
HCIP-Cloud Service Solutions Architect Lab Guide Page 281
Figure 8-10
Figure 8-11
Step 2 In the navigation pane, choose Cloud Service Monitoring > Elastic Volume Service,
locate the target resource, and click View Metric in the Operation column. The
metric monitoring page is displayed.
Figure 8-12
You can view graphs based on raw data collected in the last 1h, 3h, 12h, 1d, and 7d. In
the upper right corner of the graph, the maximum and minimum values of the metric in
the corresponding time period are dynamically displayed. You can also enable Auto
Refresh to view the data refreshed every minute.
Figure 8-13
Step 3 Click Select Metric in the upper right corner of the page.
HCIP-Cloud Service Solutions Architect Lab Guide Page 283
On the displayed page, select target metrics, and drag and drop them at desired locations
for monitoring.
Step 4 Hover over a metric and click in the upper right corner of the metric graph.
The monitoring details page is displayed.
Figure 8-14
You can view the metric monitoring details in a longer time range. In the upper left
corner, you can select 1h, 3h, 12h, 1d, 7d, or 30d to view monitoring data. You can also
customize a time range (up to six months).
Figure 8-15
To export data, click Export Data on the Cloud Service Monitoring page, set parameters
as prompted, and click Export.
HCIP-Cloud Service Solutions Architect Lab Guide Page 284
Figure 8-16
Figure 8-17
Step 2 In the navigation pane, choose Server Monitoring.
Figure 8-18
Step 3 (Optional) On the displayed page, select the ECS where the agent is to be installed.
(If there are ECSs on which the agent is not installed) 1. Install the agent in one
click. If the agent has been installed, skip this step.
HCIP-Cloud Service Solutions Architect Lab Guide Page 285
Figure 8-19
Step 4 Locate the target ECS and click View Metric in the Operation column to view its
monitoring data.
Figure 8-20
OS Monitoring, Basic Monitoring, and Process Monitoring are available.
Figure 8-21
Figure 8-22
Step 2 On the Event Monitoring page, click Create Alarm Rule in the upper right corner.
Figure 8-23
Step 3 Configure the alarm rule name, policy, notification, and other parameters as
prompted.
Name: alarm-test
Event Type: System event
Event Source: Elastic Cloud Server
HCIP-Cloud Service Solutions Architect Lab Guide Page 287
Figure 8-24
Notification Object: abc (created during preparation)
Retain the default settings for other parameters.
Figure 8-25
After you create the alarm rule, if the metric data triggers the present alarm policy, Cloud
Eye will immediately send SMN notifications.
HCIP-Cloud Service Solutions Architect Lab Guide Page 288
Step 4 Check whether the status of the alarm rule is Enabled. If yes, the alarm rule is
successfully created.
Figure 8-26
8.2.3 AOM
AOM is a one-stop, multidimensional O&M management platform for cloud applications.
It monitors applications and related cloud resources in real time, analyzes application
health status, and provides flexible data visualization functions. It helps you detect faults
in a timely manner and monitor running status of applications, services, and other
resources in real time.
By setting alarm rules, you can learn about the resource usage, trend, and alarms of
hosts in a timely manner. Administrators can quickly respond to exceptions to ensure
smooth host running.
AOM also provides powerful log management capabilities. You can quickly search for
required logs among a large quantity of logs, and dump logs to buckets for long-term
storage. You can also set statistical rules so that AOM periodically counts keywords and
generates metric data for real-time system performance and service monitoring.
Figure 8-27
Step 2 In the navigation pane, choose Configuration Management > Agent Management.
On the displayed page, click Install ICAgent.
Note: ICAgents collect metrics, logs, and application performance data. For hosts
purchased on the ECS or BMS console, manually install ICAgents.
Figure 8-28
Step 3 On the displayed page, enter the AK/SK downloaded in section 7.2.1.1 and copy the
installation command.
Figure 8-29
Step 4 Log in to the test ECS and run the copied command to install the ICAgent. If
ICAgent install success is displayed, the installation is complete.
HCIP-Cloud Service Solutions Architect Lab Guide Page 290
Figure 8-30
Step 5 Return to the Agent Management page and refresh the page. If the ICAgent status
of the test ECS is Running, the ICAgent is successfully installed.
Figure 8-31
Step 6 In the navigation pane, choose Alarm Center > Alarm Rules. Then, click Add Alarm
in the upper right corner.
Figure 8-32
Step 7 Add an alarm rule:
Rule Name: cpu-usage
HCIP-Cloud Service Solutions Architect Lab Guide Page 291
Figure 8-33
Rule Type: Threshold Rule
Monitored Object: Select resource objects
Click Select resource objects.
Figure 8-34
Add By: Resource
Metric Name: Host/Host/CPU usage (This metric is used as an example. Trainees can
select a metric based on site requirements. It may take a while to discover a newly
deployed ECS.)
Select indicator dimensions: test
Figure 8-35
Alarm Condition: Custom
Trigger conditions: 2 | 2 | Avg. | >= | 80 | Major (This condition is used as an example.
Trainees can configure trigger conditions based on site requirements.)
HCIP-Cloud Service Solutions Architect Lab Guide Page 292
Figure 8-36
Step 8 Check whether the status of the created rule is Started. If yes, the alarm rule is
successfully created.
Figure 8-37
Step 9 In the navigation pane, choose Overview > O&M. On the displayed page, view the
monitoring information of the connected resource.
HCIP-Cloud Service Solutions Architect Lab Guide Page 293
Figure 8-38
Step 1 In the navigation pane, choose Log > Log Dumps. Then, click Add Log Dump in the
upper right corner.
Figure 8-39
Step 2 Add a log dump:
Dump File Format: Custom file
Dump Mode: Periodic dump
Log Type: System
Cluster Name: Custom Cluster
Host: 192.168.3.219 (private IP address of the test ECS)
Log Group: syslog
Target OBS Bucket: test-aom-hcip (created during preparation)
HCIP-Cloud Service Solutions Architect Lab Guide Page 294
Figure 8-40
Step 3 View the creation time and last dump time on the log dump page.
Figure 8-41
Step 4 In the navigation pane, choose Log > Log Buckets. Then, click Add Log Bucket.
Note: This log bucket will be used when you create a statistical rule.
HCIP-Cloud Service Solutions Architect Lab Guide Page 295
Figure 8-42
Step 5 Add a log bucket:
Log Bucket: syslog
Log File: System | Custom Cluster | 192.168.3.219 | syslog
Note: 192.168.3.219 is the private IP address of the test ECS.
Figure 8-43
Step 6 In the navigation pane, choose Log > Statistical Rules. Then, click Create Statistical
Rule in the upper right corner.
Figure 8-44
Step 7 Create a statistical rule:
Rule Type: Keyword
Rule Name: count-error
Keyword: error
Log Bucket: syslog
HCIP-Cloud Service Solutions Architect Lab Guide Page 296
Figure 8-45
Step 8 Locate the created statistical rule and click Adding a threshold rule in the Operation
column.
Figure 8-46
Step 9 Create a threshold rule:
Alarm Name: count-error
Statistic Method: Average
Statistical Cycle: 1 minute
Threshold Condition: >= | 3
Consecutive Period (s): 1
Alarm Severity: Minor
Send Notification: Yes
Topic: abc
Trigger Condition: Threshold crossing
HCIP-Cloud Service Solutions Architect Lab Guide Page 297
Figure 8-47
Figure 8-48
After the threshold rule is created, if the statistical result exceeds the threshold, an SMS
message or email notification will be sent immediately. O&M personnel can then locate
and rectify the fault at the earliest time.
Figure 8-49
Create a cluster:
Region: CN-Hong Kong
Billing Mode: Pay-per-use
Cluster Name: cluster-cce (user-defined)
Version: v1.19
Management Scale: 50 nodes
Number of master nodes: 1
Network Model: VPC network
VPC: vpc-1 (Reuse the created VPC or customize one.)
Subnet: vpc-1-subnet (Reuse the created subnet or customize one.)
Create a node:
Billing Mode: Pay-per-use
AZ: Random
Node Type: VM node
Specifications: 4cores | 8GB
System Disk: Use the default setting.
Data Disk: Use the default setting.
OS: Default
Node Name: Use the default name or customize one.
Password: Customize one.
Subnet: vpc-1-subnet (Reuse the created subnet.)
EIP: Do not use
Login Mode: Password
HCIP-Cloud Service Solutions Architect Lab Guide Page 299
Step 2 In the service list, choose Application Operations Management. In the navigation
pane, choose Overview > O&M to view monitoring information. You can monitor
resources, applications, and application user experience on this page. You can also
monitor the running status of the CCE cluster.
Figure 8-50
Step 3 In the navigation pane, choose Monitoring > Host Monitoring. You can monitor
host resource usage and health status of the CCE cluster, as well as the usage of
common system devices such as disks and CPUs.
Figure 8-51
Step 4 In the navigation pane, choose Monitoring > Container Monitoring to view
information about plug-ins and containers in the CCE cluster.
Figure 8-52
In the service list, choose Simple Message Notification. In the navigation pane, choose
Topic Management > Topics. In the right pane, locate the topic created in this exercise
and choose More > Delete in the Operation column.
On the AOM console, choose Alarm Center > Alarm Rules in the navigation pane, locate
the alarm rule created in this exercise, and click Delete in the Operation column.
On the AOM console, choose Log > Statistical Rules in the navigation pane, locate the
statistical rule created in this exercise, and click Delete in the Operation column.
On the AOM console, choose Log > Log Buckets in the navigation pane, locate the log
bucket created in this exercise, and click Delete in the Operation column.
On the AOM console, choose Log > Log Dumps in the navigation pane, locate the log
dump created in this exercise, and click Delete in the Operation column.
In the service list, choose Virtual Private Cloud under Networking. On the network
console, choose Access Control > Security Groups. In the security group list, locate the
security group created in this exercise and click Delete in the Operation column.
8.4 Quiz
Question: How does AOM obtain a custom host IP address on the Agent management
page?
Answer: By default, AOM traverses all NICs on a VM and obtains the IP addresses of the
Ethernet, bond, and wireless NICs based on priorities in descending order. To ensure that
HCIP-Cloud Service Solutions Architect Lab Guide Page 301
AOM obtains the IP address of a specific NIC, set the IC_NET_CARD=Desired NIC name
environment variable when starting the ICAgent.