A step-by-step guide on how to do DevOps CI/CD using AWS, Jenkins and Docker.
Optional - Personalize Experience
This gives AWS an opportunity to provide tutorial suggestions and tailor the user experience to your specific role.
Select Create Template Designer
Click Create Template In Designer
Copy/Paste EC2 Template Copy Template From
https://raw.githubusercontent.com/subsari/snippets/master/aws/ec2-centos7-instance.yml
Click Valid Icon
This will validate the template and prompt you if there are any syntax errors.
Specify PUBLIC SSH Key
Click Next On Review Stack Options
View Stack Resources
Click the Refresh Icon on the right-hand side.
Do you know/recognize the 'Source' value? If not, then follow the link below before continuing.
Connect to EC2 Instance Using SSH & Private Key
Install Java, Install & Configure Jenkins
Install cURL
sudo yum install curl -y
Install GIT
- Connect to Instance
- Execute Yum Command
sudo yum install git -y
Install Docker
- Connect to Instance
- Execute Docker Install Command
sudo yum install docker -y
Enable Docker
sudo systemctl enable docker
Start Docker
sudo systemctl start docker
Specify Pipeline Details
- Check Prevent Concurrent Builds
- Specify To Build Every 5 Minutes
- Copy/Paste Pipeline Script From https://raw.githubusercontent.com/subsari/snippets/master/jenkins/pipeline-example.yml
Click 'Build Now' to Build Pipeline
Process Overview
- Code pushed to repository
- Webhook project triggered from code pushed
- Webhook project builds
- MyProjectPipeline builds (triggered after successful build of Webhook project)
MyProjectPipeline Builds
- Repository cloned to workspace
- Docker image is built
- Docker instance runs
- Unit & Integration tests run on Docker instance
- Environment is cleaned up (ie. remove Docker instance & workspace)
- Code promoted and deployed on successful testing