Skip to content

IRevolutionize your AWS environment with our DevOps CI/CD project. Streamline workflows, automate deployments, and enhance collaboration for seamless development. Experience efficiency and scalability in the cloud with cutting-edge DevOps practices on AWS.

Notifications You must be signed in to change notification settings

darjidhruv26/AWS_CICD_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project :)

Implimented DevOps CI/CD pipeline using AWS Services

  • CodeCommit
  • CodeBuild
  • CodeDeploy
  • CodePipeline
  • Identity and Access Management (IAM) for creating Service Role
  • S3 for artifact storing
  • EC2 for Deployment

Step 1: Simple Project Architecture

AWSDevOps_pro

Step 2: Create a Repository in AWS CodeCommit

  • After creating a repository on the next page you can see this warning.😟

WOrning aws

  • Go to IAM and create a User

  • User can not get permission to access AWS CodeCommit, So first gives permissions in IAM. (IAM -> Users -> Security credentials -> HTTPS Git credentials for CodeCommit -> Generate)

  • After this click on the Clone URL button.

gitURL clone

  • Also, Add permission to the User get to access this repo on Local. (IAM -> Users -> SelectUser -> Add permissions -> Attach policies directly -> 'AWSCodeCommitPowerUser')

  • After performing some GitHubActions and pushing all files in CodeCommit.

CodeCommit Code ss

  • Master is default branch.

CodeCommit Branchs ss

Step 3: Create Build Project

  • GO to IAM and create Service Role for CodeBuild Service Role ("Access Service-Service") (IAM -> Create Role -> AWS service -> Use case -> Create)

  • Create a buildSpec file.

   buildspec.yml
version: 0.2
phases:
  install:
    commands:
      - echo Installing NGINX
      - sudo apt-get update
      - sudo apt-get install nginx -y
  build:
    commands:
      - echo Build started on `data`
      - cp index.html /var/www/html/ 
  post_build:
    commands:
      - echo Configuring NGINX

artifacts:
  files:
    - '**/*'         
  • Push this buildspec.yml file in CodeCommi.
  • After you can Start to Build CodeBuild Project ss

Step 4: Build Artifact store in S3 Bucket

  • In the CodeBuild console Click on Edit button -> Artifacts -> Type:"S3" -> put Uplode Locetion. s3 artifect files ss

CodeBuild_history

Step 5: CodeDeploy Part

  • Create Application and Compute platform is EC2/On-premises
  • Create Deployment group
  • Create Service role (Give permissions -1.AmazonEC2FullAccess 2.AmazonEC2RoleforAWSCodeDeploy 3. AmazonS3FullAccess 4.AWSCodeDeployeFullAccess 5.AWSCodeDeployRole 6.AmazonEC2RoleforAWSCodeDeployLimitaccesstoS3)
  • Deployment type - In-place
  • Environment configuration - Amazon EC2 instances

Step 6: Create EC2 instance for deployment

  • Click Launch Instances
  • Ubuntu t2.micro
  • Connect to the server and run this command to convert it into a Root user
sudo su
  • First of all select instance -> Actios -> Security -> Modify IAM role -> select relevant role

  • After running this script for setup deployingAgent on the EC2 instance

  • Make sure your Rigeon and Script regions same.(6th line in this script)

#!/bin/bash 
# This installs the CodeDeploy agent and its prerequisites on Ubuntu 22.04.  
sudo apt-get update
sudo apt-get install ruby-full ruby-webrick wget -y
cd /tmp
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/releases/codedeploy-agent_1.3.2-1902_all.deb
mkdir codedeploy-agent_1.3.2-1902_ubuntu22
dpkg-deb -R codedeploy-agent_1.3.2-1902_all.deb codedeploy-agent_1.3.2-1902_ubuntu22
sed 's/Depends:.*/Depends:ruby3.0/' -i ./codedeploy-agent_1.3.2-1902_ubuntu22/DEBIAN/control
dpkg-deb -b codedeploy-agent_1.3.2-1902_ubuntu22/
sudo dpkg -i codedeploy-agent_1.3.2-1902_ubuntu22.deb
systemctl list-units --type=service | grep codedeploy
sudo service codedeploy-agent status

EC2 ss

  • Create appspec.yml for App configuretion
   appspec.yml
version: 0.0
os: linux
files:
  - source: /
    destination: /var/www/html
hooks:
  AfterInstall:
    - location: scripts/install_nginx.sh
      timeout: 300
      runas: root
  ApplicationStart:
    - location: scripts/start_nginx.sh
      timeout: 300
      runas: root    
  • And Also create scripts folder

  • In scripts folder create two files

    1. install_nginx.sh
    #!/bin/bash
    
    sudo apt-get update
    sudo apt-get install -y nginx
    1. start_nginx.sh
    #!/bin/bash
    
    sudo service nginx start
  • Push this file on CodeCommit

  • After Deployment group is create then Create deployment.

CodeDeploy output ss

Step 7: Create Pipeline

  • Step 1: Choose pipeline setting -> PipelineName > Service role

  • Step 2: Add source stage -> CodeCommit > repoName > branchName > Select CodePipeline periodically for changes(For autometion)

  • Step 3: Add build stage -> BuildProvider > Region > ProjectName > Single build

  • Step 4: Add deploy stage -> DeployProvider > Region > AppName > Deployment group

  • Step 5: Review

    CodePipeline = Code->Commit->Build->Deploy

pipeline output

Step 8: Output.

OutPut SS

About

IRevolutionize your AWS environment with our DevOps CI/CD project. Streamline workflows, automate deployments, and enhance collaboration for seamless development. Experience efficiency and scalability in the cloud with cutting-edge DevOps practices on AWS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published