其他分享
首页 > 其他分享> > [AWS DA] AWS CICD: CodeCommit, CodePipeline, CodeBuild, CodeDeploy

[AWS DA] AWS CICD: CodeCommit, CodePipeline, CodeBuild, CodeDeploy

作者:互联网

Overview

CodeCommit

Security

Authentication in Git:

Authorization in Git:

Encryption:

Cross Account access:

 

Notifications

You can trigger notification in CodeCommit using SNS, Lambda or CloudWatch Event Rules.

Basiclly any notification related to Pull request (inlcude comments), goes to CloudWatch Event Rules.

Otherwise goes to SNS / AWS Lambda.

CloudWath Event rules can also goes into SNS topic.

SNS / Lambda:

CloudWatch Event Rules:

Answer: CloudWatch Event Rules. Anything related to PR, goes to CER.

 

CodePipeline

Artifacts

 

Troubleshooting

Pipeline -> all goes to CloudWatch Event Rules -> SNS

Different from CodeCommit, only Pull Request related goes into CloudWatch Event Rules

Deploy

Services which Codepipeline can deploy to:

 

Stage

You can new stage easily and each stage can have multi action groups (Sequential / parallel)

 

CodeBuild

Supported environment

buildspec.yml

 

AWS-Managed Docker container, you are not able to SSH there.

But you can debug locally with CodeBuild Agent.

 

CodePipeline can deploy to S3, so need to choose CodePipeline

CodeBuild is mainly used for transform markdown file to html file in build phrase.

 

 

CodeDeploy

 

 

AppSpec

Hooks: set of instructions to do to deploy the new version (hooks can have timeouts).

The order is:

Failures:

Deployment Targets:

 


 

CodeDeploy Demo

0. appspec.yml file, app store in S3

version: 0.0
os: linux
files:
  - source: /index.html
    destination: /var/www/html/
hooks:
  BeforeInstall:
    - location: scripts/install_dependencies
      timeout: 300
      runas: root
    - location: scripts/start_server
      timeout: 300
      runas: root
  ApplicationStop:
    - location: scripts/stop_server
      timeout: 300
      runas: root

 

1. Create two Roles

One for CodeDeploy role:

Another for EC2 role, because EC2 need to pull the code from S3

 

2. Create an EC2 instance where CodeDeploy can deploy to:

 

3. SSH into EC2 instance

sudo yum update
sudo yum install ruby

// download the agent
wget https://aws-codedeploy-eu-west-3.s3.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
sudo service codedeploy-agent status
// The AWS CodeDeploy agent is running as PID 7640

 

4. Create CodeDeploy Application

 

5. Create Deployment Group

 

6. Create Deployment

 

7. View the app in broswer by using EC2 Public IPV4 address.


 

 

RollBack

 

CodeStar

标签:code,CodeCommit,CICD,AWS,CloudWatch,CodeDeploy,EC2,build
来源: https://www.cnblogs.com/Answer1215/p/14837675.html