You are on page 1of 16

SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.

RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

8. Create Server Oriented Instance with 2GB Ram & 200GB HDD & Configure MariaDB
Relational Database System to test run DDL & DML mysql commands.

Procedure:

1. Create a Server Instance: Create a new virtual server Ec2 instance with the
following specifications: Name: dbserver-1

• 2GB of RAM

• 200GB HDD

2. Select an Operating System (AMI ): Choose a Linux distribution (e.g., Ubuntu,


CentOS) as the operating system suitable for DB server.

3. Select an Instance type : Choose t2.micro (Free-tier) 1VCPU system .

4. Configure Key pair : Choose PEM | PPK keys credentials suitable for VM server
login.

5. Configure Network & Firewall : Choose VPC Network & Subnet(S1) & Public IP &
Essential ports

SSH (22) | HTTP (80) | HTTPS(443) | MYSQL(1433) | MYSQL/AURORA DB


(3306)

6. Launch VM & Connect to Your Server: Login to Instance (Ec2) server using SSH
(Putty) .

7. Run List of Linux commands

▪ sudo apt update


▪ sudo apt install mysql-server –y
▪ sudo systemctl status mysql
▪ sudo mysql
SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

▪ alter user 'root'@'localhost' identified with mysql_native_password by


'admin123';
▪ flush privileges;
▪ create database mbu;
▪ show databases;
▪ use mbu;
▪ show tables;
▪ create table table1 (id int, name varchar(45));
▪ show tables;
▪ insert into student values(1, 'nikhil'), (2, 'teja'), (3, 'jeevan'), (4, 'ram');
▪ select * from student;

Note:- use “clear” stmt whenever it is required .


SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

Result :-
SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

9. Create an Lambda function to implement automation task for Ec2 Instance Start or
Stop Service & monitor service working functionality using AWS Cloudwatch .

Procedure:

1. Create a Server Instance: Create a new virtual server Ec2 instance with the
following specifications: Name: dbserver-1

• 2GB of RAM
• 200GB HDD
2. Select an Operating System (AMI ): Choose a Linux distribution (e.g., Amazon Linux
,Ubuntu, CentOS,Windows) as the operating system suitable for DB server.
3. Select an Instance type : Choose t2.micro (Free-tier) 1VCPU system .

4. Configure Key pair : Choose PEM | PPK keys credentials suitable for VM server
login.

5. Configure Network & Firewall : Choose VPC Network & Subnet(S1) & Public IP &
Essential ports

SSH (22) | HTTP (80) | HTTPS(443) .

6. Launch VM & Set Tag & value : “ Tag : ENV” | “Value:Test”


SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

7. Create Lambda function with a function name (Ec2_startstop) & set author from
scratch.

8. Configure the Function Runtime: Select the runtime for your function. Common
runtimes include Python 3.11v. make sure the runtime that matches your code.

import json
import boto3

def lambda_handler(event, context):


# TODO implement
ec2_connection=boto3.resource(service_name="ec2",region_name="ap-southeast-
1")
filter_ec2={"Name":"tag:Env","Values":["Test"]}
for each in ec2_connection.instances.filter(Filters=[filter_ec2]):
print(each.id)
each.stop()

return {
'statusCode': 200,
'body': json.dumps('Ec2 Instance Succesfully stoped')
}

Note:- change Ec2 Tag values & Region values as per working .

9. Execution role: Create a new role with basic Lambda permissions(Ec2FullAcess).


This role defines Lambda function can access & execute automation script based on
Ec2 service.

Note:- Attach Ec2FullAcess policy to Role which was created in IAM Service.

10.Configure an Lambda Time slot for max execution time (15:00 Min).

11.Create an Test Event & Deploy code to run lambda function.


SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

12.Check the status of working of Ec2 Instance, As resultant Ec2 which have Tag value
as (ENV : Test) are shutting down immedetly as lambda code is deployed & did test
run.

13.Create an cloudwatch Service & fetch to Log Stream to acces the automation work
log records .

Note:- After Deploy code then Run the test Server so that Ec2 will automatically stopped
by Lambda

Result:-
SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

10. Implement ELB- Elastic Load Balancer under any two regions compute service & Test
traffic load factor in live working condition.

Procedure:

1. Create a VPC with two subnets & configure Internet Gateway & Route Table

• South subnet1 ( 1a-zone)

• North subnet2 (1b-zone)

2. Launch Ec2 with essentials in South & North Subnets as specified zones.

SOUTH VM NORTHVM

Ec2 Essentials :
SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

Ec2 Name | AMI(Linux2) | Instance type (t2.micro) | Keypair | Firewall Ports


(22,80,443) | EBS(8GB)

Run WEBSERVER with LINUX (Auto script) in each EC2 Instance

#!/bin/bash

dnf install -y httpd

systemctl enable httpd

systemctl start httpd

cd /var/www/html/

echo "South Server-1" > index.html (or) echo "North Server-1" > index.html

3. Create Load Balancer (ELB) with existing Sou6th & North Ec2

4. ELB – Name need to be specified (Ex:- FLipkart) & choose Public (Internet Facing)
SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

5. Select VPC & Zones

6. Select Security Groups

7. Set Health check (2sec/5 cycles )


SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

8. ADD Instances

9. Run Global ELB DNS in browser to verify load

10.Load Distribution output

DNS link (A Record)

http://flipkart-424524021.ap-
southeast-1.elb.amazonaws.com/
SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

Note:- As trafiic go high load will be distributed across two zones (South & North)

If any server go crash other server will pick same website

Result:-
SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

11. Create an Auto scaling service policy to scale up & scale down web servers, when
traffic is high or server crash conditions.

Procedure:

1. Create Launch Template with Ec2 Essentials

Ec2 Name | AMI(Linux2) | Instance type (t2.micro) | Keypair | Firewall Ports


(22,80,443) | EBS(8GB)

Run WEBSERVER with LINUX (Auto script) in each EC2 Instance


#!/bin/bash
dnf install -y httpd
systemctl enable httpd
systemctl start httpd
cd /var/www/html/
echo "South Server-1" > index.html (or) echo "North Server-1" > index.html

2. Create Auto Scaling Group Policy


SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

3. Select VPC & Zones

4. Attach Load Balancer (Reference 10 experiment)


SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

5. Configure Group Policy like how many Ec2 are required


SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

6. Scaling policy for CUP BURST TIMEOUT

IF (CPU >=50% + 1 Ec2)

7. Create all resources inline to Auto Scaling Policy


SREE VIDYANIKETHAN ENGINEERING COLLEGE SREE SAINATH NAGAR,A.RANGAMPET

NAME OF THE EXPERIMENT


Roll Number : Page No :

8. Inline to Policy Below Ec2 are automatically launching

Activity Report For Those Newly Launched Ec2 Vms

RESULT :-

You might also like