How to Provision an AWS EC2 Instance with Terraform and Install Docker, Jenkins and SonarQube Using a Bash Script in 2 minutes

Oshaba SamsonOshaba Samson
1 min read

In this project we will use terraform in create ec2 instance then install docker, aws cli, terraform, jenkins and sonarqube using bash script

Prerequisite

  • AWS Account

  • Terraform

  • AWS Access and Secret Key

Objective

Create ec2 instance with terraform and

Install

  • Docker

  • Jenkins

  • Sonarqube

  • Aws CLI

Terraform is an open-source Infrastructure as Code (IaC) tool developed by HashiCorp that allows you to define, provision, and manage infrastructure resources in a cloud environment or on-premises in a consistent, repeatable manner. It enables you to automate the provisioning and management of infrastructure using configuration files that describe the desired state of the resources.

To install Terraform in your local machine

You can check out the terraform documentation to install in your preferred operating system

Install Terraform CLI on AWS - HashiCorp Tutorial

To install Jenkins and Sonarqube

  • Configure you access and secret key
aws configure

Enter your access and secret key then region and output

cd terraform-sonarqube-setup
  • initialize terraform
terrform init
  • View resources to be provisioned
terraform plan
  • Create resources
terraform apply --auto-approve
2
Subscribe to my newsletter

Read articles from Oshaba Samson directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Oshaba Samson
Oshaba Samson

I am a software developer with 5 years + experience. I have working on web apps ecommerce, e-learning, hrm web applications and many others