0% found this document useful (0 votes)
34 views37 pages

Activity - Create A CD Pipeline

Uploaded by

lojoyag882
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)
34 views37 pages

Activity - Create A CD Pipeline

Uploaded by

lojoyag882
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/ 37

Create a DevOps Pipeline

SWEN 514/614: Engineering Cloud Software Systems

Department of Software Engineering


Rochester Institute of Technology
Overview 2
u In this activity, you create a Continuous Deployment pipeline that deploys a
live sample web application
u This will use AWS CodePipeline to deploy code from your Github account to
an Elastic Beanstalk NodeJS application
u Below is an illustration of the process

u There are 2 deliverables for this activity, which is worth 2 points


Create an app in Elastic Beanstalk 3

u Go to the AWS console and select “Elastic Beanstalk”

u Select the “Create Application” button


Create an app in Elastic Beanstalk 4

u Under “Application information”


enter a name for “Application
name”
u Under “Platform” select Node.js
and keep all the defaults
u Click “Next”
Create an app in Elastic Beanstalk 5
u Under “Service role”, select “Create
and use new service role”
u Note: If you need to run this step again,
the service role will be available so
select “Use an existing service role” the
next time since the role already is
avialable
u Under “EC2 key pair”, select your key
pair
u Under EC2 instance profile, we need
to create an IAM instance profile that
will allow EC2 to communicate with
other AWS services
u Click the “View permission details”
button
Create an app in Elastic Beanstalk 6

u We need to create a new instance profile to attach to the EC2 instance


u To do this, click the “IAM console”
IAM Dashboard 7

u On the IAM Dashboard, we are going to create a new instance profile


(role)
u Click the “Roles” on the left
Create IAM Role 8
u Select “Create role”

u On the next screen, select “EC2” under ”Use case” and click “Next”
Create IAM Role 9
u In the search box, enter “AWSElasticBeanstalk” and hit Enter
u A subset of permissions is returned
u Select the top 3 permissions (see below)

u Click “Next”
Create IAM Role 10
u Give your role a name and click “Create role”
Create IAM Role 11
u Verify your role is created and go back the the tab where you were
configuring your Beanstalk app
Create an app in Elastic Beanstalk 12

u Your new instance profile should


now be avialble under “EC2
instance profile”
u Select it and click “Skip to
review”
u On the Review screen, click
“Submit” to create your new
application
Create an app in Elastic Beanstalk 13

u Your app is now being created and will take about 3-5 minutes
u Note the steps in “Events” are from a CloudFormation script that’s
creating the application
u Feel free to check CloudFormation as it will show several more steps

CloudFormation
steps
Create an app in Elastic Beanstalk 14

u When completed, you should


see a success message
Click here
u Click the link under “Domain”

u Note: If Beanstalk is taking longer than 5 minutes,


do the following:
u Go to CloudFormation and delete the Stack
u Start over on slide #4
Create an app in Elastic Beanstalk 15

u The sample application has been deployed and is running

u Next, we will connect a source code repository (Github) to the application


u When the repository is modified, this will trigger the application to redeploy
Download source files 16

u The source for the sample app (nodejs.zip) can be found under
Assignments > Activity #14 - Create a DevOps Pipeline
u Download this file to your PC and unzip

u Next, go to Github to create a new repo


Create a Repo 17

u Create a new repo in Github u Follow the instructions to import the sample app to your
and click “Create repository” repo

See example
on next slide
Create a Repo (example) 18
u Here is an example of pushing the files to Github u When complete, verify your repo has the
following the steps from the previous slide files below
Create your Pipeline 19

u Go to the AWS console and select “CodePipeline”


u Click the “Create pipeline” button
Create your Pipeline 20

u Enter name for “Pipeline


name”
u Click “Next”
Pipeline Source 21

u Under “Source Provider”, Select “Github


(Version 2)”
u Click the “Connect to Github” to link
your AWS account to your Github
account
u This is a multi-step process but only needs
to be done once
Connect Pipeline to Github 22

#1 - To connect to Github, provide your #3 - Click “Install a new app”


Github ID and click “Connect to Github”

#2 - Click the “Authorize AWS Connector for


Github”
Connect Pipeline to Github 23
#1- Select your Github #2 - Select “Only select #3 - Click “Connect” to connect
account repositories” and select the AWS to your Github account
repo you just created. Click
“Install”
Pipeline Source 24

u Pipeline is now connected to Github


u Select the repo you previously
created
u Select the “main” branch to trigger a
deploy
u Your screen should look similar to the
right
u Click “Next”
Build Stage 25

u Click the “Skip build stage” and confirm by clicking “Skip”


Deploy Stage 26

u Under “Deploy provider” Select


“AWS Elastic Beanstalk”
u Under “Application name”
select the application you
previously created
u Under “Environment name”
select the environment that
was previously created
u Click “Next”
Create your Pipeline 27

u Click the “Create pipeline”


Build and Deploy 28

u This will start the Build and Deploy process

This gets automatically triggered every


time you modify the code in Github
and commit to the master

Once the source has been


Click here when detected, the deploy process will
Deploy has
Succeeded
deploy the updated code to your
Node application
Create your Pipeline 29

u Click the link for your web application

u On the Dashboard, click the URL


Test your Web Application 30
u The sample application (from Github) has been deployed and is running

u Congratulations, but you are not done yet


u Now we must make a change to trigger the pipeline to update
Modify your code and commit 31
u Next, make a change in code
u You can either do this on your PC or directly in GitHub
u In the index.html, add your RIT ID in the title after ”Congratulations”

u Either push your change (from your PC) or click “Commit changes” (below)
Redeploy your code 32
u When you push your change, the ”Source” will indicate “In Progress” followed
by ”Deploy” stage

When you see a Succeeded message under


Deploy, click the “AWS Elastic Beanstalk” link
Test your Web Application – Deliverable #1 33

u You are taken to updated web page of your application


u You now have a fully functioning continuous deployment pipeline!

Make sure your RIT ID


appears here

u Take a screenshot of web page with your update and upload to


Assignments > Activity #14 - Create a Continuous Delivery Pipeline
Test your Web Application – Deliverable #2 34
u Next, modify your pipeline to Continuous
Delivery
u To do this requires adding a Manual Review
Step to your Pipeline
u When you have working, take a screenshot
similar to the right
u Note: You will need to make a code change
to re-trigger the pipeline
u Submit screenshot to Assignments > Activity
#14 - Create a DevOps Pipeline
Cleanup Pipeline 35

u Go back to CodePipeline and click “Edit” u Click ”Delete” and confirm


Cleanup Beanstalk 36

u Go to the Beanstalk console under “Environments” and select your


environment name
u Select Actions > Terminate Environment
u Verify by typing the name of the environment and click “Terminate”
Cleanup Beanstalk 37

u Under “Applications” select your application name


u Select “Actions > Delete application”
u Verify by typing the name of the application and click “Delete”

u You are done!

You might also like