VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY UNIVERSITY OF INFORMATION TECHNOLOGY INFORMATION SYSTEM FACULTY PHAM TRUNG KIEN GRADUATION THESIS AN AUTOMATION SUPPORT TOOL FOR DEPLOYING INFORMATION SYSTEM ENGINEERING Ho Chi Minh City, 2022 VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY UNIVERSITY OF INFORMATION TECHNOLOGY INFORMATION SYSTEM FACULTY PHAM TRUNG KIEN - 18520957 GRADUATION THESIS AN AUTOMATION SUPPORT TOOL FOR DEPLOYING INFRASTRUCTURE TO THE CLOUD USING TERRAFORM AND CI/CD INFORMATION SYSTEM ENGINEERING ADVISOR Dr. PHAN XUAN THIEN Ho Chi Minh City, 2022 INFORMATION OF THE GRADUATE THESIS COUNCIL ose Graduation thesis grading committee, established under Decision No. of the Rector of the University of Information Technology. — Commissioner ACKNOWLEDGE First of all, I would like to express our sincere thanks to the lecturers at the University of Information Technology - Vietnam National University, Ho Chi Minh City, and the Department of Information Systems teachers for helping me have a basic knowledge that underlies this thesis.
Our group would like to express deepest gratitude and gratitude to our instructor — Dr. Phan Xuan Thien. The teacher and your directly guided, corrected, and provided many valuable comments to help our group complete subject final report well. Once again, I sincerely thank you and wish you good health.
During one semester of implementing the project, our group applied the accumulated background knowledge and combined it with learning and researching new knowledge from teachers, friends, and many sources or references. From there, our team makes the most of what has been collected to complete the best project report. However, because of our limited professional knowledge and our lack of practical experience, the content of the report cannot avoid shortcomings, I look forward to receiving further advice and guidance from you to perfect our knowledge so that our group can use it as a luggage to carry out other topics in the future as well as in future study and work. Besides, I want to give thanks to my family for taking care of, support me and always give me a best condition.
Moreover, Thanks for all college student of class CTTT2018 have always been attached, helped each other. Signature TABLE OF CONTENTS Contents [Y0 0400 naa11.2 Objective and Particular ObjeCfÏVéS.011 1e6 CHAP 2: RELATED RESEARCH.1 Overview about Ansible 2.3 Terraform vs Ansible. CHAP 3: GOOGLE CLOUD PLATFORM (GCP).2 Virtual Private Cloud 6 RS he 20 3. ¿tt tt th t2 th tt 0 re 22 CHAP 4: AUTOMATION SUPPORT TOOL FOR CLOUD.1 Infrastructure as code (aC) Configuration Workflow.
tt tt th HH H1 11111010. tt tt rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrce DO 4.4 Terraform State hố .1 Azure pipeline WOTkfÏOW. CHAP 5: Experiments and EvaluatiOIS.1 Values of VPC and Subne 5.2 Values for VM 5.3 Values for LB.1 Enable Api, Create Service Account and Grant Permission.1 Template Virtual Private Cloud and Subnet: .3 Virtual machine with the role firewall: .4 Virtual machine with single network interface Card: .5 Load Balancer preparation .4 Continuous Integration/ Continuous Delivery eX€Ute.2 Azure pipeline DF€DATALÏO:.1 Continuous Integration/ Continuous Delivery 6. 64 LIST OF PICTURES Figure 1.
State Architecture of Pulumi. Ansible Architecture Figure 3. Sample Architecture on GCP. The half option to create VPC Figure 5.
Another option to create VPC. Option to create Subnet. First option to create VM. Configuration a storage of VM Figure 9.
Configuration Operating System. laC Workflow Figure 11. Example Provider Azure. The result of successful initialize.
The result of terraform plan. The sample resources Figure 15. Module structure Figure 16. example of variable structure.
Resource to create bucket of GCP Figure 18. Configuration a backend file .-‹---:-:---++ Figure 19, Example of variable for 5 VPC: Figure 20. CI/CD workflow. Pipeline concepts overview.
Option to create Service Account on GCP Figure 23. Grant permission for service account Figure 24. Permission need for Service Account Figure 25. Pipeline Library Figure 26.
CI/CD Workflow Figure 30. Result of Azure pipeline. VPC result on GCP. VM instance on GCP.
Load Balancer r€SuÏ(S.162 LIST OF TABLES Table 1. Compare Terraform and Pulumi. Source : Pulumi, Homepage, https://www.com/docs/intro/vs/terrafOrm/. Terraform vs Ansible.
Create Subnet on GCP. First option to create VÌM. Configuration storage Of VM. Configuration operating system Of VM.
Option to create a bucket on GCPP.cccsceeccesceseseeseeseseeseeseseseessseseessseseensseeseesssesseensseesessseeeseesens oA Table 10. Variable value Of VPC .cccsesssessessesestssesssseesesnssesssssssessssssessssesseeisseessessseesseissensseessensesessens DD Table 11. Variable Value for subnet. Values of5 VÌMs.
tt tt 2t 2 t2 1212111111 40 Table 13. Creating service aCCOUML. VPC template Option. cece cece eeeseseeeesesesseseseeseseestsnesessesnsseessssaeenssesaeesssesseesseeseseese 46 Table 16.
Subnet template OptÏOn.-- 5:52 S£SE9S£2t}EEE2EE22EE23931212111 71. Peering template option. VM (firewall) template option Table 19. VM template option Table 20.
Instance group template option he) Table 21. Health check template optio b9 Table 22. Frontend Load Balancer template option. Backend Load Balancer template option.
®a LIST OF ACRONYMS GCP: Google Cloud Platform VPC: Virtual Private Cloud VM: Virtual Machine LB: Load Balancer FE LB: Front End Load Balancer BE LB: Back End Load Balancer CI: Continuous Integration CD: Continuous Deployment ABSTRACT laC, known as, Infrastructure as Code, help us can design our server on code. Among other advantages, IaC deploy our desired server in automation, which reduces the need for manual intervention, and mitigates the risk of configuration error, and reuse the template with module and scalable code. One of the tools allow IaC is Terraform from Hashicorp. Nowadays, terraform is extremely popular today because the development of the cloud.
Another reason, terraform has a following advantages: 1. Terraform can support for a multi-provider. It means Terraform can run code on AWS or GCP and Azure. Although there is different provider, the flow or algorithm of the code is still the same.
The small different from the resource of each cloud. To GCP, to run code terraform we need grant permission to user (owner or editor) then we need create a credential to check authentication of the user. It is the json file and if it is leaked out, the hacker can use it to attack our data and a big money will be lost just on few minutes. To Azure, it is more secure than GCP.
We still need create a key but only the key ID not the file and we need login on our computer, more details, only our computer can run the code Terraform on Azure, for GCP, everyone have a json file can run code. It has another method with AWS. We can preview the cloud when we create or change any attribute of each resource. DevOp, IT culture , is a software development methodology often associated with specific practices and tools that help implement those practices.
It is mainly focused on increasing the frequency of software deliveries. The combination between processes, tools and peoples makes the culture become reality. CI/CD is the important part of a DevOps methodology, bringing developers and operations teams together to deploy software. CI/CD is a method to frequently deploy apps to customers by introducing automation into the stages of app development.
Specifically, CI/CD introduces ongoing automation and continuous testing throughout the lifecycle of apps. On the screen now 1s a simple example of a cycle where an update is made, it will be built, tested, and released to customers. When the customer feedback with a problem, an update will be made, and the cycle begins. After four months, we have a support tool to help us implement in a cloud.
We can easily create multiple resource with large quantity such as: 1. which just need input the value of this resource and we do not need run. Everything we need after input value that is push it on GitHub and it will automatic test, check and build to the cloud.1 Problem Statement Nowadays, a large number of companies uses cloud computing to store data and run their applications instead of using on-premises servers as in the past decades. With cloud computing, companies can easily and fast deploy their services and applications to approach their users.
However, cloud engineering has some drawbacks when managing infrastructures by point-and-click user interfaces. For instance, if we create 100 virtual machines on cloud, it will easily cause such problem because there are a lot of data from customer’s virtual machines. Another drawback that every cloud engineering has in common is configuring for cloud infrastructure deployment in the same way with configuring the web or application servers. Not only creating but also managing, the cloud engineer has a trouble with manage a lengthy list of cloud.
If the maximum of creating virtual machine is approximate 100, the resource will be managed is bigger than many times. For those reasons, terraform are created to make it comes true. This is a big step up for cloud engineer. It makes everything we deploy and manage on cloud in automation, and it is also a huge time saver for us.
The grown of terraform relate to another problem. First of all, only the developer who write a code can impact to the resource. Although they give us a code, we still cannot do anything like delete a resource or change configuration. Because the terraform depend on the state file to compare the different and apply the resource depend on it.
Secondly, we cannot merge all code terraform together because the different format. The terraform state should be stored remotely on cloud to enable collaboration between everyone on a project. If we hold a large number of source code, the managing will be out of control. Version control of terraform is important for the team working and managing.
Moreover, they want everything on a project work with the minimum error. So, topic an automation support tool for deploying infrastructure to the cloud using Terraform and CI/CD is chosen to help cloud engineering or developers understand the concept, benefit, and problem of terraform and CI/CD related to cloud computing.2 Objective and Particular objectives The thesis will focus on cloud computing, reviewing some resource on Google Cloud Platform. Analyst every option of each resource and describe the value input for example architecture. Research the method and element to create a template for creating resource on cloud using Terraform.
In addition, showing synthetic about CI/CD, creating a flow of CI/CD for improving the project. From that, we will execute the tools with the example value for each resource that I have created. Depend on the result, showing the advantage and disadvantage of this topic and giving the development.3 Challenges The first challenge that everyone use cloud must face, it is budget that we have to pay. Cloud is convenience but the money we need to pay this convenience is not cheap.
For the virtual machine with the minimum size and the operating system is Linux, taking approximate 30$ for month. And even that price is more double with the window operating system. The minimum size just helps us take some test such as: test connection, test ping or test port,. We cannot do anything else.
The best solution to decrease that stop the VM when you do not use it. For my demo, I have to create 5 virtual machine include 3 Windows and 2 Linux. It takes me about 80$ for first week. And about load balancing is 70$ per month for the minimum configuration.
For the college student, this price is so big. Not the same with the VM, we cannot turn of the load balancing. So, I often delete it when I create it. One more thing maybe will take from you a big money about security issue.
To run terraform code we need create key to cloud provider can check authentication. And when we work with the CI/CD we need upload the code to open source and maybe we upload the key to. The hacker can use this key to access to our cloud and create multiple resource. My partner faces with this trouble.
Unfortunately, He have granted permission Compute Admin (permission allows you can create a virtual machine on GCP) for his key.