How to run Jenkins on AWS by example

Cloud computing provides plenty of options when it comes to integrating with a variety of network addressed services. As such, developers should consider the cloud as a smart place to install and run a CI/CD server.

Jenkins is one of the most popular, open source CI/CD servers on the market. AWS provides numerous options to host Java-based web applications. It should come as no surprise that many DevOps professionally choose to run Jenkins on AWS.

There are a variety of ways to run Jenkins on AWS. One option is to use a Docker container combined a Kubernetes cluster. Another is to install Jenkins on one of the many Windows and Linux distributions provided as Amazon Machine Images (AMIs). There are pros and cons associated with each of these options, but I’ve found that the easiest way to run Jenkins on AWS is to host and manage it on an EC2 virtual image.

If you agree with this option, the next step will be to determine if you want to install the software yourself, or if you want to pick from an image where the Jenkins stack is already configured.

The latter is far and away the easier option.

Bitnami Jenkins on AWS

Whenever I need to spin up an instance of Jenkins on AWS, I always use the preconfigured software stacks provided by Bitnami. New users need to register with Bitnami, select the Jenkins AMI stack and choose an AWS deployment. Within a few minutes, you can run a fully configured Jenkins server on AWS.

My estimate for this service was about $17.56 a month, and includes the use of a t2.small tier with 10 GB of solid state storage and 2 GB of memory.

Bitnami simplifies the setup and configuration for those who want to run Jenkins on AWS.

If developers want full configuration control over their CI/CD server, they can alternatively choose an EC2 image with the Windows or Linux distribution of their choice and follow the standard Jenkins installation steps.

This option will require a developer to install the JDK, set JAVA_HOME and then install Jenkins on the AWS hosted image.

Jenkins on AWS install steps

If developers want to use Jenkins on Ubuntu 20.04 instead, follow these commands to install Jenkins:

  1. sudo apt-get update
  2. sudo apt-get install openjdk-8-jdk
  3. wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
  4. sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
  5. sudo apt-get update
  6. sudo apt-get install jenkins
  7. sudo apt install gith

When these steps finish, you will have completed a Jenkins on AWS installation. A developer can point a web browser at port 8080 of the EC2 image’s public IP address and log on to Jenkins. The world of continuous integration with Jenkins on AWS will be at your fingertips.