How to create AWS EC2 Instance and set up Jenkins.

Part 1. DevOps Zero To Hero.

Chiemela Umeh
4 min readOct 10, 2023

Introduction

This article is the first of ten guides that will demonstrate how to use Jenkins as a CI/CD tool to test, build, deploy, and monitor a simple JavaScript application. My goal is to also give readers an idea of working with microservices. To achieve this, I have split the application into two smaller parts; A React web app and a node.js server. While we are only scratching the surface Of DevOps, this guide covers the fundamentals of CI/CD and how it may be implemented. In subsequent publications, we will master principles like automation, shift left, Infrastructure as a Code (Iac), containerization, and orchestration.

What is CI/CD? And why should we practice it?

Continuous integration is a DevOps practice that frequently merges new code changes into a central repository to undergo necessary tests and production builds that will ensure stability. This way, we can find bugs quicker, and deliver products into market place sooner.

Continuous delivery is an extension of the foundation laid by CI. It automates the manual steps needed to release a build of your software to production.

Benefits of CI/CD:

  • Deliver products into market place sooner
  • Automate the Software Release Process
  • Find bugs early in the software development stage
  • Improve Developer Productivity
  • It reduces handoff between teams which mitigates human error

Prerequisites

Task A— Create an AWS EC2 instance

EC2 is simply a virtual server that represents a physical server for you to deploy your applications. It offers businesses the ability to run applications on the public cloud.

1. After creating an AWS account, search for “EC2” and click “Launch instance”.

2. You will be greeted by this page. Here you will choose the specifications for your EC2 server.

3. Name and tags. Type a tag name for your EC2 instance. Your name will be “Jenkins1”

4. Application and OS Image. Choose Ubuntu. Ubuntu is linux distribution and the operating system our server will run on.

5. Amazon Machine Image (AMI). For this tutorial will Ubuntu Server 22.04 LTS. This may be change based on needs of the applications that will run on an EC2 instance.

6. Instance type. Go with t2.medium

7. Choose an existing key pair or create one. (Avoid spaces in key pair names). Download the key pair to your local machine. You will need this key pair to connect to your EC2. I recommend choosing a simple key par name like “myJenkins1Key”

8. Under network settings, we will open port 8080. This is where jenkins UI will run by default. Click “Edit”, scroll down and click “Add security group”. Add port range as 8080 and select Anywhere as Source Type. This should enter 0.0.0.0/0 as Source.

9. Configure Storage. Enter 32GB as root volume

10. Launch instance to initialize your new Ec2 server.

That’s it! These steps will create a new server on AWS cloud. In the next article, we will connect to, and setup Jenkins on the EC2 Ubuntu instance.

The Github repos for the application can be found here and here. Feel free to fork and clone them.

Prerequisites for step 2

If you found this post helpful, please like, share, and follow me.

Thank you for reading and for your support!

Note: EC2 instance and EC2 server may be used interchangeably.

--

--