- Lab
- A Cloud Guru
Deploying Custom Code with a CI/CD Pipeline Using AWS CodeStar
After using CodeStar and deploying a built-in template from AWS, you want to deploy your own project, as well as provide a project environment your team members can use to collaborate on the project. In this hands-on lab, you will use the CLI to deploy your own custom code directly into the start of a AWS CodeStar project.
Path Info
Table of Contents
-
Challenge
Launch the Lab's CLI Environment
-
In the AWS console, navigate to Systems Manager.
-
From the left-hand menu, select Session Manager.
-
Click Start Session.
-
Select the only EC2 instance in the list (it should be named ssm-cli-instance), and click Start session.
-
Verify you are connected to an SSH session. Type the command (and see this response):
whoami ssm-user
-
-
Challenge
Clone the GitHub Repo onto the EC2 Instance
This task uses the SSH capability launched in the previous task.
-
Navigate to the home folder for the current user:
cd ~
-
Use the
git
command to clone the repo:git clone https://github.com/ACloudGuru-Resources/content-aws-developertools
-
Navigate into the folder containing the resources for this lab:
cd content-aws-developertools cd Deploy-custom-code-with-a-CI_CD-pipline-using-AWS-CodeStar
-
Perform a directory listing to ensure you have the files we need:
ls -l
-
-
Challenge
Create an S3 Bucket and Copy the Source Files
Note: Prior to this task, ensure you have downloaded the resource files for this lab from the lab GitHub page here.
- In the AWS console, navigate to S3.
- Create a bucket.
- Select the bucket you just created.
- Select Upload, then Add files, and select the following files:
mytoolchain.yml
mysrc.zip
-
Challenge
Use the CLI to Create a AWS CodeStar Project
This task uses the SSH capability launched in the previous task.
-
Ensure you are in the folder with the resource files for this lab:
cd content-aws-developertools cd Deploy-custom-code-with-a-CI_CD-pipline-using-AWS-CodeStar
-
Edit the
myinput.json
file withvi
:vi myinput.json
-
Replace the placeholder values in the file with the values created so far in this lab:
-
[BUCKET-NAME]
: The name of the bucket created earlier in the lab -
[VPC-ID]
: The ID of the VPC within this lab environment -
[SUBNET-ID]
: The ID of one of the subnets within the VPC in this lab environment -
[AWS-CODESTAR-SERVICE-ROLE]
: The role ARN, which is obtained as follows:- In a new tab, navigate to the CodeStar console.
- Select Start a project.
- In the dialog window, select Yes, create role.
- Navigate to the AWS IAM console page.
- Select Roles from the left-hand menu.
- From the list of roles, select aws-codestar-service-role.
- Copy the ARN of the role, and enter it into
myinput.json
.
-
Save the file in
vi
with:w
and quit with:q
.
-
-
In the terminal, run the following command to create the AWS CodeStar project:
aws codestar create-project --cli-input-json file://myinput.json --region us-east-1
-
-
Challenge
Review the Project and the Deployed Website
- In the AWS console, navigate to CodeStar.
- Select the Lab Demo project.
- Review the project.
- Navigate to EC2, locate the lab-demo instance, copy its public IP address, and enter this as an address into your web browser.
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.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.