Rapid Docker on AWS

Video Course

4.3 Deployment pipeline: CodeBuild

Copy the pipeline files

cd /src/php-basic
cp -R ../php-basic-pipeline/* .

Commit the new files to your local Git repository

git add -A
git commit -m 'add deployment pipeline'

Create Docker Hub credentials

WARNING This step was added after the video was recorded! Therefore, it is not mentioned in the video.

The pipeline has to log in to Docker Hub to pull images without running into rate limits. The AWS Systems Manager Parameter Store is the perfect place to store secrets for your applications running in the cloud. Therefore, we recommend using the SSM Parameter Store to store your Docker Hub username, password, or access token. To create the SSM parameters, replace $YOUR_USERNAME with your Docker Hub username (create a free account at https://hub.docker.com/signup), $YOUR_PASSWORD_OR_ACCESS_TOKEN with your password or access token, and run:,

aws ssm put-parameter --name '/rapid-docker-on-aws/dockerhub/username' --type String --value '$YOUR_USERNAME'
aws ssm put-parameter --name '/rapid-docker-on-aws/dockerhub/password' --type SecureString --value '$YOUR_PASSWORD_OR_ACCESS_TOKEN'

Deploy the CodeBuild project

Replace $NICKNAME.

cd aws
npm i
aws cloudformation package --template-file pipeline.yml --s3-bucket docker-on-aws-$NICKNAME --output-template-file .pipeline.yml
aws cloudformation deploy --template-file .pipeline.yml --stack-name php-basic-pipeline --capabilities CAPABILITY_IAM
git push

Make a change

cd /src/php-basic
nano index.php
git add index.php
git commit -m 'deployment test'
git push

Cleanup

cd /src/php-basic/aws
bash pipeline-cleanup.sh