CI/CD

Code Pipeline

  • Flow
  • Code -> Build -> Test -> Deploy -> Provision
  • Every stage, the codes are called Artifact and stored in the S3. The next stage take the artifact from the previous stage and after processing, create a new artifact to pass it to the next stage.
  • In codePipeline, a single stage can have multiple action groups
  • In code pipeline, for manual approval (SNS + Email), the user need two permission
  • GetPipeline
  • PutApproveResult
  • We can trigger code pipeline using,
  • Events
    • Using event-bridge from code-commit
    • Using code-star github app
  • Webhook
    • Script to hit the webhook of the code pipeline when code is updated
  • Polling [Not Recommanded]
    • Codepipeline always check the repository in a time interval and check if code is updated
  • Troubleshooting of code pipeline
  • Check the console
  • Check the IAM permission
  • Audit the failed API call using CloudTrail
  • AWS Codepipeline
  • AWS Codecommit
    • Like Github
    • Responsible for Code portion
  • AWS Codebuild
    • Like Jenkins
    • Responsible for Build and Test portion
  • AWS Code Deploy
    • Responsible for Deploy portion
    • Ues AWS Beanstalk or AWS Cloudformation to provision the code
    • Can be use for deploying code to
    • EC2 Instance
    • On premise sever
    • Lambda Function
    • Use for
    • Rapid release of new feature
    • Updating Lambda Function
    • Avoid downtime during Application deployment
    • Type of code deploy
    • Linear (This deployment send traffic incrementally)
    • All at once (All traffic shifts to new deployment)
    • Canary (Can be define, how many traffic will flow new and updated deployments)
  • While deploying a code base
  • Code commit can be a source stage
  • Beanstalk can be a deploy stage
  • Blue/Green Deployment
  • Isolation between blue and green
  • Roll incoming traffic during deployments
  • Minimum downtime
  • Cloudformation can be used in stages, to deploy a test environment and delete after testing