(P) Assignment 2 - Cloud Computing - Vo Minh Quoc, Essays (university) of Programming for Engineers

An assignment front sheet for a BTEC Level 5 HND Diploma in Computing. The assignment focuses on cloud computing and involves creating a web application in the cloud using Nodejs and PostgreSQL. instructions on configuring a cloud computing platform with a cloud service provider, connecting to PostgreSQL, and implementing a cloud platform using open-source tools. It also discusses the tools used for the project, such as Visual Studio Code and Heroku.

Typology: Essays (university)

2021/2022

Available from 07/22/2022

quoc-vo-minh
quoc-vo-minh 🇻🇳

4.8

(13)

14 documents

1 / 41

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Unit 16: Cloud computing
Submission date
11/07/2022
Date Received 1st
submission
Re-submission Date
Date Received 2nd submission
Student Name
Võ Minh Quốc
Student ID
GCD201870
Class
GCD0904
Assessor name
Tran Trong Minh
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Grading grid
P5
P6
P7
P8
M3
M4
D2
D3
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29

Partial preview of the text

Download (P) Assignment 2 - Cloud Computing - Vo Minh Quoc and more Essays (university) Programming for Engineers in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 16 : Cloud computing Submission date 11 /0 7 /2022 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Võ Minh Quốc Student ID GCD Class GCD0904 Assessor name Tran Trong Minh Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Grading grid P5 P 6 P 7 P 8 M3 M 4 D2 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Internal Verifier’s Comments: Signature & Date:

  • Chapter 1 - Introduction:
  • Chapter 2 - Configure a Cloud Computing platform with a cloud service provider (P5)
    1. Tools:
    1. Step by step of deploying website to Heroku
  • Chapter 3 - Implement a cloud platform using open-source tools (P6)............................................
    1. Code implementation:
    1. Screen shot for CRUD function and authentication:
  • discuss appropriate solutions to these problems. (P7) Chapter 4 - Analyse the most common problems which arise in a Cloud Computing platform and
    1. Data Breaches:
    1. Access Control:
    1. Data Loss:
    1. Denial of Service:
  • Chapter 5 - Assess the most common security issues in cloud environments. (P8)
    1. Misconfiguration:
    1. Unauthorized Access:
    1. Insecure Interfaces/APIs
    1. Hijacking of Account
    1. Lack of Visibility
  • REFERENCE
  • Figure 1. Express framework
  • Figure 2. Create repository
  • Figure 3. Set up repository
  • Figure 4. Set up repository
  • Figure 5. Result
  • Figure 6. Create new app on Heroku
  • Figure 7. Choose name for app
  • Figure 8. Connect Heroku with repository on Github
  • Figure 9. Result
  • Figure 10. Deploy branch to Heroku
  • Figure 11. Result
  • Figure 12. View website on Heroku platform
  • Figure 13. Result
  • Figure 14. Result
  • Figure 15. Result
  • Figure 16. Create Heroku Postgre
  • Figure 17. View Credentials
  • Figure 18. Connect PGadmin with Heroku Postgre
  • Figure 19. Connect PGadmin with Heroku Postgre
  • Figure 20. Create table in PGadmin
  • Figure 21. Result
  • Figure 22. Routes folder (Controller)
  • Figure 23. model folder (Model)
  • Figure 24. views folder (View)
  • Figure 25. How a Data Breach Occurs
  • Figure 26. Reasons for Data Loss
  • Figure 27. Denial Of Service Attack

Chapter 1 - Introduction:

In the last paper, we discussed some fundamental concepts of cloud computing. In here , we will create a web application in the cloud based on the approach I offered in my previous report. There is a Nodejs web application that uses PostgreSQL as a database. These projects will be deployed to the internet using Heroku.

Chapter 2 - Configure a Cloud Computing platform with a cloud service provider

(P5)

1. Tools:

A. IDE:

Visual Studio Code: In layman's terms, Visual Studio Code is a code editor. Visual Studio Code is a "free editor that lets programmers write code, debug it, and repair it using the intelli-sense approach." In layman's words, it makes it easier for people to develop code. Many people believe it is half an IDE and half an editor, but the decision is entirely up to the developers. Any program or software we see or use is based on code that runs in the background. Traditionally, coding was done in traditional editors or even simple editors like notepad! These editors used to give rudimentary assistance to developers. Some of them were so primitive that building basic English level applications in them was quite tough. As time passed, some programming languages required a specialized structure and support for future coding and development, which these editors did not provide. One of the various types of editors that have emerged is VI Editor, often known as Sublime Text Editor. VISUAL STUDIO CODE is the most popular and supports practically every coding language. Its capabilities allow the user to customize the editor according on his needs, which means he may download libraries from the internet and combine them with the code as needed. The reasons why I choose Visual Studio Code for developing website:

