This lab requires an AWS Cloud9 IDE. If you do not have an AWS Cloud9 IDE set up, complete the Prepartion section of the workshop.
In the AWS Management Console search bar, type and select Cloud9.
Choose open IDE for the Cloud9 instance set up previously. It may take a few moments for the IDE to open. AWS Cloud9 stops and restarts the instance so that you do not pay compute charges when no longer using the Cloud9 IDE.
Next, we’ll use the AWS Command Line Interface (CLI) to create a Git repository in AWS CodeCommit and clone the empty repo in your Cloud9 environment.
Set AWS Region
AWS_REGION=$(curl --silent http://169.254.169.254/latest/meta-data/placement/region)
echo "export AWS_REGION=${AWS_REGION}"
AWS CodeCommit is a secure, highly scalable, managed source control service that hosts private Git repositories.
aws codecommit create-repository --repository-name MyDemoRepo --repository-description "My demonstration repository" --tags Team=ISC22 --region $AWS_REGION
REPOURL=$(aws codecommit get-repository --repository-name MyDemoRepo --query repositoryMetadata.cloneUrlHttp --output text --region $AWS_REGION)
echo $REPOURL
Verify echo $REPOURL outputs a repo url like https://git-codecommit.<region>.amazonaws.com/v1/repos/MyDemoRepo
git clone $REPOURL
cd MyDemoRepo/
You can ignore the warning shown [warning: You appear to have cloned an empty repository]
git branch -m master main