CICD Pipeline with AWS CodePipeline Flashcards
What is CI/CD ?
A CI/CD (continuous integration and continuous deployment) pipeline is a series of automated steps that helps build, test, and deploy code changes.
Amazon CodePipeline
Amazon CodePipeline is a continuous delivery service that automates the deploying, compiling, and testing of code using a pipeline of stages personalized according to a desired development workflow. Amazon CodeBuild is a fully managed AWS service that continuously integrates and compiles source codes and builds production-ready software applications. Amazon CodeDeploy is a service that automates and simplifies the code deployment process and allows for efficient and consistent updates to a software application.
Create an S3 Bucket
An S3 (Simple Storage Service) bucket is a cloud storage resource for storing AWS resource objects.
IAM Role
An IAM role is used to allow an entity, like an AWS service such as Lambda or an EC2 instance, to get temporary security credentials allowing for permissions associated with that role.
Security Group
Security groups are rules that manage the inbound and outbound traffic for an associated instance at the instance level. In other words, they can be considered a kind of firewall for this instance.
EC2
An EC2 instance is a virtual server on the AWS cloud that provides scalable computing services and allows for easy deployment and running of applications on the cloud. We’ll first launch the instance by configuring its AMI, instance type, security settings, and storage and defining a bootstrap script to pre-install the CodeDeploy agent needed for the deployment of any resources to the EC2 instance and the node environment itself.
Code Deploy Script
!/bin/bash
Enabling admin rights
sudo su
send script output to /tmp so we can debug boot failures
exec > /tmp/userdata.log 2>&1
Update all packages
yum -y update
yum -y install ruby
yum -y install wget
Installing the CodeDeploy agent
cd /home/ec2-user
wget https://aws-codedeploy-us-east-2.s3.amazonaws.com/latest/install
chmod +x ./install
./install auto
cd /../..
Downloading and Installing NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
Adding the nvm environmental variable to path
export NVM_DIR=”$HOME/.nvm”
[ -s “$NVM_DIR/nvm.sh” ] && . “$NVM_DIR/nvm.sh”
Installing Node
nvm install 16
Re-adding the nvm environmental variable for the ec2-user account
cat «EOF»_space; /home/ec2-user/.bashrc
export NVM_DIR=”/.nvm”
[ -s “$NVM_DIR/nvm.sh” ] && . “$NVM_DIR/nvm.sh”
EOF
GitHUB
Amazon CodeBuild
Code Deploy