0% found this document useful (0 votes)
27 views13 pages

w10,11,12 CND k4

Uploaded by

adepunetha5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views13 pages

w10,11,12 CND k4

Uploaded by

adepunetha5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

WEEK-10

Name B.Divya
A. Somanshu Dev
Roll No. 22R21A05L2
22R21A05K4
Year of Study III B.Tech I SEM CSE-D
Date 28/11/2024
PROBLEM STATEMENT: Implement continuous integration using AWS Codebuild
Steps to be followed:
Step 1: First log into the AWS console

Step 2: navigate to CodeBuild > BuildProjects

Step 3: Add a build name and description, and configure for Github

Step 4: Select your repository and specify a branch (in our case develop)
Step 5: Select which hooks you want Github to trigger

Step 6: Environment configuration

Step 7: You may need to add a specific variable for running the tests in CI mode

Step 8: Adding the build commands manually inline


Step 9: Modifying the build spec after the project has been built

Step 10: You require admin privileges to reach the settings of a github repo

Step 11: Then in the options select Require status checks to pass before merging, the new
AWS CodeBuild that we created should be there as option (the name we assigned it will bein brackets to
be sure we have the correct one). Tick the option.

Step 12: Successfully Started the Build:


WEEK-11
Name A. Somanshu Dev
B.Divya
Roll No. 22R21A05L2
22R21A05K4
Year of Study III B.Tech I SEM CSE-D
Date 04/12/2024
PROBLEM STATEMENT: Automate application deployment into EC2 using AWS Code Deploy.
Steps to be followed:
Step 1: First log into the AWS console

Step 2: Launch an EC2 instance, same as experiment 1.

Step 3: Install the required packages by running the command below


1. Update to the latest current version of package
sudo yum update -y

2. Install git and python 3


sudo yum install git -y
sudo yum install python3-pip python3-devel python3-setuptools -y

3. Install CodeDeploy Agent

sudo yum update


sudo yum install -y ruby
sudo yum install wget
wget https://aws-codedeploy-ap-southeast-1.s3.ap-southeast-1.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
sudo service codedeploy-agent start
4. Install CodeDeploy Agent
sudo yum update
sudo yum install -y ruby
sudo yum install wget
wget https://aws-codedeploy-ap-southeast-1.s3.ap-southeast-1.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
sudo service codedeploy-agent start

5. Install authbind and modify port 80 (for enabling production server to run app at port 80

without superuser privileges)


wget https://s3.amazonaws.com/aaronsilber/public/authbind-2.1.1-0.1.x86_64.rpm
sudo rpm -Uvh https://s3.amazonaws.com/aaronsilber/public/authbind-2.1.1-0.1.x86_64.rpm
sudo touch /etc/authbind/byport/80
sudo chmod 500 /etc/authbind/byport/80
sudo chown ec2-user /etc/authbind/byport/80

5. Clone GitHub Repository. (You may change to your own working GitHub repository)
git clone https://github.com/azzan-amin-97/FlaskAppCodeDeploy.git

Step 4: Configure AWS CodeDeploy Service


• Create an Application

Create the Deployment Group:


Step 5: Configure CodeDeploy AppSpec file:

We use EC2/On-Premises compute platform for our application. Therefore, in order to


make the deployment automation successful, the AppSpec file must be a YAML-
formatted file named appspec.yml and it must be placed in the root of our application
project’s source code directory.
In your root project directory, add appspec.yml . This is what our AppSpec file looks like.
version: 0.0
os: linux
files:
- source: .
destination: /home/ec2-user/app
hooks:
AfterInstall:
- location: scripts/install_app_dependencies
timeout: 300
runas: root
ApplicationStart:
- location: scripts/start_server
timeout: 300
runas: root

Add scripts folder in root directory and add these files below

install_app_dependencies (shell script)


#!/bin/bash
sudo pip3 install virtualenv
cd /home/ec2-user/app
virtualenv environment
source environment/bin/activate
sudo pip3 install -r requirements.txt

start_server (shell script)


#!/bin/bash
cd /home/ec2-user/app/
source environment/bin/activate
supervisord -c supervisord.conf
Step 6: Setting up GitHub Actions workflow pipeline

To create the CI/CD workflow in GitHub Actions, create a folder named


.github/workflows in our application root that will contain the GitHub actionworkflows.
You can use the code below in the terminal as the guide to achieving this process.
cd path/to/root_repo
mkdir .github/workflows
touch .github/workflows/workflow.yml

Step 7:Implementing the continuous integration and continuous deployment by


configuring AWS credentials to complete the deployment.

Step 8: Running the Complete Pipeline:

Step 9: Successfully created a working CI/CD pipeline for Amazon EC2 Deployment using
GitHub Actions and AWS CodeDeploy.
Name A.B.Divya
Somanshu Dev
Roll No. 22R21A05L2
22R21A05K4
Year of Study III B.Tech I SEM CSE-D
Date 04/12/2024
WEEK-12
PROBLEM STATEMENT: Implement CI/CD using AWS Code pipeline that automates the build, test,
anddeployment phases

Steps to be followed:

Step 1: Create an S3 bucket and allow public access to it

Step 2: Go to AWS console and create a new codepipeline as below:

Enter the pipeline name and the role name. Click next to move to next screen.

Step 3: Link your github repository with the codepipeline. Select the Github version 2
and click on the button “Connect to github”. Here, a new popup will open where you will
be entering your github credentials. After successfully logging into github, you will select
the repository and branch name. Then click next to move to the next stage.
Step 4: On the build stage, select “AWS Codebuild” as your build provider. However,
you can select any other build provider as well. Then click on “Create Project” to create a
new build project. Specify the OS, runtime, service role, environment image, and image
version on this screen. After specifying this detail, click “Continue to pipeline”.

Step 5: The next stage is the deploy stage. Here you will mention Amazon S3 as deploy
provider because the build will be deployed to S3 bucket. You will select the S3 bucket
for build deployment. S3 bucket allows static web hosting, so the build will be deployed
to S3, and the project will be accessible from S3 URL.
Step 6: Click “Next” And then click “Create pipeline”.

Step 7: Now, your pipeline is created. Next, select CodeCommit for source provider
(or Github if you are using it, for this, you have to log in to Github) and select the
repository and branch to configure for CI/CD.
Step 8: Next, for the build provider select CodeBuild and create a new build project,
give it a name and configure it as follows
Step 9: Search for ECR and select the policy as below and click Attach policy

For Deploy provider, select Amazon ECS, cluster, and service name. Also, add the
name of the image definitions file as ‘images.json’ that we will create during the
build process

• Click Next, Review it and click Create pipeline


• Once Pipeline is created successfully, it will launch a new container as a
Service

Step 10: Test the complete Pipeline by changing the source code
andpushing the changes to the Code commit repository.
Once the changes are pushed, CodePipeline will trigger the
CI/CD process and createsa new deployment of the AWS Fargate
Service with the new image build

To verify our changes are made and deployed successfully, visit the DNS
name in thebrowser

You might also like