But PostgreSQL is free on Heroku And PostgreSQL bring benefit to user when using it, PostgreSQL comes with many features aimed to help developers build applications, administrators to protect data integrity and build fault-tolerant environments, and help you manage your data no matter how big or small the dataset. In addition to being free and open source, PostgreSQL is highly extensible. For example, you can define your own data types, build out custom functions, even write code from different programming languages without recompiling your database!

C. Framework: I plan to utilize the express framework in this project. Express is a Node.js web application framework with a small yet robust feature set for online and mobile apps. Creating a strong API is quick and straightforward with a plethora of HTTP utility methods and middleware building at your disposal. Express delivers a robust set of fundamental web application functionality while without obscuring the Node.js features you already know and appreciate.

2. Step by step of deploying website to Heroku

A. Deploying website to Heroku: Step 1: Create repository on Github Figure 2. Create repository Figure 1. Express framework

Figure 5. Result Step 3: Go to Heroku, click create new app Figure 6. Create new app on Heroku Step 4: Create new application with the name ‘node-js-heroku-app’

Figure 7. Choose name for app Step 5: Connect Heroku with repository NodeJSApp on Github Figure 8. Connect Heroku with repository on Github

Figure 11. Result Step 7: Click view to go to the website Figure 12. View website on Heroku platform This is the interface after deploying the website to heroku

Figure 13. Result Figure 14. Result Figure 15. Result

Figure 18. Connect PGadmin with Heroku Postgre Figure 19. Connect PGadmin with Heroku Postgre Step 4 : Create table and add data to table

Figure 20. Create table in PGadmin Step 5 : Run data clip to check if the Heroku database connected to the Postgresql database Figure 21. Result

Chapter 3 - Implement a cloud platform using open-source tools (P6)

1. Code implementation:

I applied the MVC model for my project:

  • Controller: The class ‘ user.js ’ (inside the folder routes )is the controller for user s, this mean this class is responsible for processing the logic of the project

user: 'ktddxpmlrknzvh', host: 'ec2- 52 - 73 - 184 - 24.compute-1.amazonaws.com', database: 'deskkttup45o07', password: 'fbd9b1c6f8667bd44adf85f66528cf9e71b18b1b335f37d29b185b44d27fa377', port: 5432 , ssl:{ rejectUnauthorized: false } }) module. exports = pg_connection B. Authentication: This is code for the ‘Authenticated’ function in the class users.js, this part of code is a logic of this function, because it is in charge of authenticating which user login in. Firstly, we create the variable ‘uname’, and ‘passwd’ to receive the data from the request of user. Then we call the function ‘authen’ (from the authenticated.js class) then assigning the ‘uname’ and ‘passwd’ to this function, this ‘authen’ function have the key word ‘await’, it means ‘authenticated’ function will be left by the function containing the key word ‘async’ in order to do the next stuff, then the function containing ‘authen’ function will call the function ‘getTable’ (used for get table from the class ‘tableDisplay.js’ with the ‘await’ keyword and set it equal to the variable tableString. Finally the function will render the user.ejs class by transferring the data to that class for displaying if the function ‘authen’ returns true, by contrast, will return the message ‘wrong username and password, please enter again’ to force user enter again. var authen = require('../model/authenticated') var getTable = require('../model/tableDisplay') router.post('/', async function( req, res, next) { var uname = req.body.username var passwd = req.body.password var auth = await authen(uname, passwd) if (auth==true){ var tableString = await getTable(uname) // console.log(tableString.rows[0].role) res.render('user.ejs', { message: 'Login successfully', table: tableString })

}else{ res.render('login', {message: 'wrong username and password, please enter again'}) } }); Class tableDisplay.js is in charge of displaying the information of products depending on which user log in such as Boss, he/she can keep track of the data of all products but all shop in the company only reading the product data that they have from the database. const pg_connection = require('./pg-config'); async function getTable ( user){ const acc_query = { text: 'select role from users where username = $1', values: [ user] } console.log( user) var query_data = await pg_connection.query(acc_query) var role = query_data.rows[ 0 ].role; let table_query = {} if(role == 'boss'){ table_query = { text: 'select * from products' } }else{ table_query = { text: 'select * from products where shop = $1', values: [role] } } query_data = await pg_connection.query(table_query) var dataTable = query_data.rows var stringTable = "

" var headerData = Object.keys(dataTable[ 0 ]) for(let headerIndex in headerData){ var header = "" stringTable+=header } stringTable += "";

" + headerData[headerIndex] + " Delete