Soal Uji Coba LKS Provinsi Jatim

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

SOAL UJI COBA

CLOUD COMPUTING
LKS PROVINSI JAWA TIMUR
Description Project (1 Hours)
Modul Name: IoT Project

Monitoring temperature and humidity


using the Internet of Things (IoT) has
become an increasingly popular
topic in recent years. IoT provides
the ability to connect various devices
and sensors that can be used to
monitor our surrounding
environment.

We designed and implemented a


temperature and humidity monitoring
system in this project using IoT. The
system uses a temperature and
humidity sensor to measure
environmental conditions, then
sends the data to the server via a Wi-
Fi network.
This temperature and humidity data
can be accessed through a web
application that can be accessed
from anywhere so that users can
monitor environmental conditions
remotely. The web application
displays the temperature and
humidity data in graphical form,
allowing users to see changes in
environmental conditions over time.

In addition, the system is also


equipped with a notification feature,
which will send a message to the
user via email or text message if the
temperature or humidity exceeds a
predetermined limit.

By using IoT technology to monitor


temperature and humidity, we can
ensure that the environment around
us is always in optimal condition and
act if there are any undesirable
changes.

The goal of this project is to


determine how to device connect to
MQTT Broker and Show the log
using node.js.
Task
1. Read the documentation
thoroughly (Outlined below).
2. Please view and understand the
architecture section.
3. Log in to AWS Console
4. Set up a security group. You can
read the additional security rules in
Security – Service Configuration
5. Set up your MQTT broker server;
you can read MQTT Broker
Configuration details.
6. Set up your Log MQTT Server;
you can read Log Server
Configuration details.
7. Set up your database; you can
read Database Configuration
details.
8. Setup your Auto Scaling and Load
Balancer from Launch Template;
you can read Auto Scaling and
Load Balancer details.
9. Set up your sensor and ESP32;
you can read Internet of Things
(IoT) Configuration details.
10. Test your MQTT Broker from
the ESP32 and DHT22 sensor and
Log Server.
Technical Details
1. The IoT project can connect to the
MQTT broker.
2. The Log Web Chart apps are
deployed as JavaScript
applications.
3. The MQTT and Log server must
be deployed in the t3.micro
instance type, and you can’t
access the remote server port
SSH, Session Manager, and other
consoles. If your remote server
uses port SSH, Session Manager
and other consoles will be grounds
for disqualification.
4. You should be prepared for 1000
concurrent requests to the
Application Log.
5. Public load balancer must contain
a dual-stack (IPV4 and IPV6) for
availability zone subnet using the
internet-facing for MQTT Broker
and Log Server.
6. While you create an MQTT Broker
and Log Server service for Auto
Scaling, you must use the launch
template and user data; if the
configuration does not follow the
instructions, you will lose the point.
7. The Log Application requires a
connection to the MySQL
database. As with the previous
deployment, you can set up the
database and a file storage
directory on each instance that has
the application deployed. However,
that will be far less efficient than
creating a centralized solution. The
more efficiently you run the
infrastructure, the faster your
servers will respond to requests
and the more points you earn. You
can read service instructions in the
Service Detail section.
8. Following the security service
details section, you should create a
different security group.
9. IoT devices (ESP32 and DHT22)
must be connected to MQTT
Broker and Log Server.
10. Remember to label every
service you have created, like
VPC, security group, EC2
Instance, and everything else you
have made except those created
automatically like an instance
created automatically by auto-
scaling. The more attention to the
little things, the more point you will
earn.
11. Remember to fill in each
description and tag of the services.
12. You must set the region using
Ohio.
13. The base OS chosen is
Amazon Linux 2
(https://aws.amazon.com/amazon-
linux-ami/). This distribution was
selected for its broad industry
support, availability of support, and
excellent integration with AWS.
Architecture
Security Configuration
Security is essential and should be
kept from being passed down while
building infrastructure. You must
include security planning on your
infrastructure. The admission apps
have sensitive data such as student
personal data, so you must create a
security group. You can follow the
security rules below to secure the
app data.
 You should create a security
group that only allows TCP ports
1883, 8883, 8080, and 8083 to
access public devices. The
security group doesn’t allow
anyone to access other ports from
outside.
 You should create a security
group that only allows TCP ports
1883 to public load balancer. The
security group doesn’t allow
anyone to access other ports from
outside.
 You should create a security
group that only allows TCP ports
80 and 443 to be accessed from
outside and doesn’t allow anyone
to access other ports from
outside. This security group will
be used for public load balancers.
 You should create a security
group that only allows TCP port
3500 can be accessed by public
Log Server and doesn’t allow
anyone to access other ports from
outside.
 You should create a security
group that only allows TCP port
2049 for EFS can be accessed
from MQTT Broker Server and
Log Server and doesn’t allow
anyone to access other ports from
outside.
 You should create a security
group that only allows the public
to access TCP port 3306 for the
Database and doesn’t allow
anyone to access other ports from
outside.

MQTT Broker Server


MQTT uses a publisher-subscriber
architecture, where a publisher is a
device that sends messages, and a
subscriber is a device that receives
messages. When a message is sent,
devices that subscribe to the same
topic will receive the message. In this
case, the MQTT used is mosquitto.

sudo amazon-linux-extras install epel


sudo yum install -y mosquitto

