AWS CodePipeline

  • A fully managed continuous delivery service that helps you automate your release pipelines for application and infrastructure updates.
  • You can easily integrate AWS CodePipeline with third-party services such as GitHub or with your own custom plugin.

AWS CodePipeline 1

  • Concepts
    • A pipeline defines your release process workflow, and describes how a new code change progresses through your release process.
    • A pipeline comprises a series of stages (e.g., build, test, and deploy), which act as logical divisions in your workflow. Each stage is made up of a sequence of actions, which are tasks such as building code or deploying to test environments.
      • Pipelines must have at least two stages. The first stage of a pipeline is required to be a source stage, and the pipeline is required to additionally have at least one other stage that is a build or deployment stage.
    • Define your pipeline structure through a declarative JSON document that specifies your release workflow and its stages and actions. These documents enable you to update existing pipelines as well as provide starting templates for creating new pipelines.
    • A revision is a change made to the source location defined for your pipeline. It can include source code, build output, configuration, or data. A pipeline can have multiple revisions flowing through it at the same time.
    • A stage is a group of one or more actions. A pipeline can have two or more stages.
    • An action is a task performed on a revision. Pipeline actions occur in a specified order, in serial or in parallel, as determined in the configuration of the stage.
      • You can add actions to your pipeline that are in an AWS Region different from your pipeline.
      • There are six types of actions
        • Source
        • Build
        • Test
        • Deploy
        • Approval
        • Invoke
    • When an action runs, it acts upon a file or set of files called artifacts. These artifacts can be worked upon by later actions in the pipeline. You have an artifact store which is an S3 bucket in the same AWS Region as the pipeline to store items for all pipelines in that Region associated with your account.
    • The stages in a pipeline are connected by transitions. Transitions can be disabled or enabled between stages. If all transitions are enabled, the pipeline runs continuously.
    • An approval action prevents a pipeline from transitioning to the next action until permission is granted. This is useful when you are performing code reviews before code is deployed to the next stage.

AWS CodePipeline 3

  • Features
    • AWS CodePipeline provides you with a graphical user interface to create, configure, and manage your pipeline and its various stages and actions.
    • A pipeline starts automatically (default) when a change is made in the source location, or when you manually start the pipeline. You can also set up a rule in CloudWatch to automatically start a pipeline when events you specify occur.
    • You can model your build, test, and deployment actions to run in parallel in order to increase your workflow speeds.
    • AWS CodePipeline can pull source code for your pipeline directly from AWS CodeCommit, GitHub, Amazon ECR, or Amazon S3.
    • It can run builds and unit tests in AWS CodeBuild.
    • It can deploy your changes using AWS CodeDeploy, AWS Elastic Beanstalk, Amazon ECS, or AWS Fargate.
    • You can use the CodePipeline Jenkins plugin to easily register your existing build servers as a custom action.
    • When you use the console to create or edit a pipeline that has a GitHub source, CodePipeline creates a webhook. A webhook is an HTTP notification that detects events in another tool, such as a GitHub repository, and connects those external events to a pipeline. CodePipeline deletes your webhook when you delete your pipeline.
  • As a best practice, when you use a Jenkins build provider for your pipeline’s build or test action, install Jenkins on an Amazon EC2 instance and configure a separate EC2 instance profile. Make sure the instance profile grants Jenkins only the AWS permissions required to perform tasks for your project, such as retrieving files from Amazon S3.
  • AWS CodePipeline now supports Amazon VPC endpoints powered by AWS PrivateLink. This means you can connect directly to CodePipeline through a private endpoint in your VPC, keeping all traffic inside your VPC and the AWS network.
  • You can view details for each of your pipelines, including when actions last ran in the pipeline, whether a transition between stages is enabled or disabled, whether any actions have failed, and other information. You can also view a history page that shows details for all pipeline executions for which history has been recorded. Execution history is retained for up to 12 months.
  • Limits
    • Maximum number of total pipelines per Region in an AWS account is 300
    • Number of stages in a pipeline is minimum of 2, maximum of 10
  • Pricing
    • You are charged per active pipeline each month. Newly created pipelines are free to use during the first 30 days after creation.

 

CI/CD for Containers: A Way Forward for Your DevOps Pipeline:

 

Validate Your Knowledge

Question 1

