Know How Guide and Hands on Guide for AWS
Create a S3 bucket ray-awscodepipeline-demobucket
and enable the versioning
Upload the sample application and upload to S3 bucket
aws s3 cp SampleApp_Linux.zip s3://ray-awscodepipeline-demobucket/source/SampleApp_Linux.zip --region ap-southeast-1 --profile global
Create an instance role for EC2 ec2-codeX-instance-profile
with permission AmazonEC2RoleforAWSCodeDeploy
Create 2 EC2 Linux instances and install the CodeDeploy agent:
#!/bin/bash
yum -y update
yum install -y ruby
yum install -y aws-cli
cd /home/ec2-user
aws s3 cp s3://aws-codedeploy-us-east-2/latest/install . --region us-east-2
chmod +x ./install
./install auto
Create other EC2 instance, but with Tag: Name:MyCodePipelineDemoProduction
MyDemoApplication
in CodeDeploy
MyDemoDeploymentGroup
MyCodePipelineDemo
CodeDeployDefault.OneAtaTime
two-stage-pipeline
S3
, Bucket: ray-awscodepipeline-demobucket
, Object Key: source/SampleApp_Linux.zip
MyDemoApplication
, Deployment group: MyDemoDeploymentGroup
two-stage-pipeline
to staging deployment and production deploymentMyDemoApplication
Application
CodePipelineProductionFleet
CodePipelineProductionFleet
as third stage in your pipeline
Production
Deploy-Production
, Action provider as AWS CodeDeploySourceArtifact
, Application name: MyDemoApplication
, Deployment group: CodePipelineProductionFleet
. Choose Save.unzip SampleApp_Linux.zip -d SampleApp_Linux
Modify the index.html
zip -r SampleApp_Linux.zip SampleApp_Linux
aws s3 cp SampleApp_Linux.zip s3://ray-awscodepipeline-demobucket/source/SampleApp_Linux.zip --region ap-southeast-1 --profile global
aws codepipeline start-pipeline-execution --name two-stage-pipeline --region ap-southeast-1 --profile global
MyDemoRepo
git clone ssh://git-codecommit.ap-southeast-1.amazonaws.com/v1/repos/MyDemoRepo
cd SampleApp_Linux/
mv * ~/MyDemoRepo/
cd ~/MyDemoRepo/
tree
.
├── appspec.yml
├── index.html
├── LICENSE.txt
└── scripts
├── install_dependencies
├── start_server
└── stop_server
1 directory, 6 files
git add -A
git commit -m "Add sample application files"
git push
two-stage-pipeline
Pipeline
AWS CodeCommit
, Repository name: MyDemoRepo
, Branch name: master.
```bash
git commit -am "Updated sample application files"
git push