Launch an EC2 Instance

Launch an Elastic Compute Cloud (EC2) Instance

In this step, you will launch an EC2 instance and configure the User Data to install and launch the stress tool.

1.Log in to Amazon EC2 and click EC2 Dashboard, choose Launch instance like this picture.

2.In the Quick Start section, select the Amazon Linux AMI.

3.Scroll down, click Advanced details. In User data copy this

#!/bin/sh 
yum -y update
amazon-linux-extras install epel -y
yum install stress -y
stress -c 1 --backoff 300000000 -t 30m

The test script will run a workload generator tool stress designed to subject a system to a configurable measure of CPU. We configure stress to spawn 1 worker with a timeput of 300000000 microseconds or 5 mins for 30 minutes.

4.In Instance type choose t2.micro. In Key pair(login) choose Proceed without a key pair (Not recommended)

5.In Name and tags click Add additional tags. Write Name in key and in Value you can name yours in this format: “[Your Name] Server”. In this lab, we use KO Server

6.Click Launch instance in the box on the right side of the screen

7.Click View Instances button in the lower right-hand portion of the screen to view the list of EC2 instances. Once your instance has launched, you will see your server as well as the Availability Zone the instance is in.