Hi everyone, welcome to the third chapter in our Tencent Cloud Developer Associate course, local application migration to the Cloud. At the end of this chapter, you'll be able to understand the strengths and steps of local application migration to the Cloud, use Tencent Cloud Cloud virtual machine, CVM, auto-scaling, AS and Cloud load balancer, CLB, together, use and expand the capacity of Cloud block storage, CBS, and lastly, use the Cloud file storage, CFS. In this chapter, we'll cover two sections, migrating local applications to the Cloud and using CVM features. Let's get started with Section 1, migrating local applications to the Cloud. In this video, we'll cover the basics of local application migration to the Cloud, use cases of application migration to the Cloud, and overview of CVM and steps for migrating local applications to the Cloud. To introduce the basics of local application migration to the Cloud, we'll first look at the traditional web application infrastructure. The traditional application is a monolithic architecture divided into a local server that contains necessary software packages and processes, in addition to a local database and local storage. Some data generated by this type of application is saved in the database, whereas the other types of file data, such as attachments, are saved to the local storage. Both the local database and local storage are bound to the physical capacity of the machine. There are several challenges involved in using traditional Internet data centers, IDC, compared with Cloud computing. For traditional IDCs, you need to purchase the server, send the server to data centers, and maintain hardware devices on your own, which is a costly and inflexible way of maintaining a web service. In addition, simple resource concentration makes it impossible for traditional IDCs to quickly deliver resources and batches. Due to the deployment and configuration of physical hardware, the delivery of traditional IDC resources usually takes hours or even days, which increases the time and cost, and makes it difficult to achieve real-time and rapid resource reallocation. In comparison, Cloud computing provides users with a complete set of continuous services from the infrastructure, IaaS, to the business platform, PaaS, to the application layer, SaaS. Cloud computing not only provides highly scalable and highly available computing power, but also prevents enterprises from worrying about the performance limitations of hardware devices and related issues. The deployment of Cloud computing in an enterprise environment offers the following advantages. First, Cloud servers reduce upfront investment costs, mainly by reducing the costs of procuring hardware. Second, Cloud servers reduce operating costs due to their low rate of failure, higher work efficiency, improved SLA. Third, Cloud computing improves the business uptime, optimizes the data backup process, reduces the application deployment time and enables business continuity and disaster recovery. Lastly, Cloud computing allows for the rapid and flexible deployment of IT resources and their elastic scaling and release, as well as secure access anytime and anywhere. Let's look at the basic steps of migrating local applications to the Cloud. The first step is to migrate your application packages to a CVM. The next step is to install databases such as MySQL in the Cloud server and then migrate the data. Finally, migrate local storage resources to the Cloud server. This use case, takes a simple library management system as an example to illustrate the Cloud migration process of an application. In order to use Cloud computing resources to save costs and improve flexibility as the business grows, the management system of this library has been migrated to the Cloud. As you can see, the library management system needs a local server to run the web services, a local database for the transactional data, and a local image storage. Here is the initial migration solution for the previous library management system to migrate to the Cloud. The migration solution includes one CVM instance with a data disk of at least 60 gigabytes for MySQL database installation and data storage, and another CVM instance for the Tomcat environment, the application deployment and the storage of image resources. For the local application to be migrated to the Cloud, you need to purchase a Cloud server, install a database, use the Cloud disk storage for the storage of files, install middleware such as Tomcat, and finally deploy the application files in Tomcat for extranet users to access. This slide shows what the architecture looks like after the local application is migrated to the Cloud. Here is an overview of the different types of virtual machines that Tencent Cloud offers. First, CVM provides a secure, reliable, and elastic Computing service that can be easily purchased in the Cloud to meet any computing needs. Second, GPU, Cloud computing is a fast, stable and elastic computing service based on GPU that is suitable for deep learning, scientific computing and video encoding and decoding. Another option is field programmable gate array , FPGA Cloud computing, which supports the rapid deployment of FPGA computing instances to create custom hardware acceleration for applications. FPGA is particularly suitable for scenarios such as deep learning and real-time image compression. Next, CVM dedicated host, CDH, allows the purchasing of Cloud hosts with exclusive resources to meet the requirements of resource exclusivity, security, and compliance. After creating a CDH instance you can create a large variety of Cloud servers with customized specifications based on the available resources of the Cloud host. Lastly, Cloud physical machine, CPM is a dedicated physical server containing physically separated compute resources and is suitable for high performance scenarios such as big data, virtualization, and gaming. Let's focus on CVM, the basic type of virtual machine on which most Cloud services run. Tencent Cloud CVM provides scalable computing services in the Cloud and therefore does not need to estimate resource usage and make upfront investments, such as when using traditional servers. With Tencent Cloud CVM you can quickly start any number of Cloud servers and start deploying applications immediately. Compared to traditional servers, CVM has the following advantages. The first advantage is elastic computing. The number of Cloud servers can be quickly added or deleted within minutes to meet rapidly changing business needs. The size of servers can be scaled as needed. Second, in terms of configuration, CVM provides a wide variety of instance types, operating systems, and software packages. Third, Tencent Cloud provides high stability and data reliability. Since it's CVM is equipped with a three copies storage policy to ensure rapid data migration and recovery. Fourth, CVMs are easy to manage and the hardware does not have to be manually downloaded and installed. Fifth, you can use the Tencent Cloud Console API or CLI to take full control of the server instance, allowing you to view and configure resources at anytime. Sixth, for security protection, the private network function provides a logically isolated network on Tencent Cloud with network access control ACL, to control incoming and outgoing traffic at the subnet level. Lastly, Tencent Cloud CVM adopt flexible billing compared to high rental and operations costs for traditional servers. This graph illustrates the conceptual relationship of CVM. An instance can be understood as a Cloud server that includes the most basic components, such as the CPU, memory, network, disk, and operating system. The instance is composed of the image and the storage. The image can be thought of as a snapshot image of the operating system and a template for Cloud server software configuration. Whereas the storage is divided into the system disk and data disk, similar to that of ordinary Cloud servers. An image is important because it provides all the information needed to start the Cloud server instance. Meanwhile, the snapshot is a data backup method that creates a backup independent of the life cycle of the Cloud disk, by making a full copy of the specified disc at a specified point in time. You can create a new Cloud disk based on a snapshot. The newly created disk from a snapshot will have the same data from the snapshot to become an exact copy of the original Cloud disk. The storage media for CVM include the hard disk drive, HDD, and the solid state drive, SSD. The HDD is backed by magnetic disks that offer lower costs while maintaining high performance. Whereas SSD features much better read and write speeds and higher throughput, but also higher prices compared to regular hard drives. In terms of use cases, the system disk is used to store the collection of systems that control and schedule the operation of the Cloud server and the data disk is used to store all user data. There are three architecture modes of CVM Storage. Cloud disk, local disk, and Cloud objects storage, COS. First, the Cloud disk is a resilient, highly available, highly reliable, low-cost and customizable network access to block device that can be used as a standalone scalable disk for Cloud servers. It provides block-level data storage with a three copied distributed mechanism to guarantee the data reliability of CVMs. The local disk is created from the local storage of the physical machine and bound to its location. For the local disk, data access can be obtained with lower latency but there is a risk of single points of data failure. Lastly, COS is a distributed storage service that does not have structural restrictions and is accessible via the HTTP and HTTPS protocols. COS is not suitable as a storage medium for low latency and high IO requirements, such as those of CVM disks. Next, let's look at the device mapping of the block storage and a physical computer. Each instance has a system disk for basic operational data. Additional data disks can be mounted to that system. Through device mapping, the storage devices are mounted to their specific locations. As shown on the diagram, dev/vda is mapped to the system disk, and two data disks are mapped to dev/vdb and dev/vdc, respectively. The Cloud server instance automatically creates device mappings for the local disk to which Cloud disks are mounted. There are four different types of APIs available for Tencent Cloud CVM. First, region APIs are used it to query the information of regions and availability zones. Second, instance APIs are used to manage the lifecycle of instances. Third, you can use Image APIs to create, modify, delete, import, and sync images. Lastly, key APIs are used to create, modify, and bind key pairs. This table lists some parameters that are usable for the region APIs. For example, calling runinstances would trigger the creation of an instance while calling startinstances would start to an instance. You can also call terminate instances to return the instance and describe instances to view the instance list. Next, let's talk about how to use software development kits, SDKs to query the CVM. To obtain the access credentials and set the end point information, you first need to instantiate a new object of the type, and then update the client profile. After you get the access credentials and access address, you can set the parameter information such as regions and other instance parameters. Note that the content in the sample code that is highlighted in red needs to be adjusted and modified according to the specific scenario. As this figure shows, the details of the CVM instance are queried through the describe instances object which returns information such as the instance ID, state, and type. This response can be further filtered according to your needs. This sample code shows how you can create an instance through the runinstances API with the requirement parameters passed into the API call. After the CVM instance is successfully created, you can also view it in the web console. Now, let's walk through some of the best practices for CVMs in terms of access control, secure login, and hardware storage respectively. For access control, we recommend that you restrict access by using a firewall to allow access to instances from only trusted addresses and configure specific rules in the security group. For secure login whenever possible, the secure shell protection SSH keys should be used for logging into Linux CVM Instances. Note that instances that use the password login will require occasional password changes. We also recommend that you create different security groups for which different security levels can be applied to ensure that instances running critical operations are secured for external access. Regarding hardware storage for data with extremely high requirements for reliability, we recommend that you use CBS Cloud disks instead of local disks to ensure the persistent storage reliability of the data. The prices of CVMs are affected by many factors, such as regions, availability zones, and specifications. There are two billing modes for Tencent Cloud CVM, pay-as-you-go, and monthly subscription. Pay-as-you-go is an elastic billing model for Cloud server instances, where you can turn the service on or off at any time and only pay for the actual usage of the service. This billing model is suitable for scenarios where the demand for equipment fluctuates a lot. On the other hand, monthly subscription is an example of prepaid billing for Cloud servers. This payment model is suitable for scenarios where the demand for equipment can be predicted in advance, resulting in a lower price in comparison with the pay-as-you-go billing model. As a review of what you've learned in this section, let's go over the following reflection questions. How do we automate the monitoring of the CVM running status? How do we use CVM securely? What parameters need to be passed in to query the CVM instance information through an SDK? How do we query the APIs for SDK access to Tencent Cloud services? You can pause the video for a few minutes and think about how you would answer these questions. These deployment steps depict the migration of a local application to the Cloud using a simple management system that involves only the database and the object storage. The first step is to create a CVM instance and install the deployment environment. Next, create and initialize a database on the CVM instance and then upload other data to the CVM instance. After modifying the database and storage configurations of the application, you can package and upload the application to the CVM instance. Finally, you can start the application to provide services. This slide shows the architecture after the local application is migrated to the Cloud. Taking the book management system as an example, we have the Cloud server running in the front end that provides flexible, stable, and reliable resources, and simple and convenient security protection. The MySQL database runs on a different server with an attached data disk to provide high performance, high security reliability, and fast scaling. Since the amount of data is not large here, we can directly use the MySQL file migration database. However, for the actual migration, database migration tools are needed. In addition, the Cloud disk used it to store the image information also features high stability, low latency, fast expansion, and high data reliability.