Skip to content

mohamedanwer006/iti-terrafrom-project

Repository files navigation

Provision AWS infrastructure using terraform and jenkins

infra Description

Using Jenkins pipeline to provision infrastructure. using Ansible to configure the bastion host and the application server as slave for jenkins to run on it a Node.js app that connects to RDS and ElastiCache Redis instances in private subnets

Deploying Jenkins Master

Run jenkins master as container on local machine

# build the custom image that contains ansible and docker client 
cd jenkins
docker build -t <imageName> -f jenkins_master.dockerfile .

# run the image
docker run --name <containerName> -p8080:8080 -d -v /var/run/docker.sock:/var/run/docker.sock  -v /usr/bin/terraform:/usr/bin/terraform <imageName>

Hit the jenkins master at http://localhost:8080/

Then, go to the Jenkins page and configure it as follows:

Infrastructure Pipeline

  • Add AWS credentials to Jenkins

  • Create a parameterized pipeline

alt

Build the infrastructure choose apply alt

Configure EC2 as Jenkins Slave

Goto "Manage Nodes and Clouds" => "New Node"

Private

Application Pipeline

Create a new pipeline for the application link

alt

Test application

open browser and type the ALB url

alt

alt

Clean up

Build the pipeline a gain and choose destroy

alt

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published