Install CodeDeploy Agent

  1. SSH into the EC2 instance

CodeDeploy

  1. Then, install the CodeDeploy Agent
sudo yum update -y
sudo yum install ruby -y
sudo yum install wget -y
/opt/codedeploy-agent/bin/codedeploy-agent stop
sudo yum erase codedeploy-agent -y
cd /home/ec2-user/
wget https://bucket-name.s3.region-identifier.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
  • bucket name: is the name of the Amazon S3 bucket containing the CodeDeploy Resource Kit files.
  • region-identifier: for example, as follows:
wget https://aws-codedeploy-ap-southeast-1.s3.ap-southeast-1.amazonaws.com/latest/install

CodeDeploy

  1. Check if the service is running using the following command:
sudo service codedeploy-agent status
  • If the service encounters an error or is not running, use the following command to start the service:
sudo service codedeploy-agent start
sudo service codedeploy-agent status

CodeDeploy

  1. Navigate to the tmp directory
cd /tmp
ls

CodeDeploy

  1. Install git to clone resources:
sudo yum install git

CodeDeploy

  1. Clone the WordPress source code.
git clone https://github.com/Hieu192/WordPress

CodeDeploy

  1. After cloning the WordPress source code:
  • Navigate to the directory:
ls
cd WordPress
ls
cat appspec.yml
  • You can also view the contents of the appspec.yml file used to configure the lifecycle deployment.

CodeDeploy

  1. Clone the script files configured in the appspec.yml file
git clone https://github.com/Hieu192/scripts

CodeDeploy