- A Cloud Guru
Deploying and Updating a Web Application with a CI/CD Pipeline Using AWS CodeStar
As a budding DevOps engineer, you want to use a variety of AWS services to smooth your development pipeline. Specifically, you want to set up an AWS native CI/CD workflow. In this hands-on lab, we look at how to use AWS CodeStar to automate the setup of a CodeStar project, including AWS CodeCommit, AWS CodeDeploy, and AWS CodePipeline.
Table of Contents
Create a CodeStar Project
- Navigate to the AWS CodeStar console page.
- Click Start a project.
- In the Create service role dialog box, select Yes, create role.
- In the Filter text box toward the upper left, type "Website".
- Select the HTML 5 Website card option to create a CodeStar project based on a website.
- For the Project name, enter "Lab Project".
- Notice the Project ID and the Repository name have been auto-filled for you.
- Select AWS CodeCommit as your repository type and click Next.
- Click Create Project.
- When prompted, click Amazon EC2 Management Console link to create an EC2 key pair.
- Return to the CodeStar console, press the refresh button located to the right of the Select a Key Pair dropdown menu, select the key you just made, check the box to acknowledge you have the key, and click Create Project.
- When prompted, enter your name as the Display Name and an email address (can be fake) in the Email text box.
- Click Next.
- For Pick how you want to edit your code, select AWS Cloud9.
- Click Next.
- Accept the default options for the Cloud9 environment, and click Next.
Review the Deployed Website
- Within the CodeStar project page, click the link in the Application endpoints card.
- The web page we deployed should now load.
Deploy a Change to the Website
From the CodeStar project page, from the AWS Cloud9 environments card, click See my environments.
From the card that shows the Cloud9 environment, click Open IDE.
When Cloud9 loads, navigate to the folder lab-project > lab-project > webpage, and load the file
Locate some text within the HTML that is displayed on the page (e.g., "Congratulations") and change this text to something else (e.g., "This lab is great!").
Save the file
In the Bash console panel at the bottom of the Cloud9 IDE, enter the following commands:
cd ~/environment/lab-project/ git add . git commit -m "This is my change." git push
Navigate to the CodeStar project console page, where you should now see CodePipeline deploying the changes you made.
Navigate back to the application endpoint (if the tab was already open, refresh it), and see the changes you made to the website.
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.