You can configure mosquitto in the


epel feature on Amazon Linux 2.
MQTT cannot be accessed by users
who do not have an account or are
anonymous. Therefore, you must
configure to disable the anonymous
feature in the
/etc/mosquitto/mosquitto.conf file,
input the command
allow_anonymous false pada file
mosquitto.conf and must create a
user and password for MQTT
access. The command to create a
user and password is as follows:

sudo mkdir -p /etc/mosquito/passwd


sudo mosquitto_passwd -b /etc/mosquitto/passwd handi handi122

Next, please test the MQTT


configuration using the MQTTX
software, if successful, you will be
able to see a successful notification.
Log MQTT Application Server
The Log MQTT Server was
developed with JavaScript with one
service running in it.
Both services were developed with
JavaScript and running with node.js
for the runtime. Firstly, you need
node.js and NPM packages installed
on your system. You can follow this
LKS documentation for node.js
installation, or you can use AWS
documentation installation in AWS
Docs; for LKS documentation, you
can follow the below.
First, you must enable the node.js
sudo yum install -y gcc-c++ make
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -

yum repository in your system


provided by the Node.js official
website. You also need development
tools to build native add-ons to be
installed on your system.
NPM will also be installed with
node.js. If you have done with the
repository, next you can run yum
install -y nodejs command, which will
also install many other dependent
packages on your system. Before
you clone a log application, you must
install git, and the command is yum
install -y git, and they should clone a
log application source code from:
https://github.com/handipradana/ujic
obalksprov.git
The log application service was
developed with node.js. This log
application requires all the
dependencies in package.json. You
must deploy a backend service, use
service user data, and don't use SSH
or remote service. You can follow the
instructions below for the details.
1. You should install all
dependencies with the command
npm install.

NODE_ENV=production
MQTT_BROKER=mqtt://your_broker_mqtt
MQTT_PORT=1883
MQTT_USERNAME=YOUR_USERNAME_MQTT
MQTT_PASSWORD=YOUR_PASSWORD_MQTT
LOG_PATH=YOUR_LOG_FOLDER_LOCATION
CACHE_PATH=YOUR_CACHE_PATH_FILE_LOCATION_STORE

2. Create a .env file in the log


application folder
3. Run the program using command
npm run prod.

File Storage
A central file storage location is NOT
a requirement for the application to

CACHE_PATH=YOUR_CACHE_PATH_FILE_LOCATION_STORE
LOG_PATH=YOUR_LOG_FOLDER_LOCATION
operate. The application will serve
some requests faster with a
centralized file storage solution. As
with the previous service example,
you could create a centralized file
storage solution with Elastic File
Storage to store logs and cache files
from the application. You can use a
local directory to save the log files,
but a shared storage solution or the
ability to share files to each instance
will allow you to have a centralized
log file, which will make the
maintenance process easier. You
must set the EFS multiple AZ, and
the file cache needs a central file
storage solution for consistent data.
The relevant environment variable in
the ".env" configuration file is below:
CACHE_PATH is the local directory
for file cache on the instance where
the server application can both read
and write to the cache files. This can
be a local directory on the server, or
a remote directory mounted as a
local directory on the server. If you
do not set the cache environment
path, the default path storage will
store in
<your_apps_path>/server/tmp.
LOG_PATH is the local directory for
storing application logs on the
instance where the server
application can both read and write
to the cache files. This can be a local
directory on the server or a remote
directory mounted as a local
directory on the server. If you do not
set the cache environment path, the
default log storage will store
<your_apps_path>/server/logs.
DATABASE
The application must use a reliable
Relational Database Service (RDS)
with a serverless V2 concept with
Aurora MySQL 3.0.2 (compatible
with MySQL 8.0.23). The template
type used is Dev/Test. The database
name is log_mqtt, the username is
admin, and the password is
lks2023!@. Use serverless instance
configuration. Increase the database
unit capacity automatically according
to the database load demand.
Ensure that the maximum unit
capacity is no more than 16 GiB
RAM to save costs. Connectivity
using Dual-stack mode. Once your
serverless is provisioned, you must
create the necessary tables to serve
the requests, the name of table is
tbl_data. You can use the table
definition below using query or
HeidiSQL software and create fields
as follows:
topic VARCHAR(50), NULL
message VARCHAR(50), NULL
Once complete, you must set the
DB_HOST=YOUR_MYSQL_HOST
DB_USER=YOUR_MYSQL_USERNAME
DB_PASSWORD=YOUR_MYSQL_PASSWORD
DB_NAME=YOUR_MYSQL_DATABASE_NAME

database environment to each


server via the ".env" files deployed to
each instance.

INTERNET OF THINGS(IOT)

Connect the DHT22 sensor to the


ESP32's GPIO pin, for example to
pin 15.
Begin to program the ESP32 and
DHT22, and the program code can
be accessed at the following
address:
https://github.com/handipradana/ujic
obalksprov.git.
Configure the program in the
previous link, and replace the one
marked with XXX, adjust the
username, password, MQTT broker
link conditions with the one that was
previously made.
If there is no problem with the
program, after uploading, the data
will be visible on the serial monitor as
follows: If the program has been
uploaded, make sure the ESP32 is
connected to its network and
connected to MQTT as follows:
APPLICATION TESTING

You might also like