A company is using a combination of CodeCommit, CodeBuild, CodePipeline and CodeDeploy services for its continuous integration and continuous delivery (CI/CD) pipeline on AWS. They want someone to perform a code review before a revision is allowed into the next stage of a pipeline. If the action is approved, the pipeline execution resumes but if it is not then the pipeline execution will not proceed.

Which of the following is the MOST suitable solution to implement in this scenario?

  1. Implement a manual approval actions configuration in CodePipeline using an SNS Topic.
  2. Use SWF.
  3. Implement a manual approval actions configuration in CodePipeline using an SQS Queue.
  4. Use Step Functions.

Correct Answer: 1

In AWS CodePipeline, you can add an approval action to a stage in a pipeline at the point where you want the pipeline execution to stop so that someone with the required AWS Identity and Access Management permissions can approve or reject the action.

If the action is approved, the pipeline execution resumes. If the action is rejected – or if no one approves or rejects the action within seven days of the pipeline reaching the action and stopping – the result is the same as an action failing, and the pipeline execution does not continue.

You might use manual approvals for these reasons:

– You want someone to perform a code review or change management review before a revision is allowed into the next stage of a pipeline.

– You want someone to perform manual quality assurance testing on the latest version of an application, or to confirm the integrity of a build artifact, before it is released.

– You want someone to review new or updated text before it is published to a company website.

You can configure an approval action to publish a message to an Amazon Simple Notification Service topic when the pipeline stops at the action. Amazon SNS delivers the message to every endpoint subscribed to the topic. You must use a topic created in the same AWS region as the pipeline that will include the approval action. When you create a topic, it is recommended that you give it a name that will identify its purpose, in formats such as tutorialsdojoManualApprovalPHL-us-east-2-approval.

Hence, the correct answer is to implement a manual approval actions configuration in CodePipeline using an SNS Topic.

Using SWF is incorrect because this service just helps developers build, run, and scale background jobs that have parallel or sequential steps. This is not a suitable service to be used as the scenario is more focused on the deployment pipeline and approval instead, which can be met by using CodePipeline and SNS.

Implementing a manual approval actions configuration in CodePipeline using an SQS Queue is incorrect because although setting up a manual approval is valid, the use of SQS is wrong. It is better to use SNS instead to send the approval action emails to the recipient who will either approve or deny the action.

Using Step Functionsis incorrect because it just lets you coordinate multiple AWS services into serverless workflows so you can build and update apps quickly.

References:
https://docs.aws.amazon.com/codepipeline/latest/userguide/approvals.html
https://docs.aws.amazon.com/codepipeline/latest/userguide/actions.html

For more AWS practice exam questions with detailed explanations, check this out:

Tutorials Dojo AWS Practice Exams

XX

Additional Training Materials: AWS CodePipeline Video Courses on Udemy

  1. DevOps: CI/CD using AWS CodePipeline & Elastic Beanstalk by Ali Rizavi
  2. AWS CodeCommit CodeBuild CodeDeploy CodePipeline | Hands On by Stack Simplify

 

Sources:
https://aws.amazon.com/codepipeline/features/?nc=sn&loc=2
https://aws.amazon.com/codepipeline/pricing/?nc=sn&loc=3
https://docs.aws.amazon.com/codepipeline/latest/userguide/welcome.html
https://aws.amazon.com/codepipeline/faqs/?nc=sn&loc=5

***

AWS Certifications are consistently among the top paying IT certifications in the world, considering that Amazon Web Services is the leading cloud services platform with almost 50% market share! Earn over $150,000 per year with an AWS certification!

Subscribe to our newsletter and notifications for more helpful AWS cheat sheets and study guides like this and answer as many AWS practice exams as you can.🙂

Enroll Now – AWS Certified Cloud Practitioner Practice Exams

AWS Certified Cloud Practitioner Practice Tests

Enroll Now – AWS Certified Solutions Architect Associate Practice Exams

AWS Certified Solutions Architect Associate

Enroll Now – AWS Certified Developer Associate Practice Exams

AWS Certified Developer Associate Tutorials Dojo

Enroll Now – AWS Certified SysOps Administrator Associate Practice Exams

AWS Certified SysOps Administrator Associate Tutorials Dojo

Enroll Now – AWS Certified Solutions Architect Professional Practice Exams

AWS Certified Solutions Architect Professional Tutorials Dojo

Affordable AWS Educational Materials

Browse Other Courses

Generic Category (English)300x250

Recent Posts