Transcription of AWS CodePipeline - User Guide
1 AWS CodePipelineUser GuideAPI Version 2015-07-09 AWS CodePipeline user GuideAWS CodePipeline : user GuideCopyright 2018 Amazon Web Services, Inc. and/or its affiliates. All rights 's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any mannerthat is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks notowned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored CodePipeline user GuideTable of viiWhat Is AWS CodePipeline ? .. 1 Video Introduction to AWS CodePipeline .. 1 What Can I Do with AWS CodePipeline ? .. 1A Quick Look at AWS CodePipeline .. 2A Quick Look at Input and Output Artifacts.
2 2 How Do I Get Started with AWS CodePipeline ? .. 3We Want to Hear from You .. 3 Concepts .. 3 Continuous Delivery and Integration .. 4 How AWS CodePipeline Works .. 4 Getting Started .. 9 Step 1: Create an AWS Account .. 9 Step 2: Create or Use an IAM user .. 9 Step 3: Use an IAM Managed Policy to Assign AWS CodePipeline Permissions to the IAM user .. 9 Step 4: Install the AWS CLI .. 10 Step 5: Open the Console for AWS CodePipeline .. 10 Next Steps .. 10 Product and Service Integrations .. 11 Integrations with AWS CodePipeline Action Types .. 11 Source Action Integrations .. 11 Build Action Integrations .. 13 Test Action Integrations .. 15 Deploy Action Integrations .. 16 Approval Action Integrations .. 18 Invoke Action Integrations.
3 19 General Integrations with AWS CodePipeline .. 19 Examples from the Community .. 23 Blog Posts .. 25 Tutorials .. 27 Tutorial: Create a Simple Pipeline (Amazon S3 Bucket) .. 27 Create an Amazon S3 Bucket .. 28 Create Windows Server Amazon EC2 Instances and Install the AWS CodeDeploy Agent .. 29 Create an Application in AWS CodeDeploy .. 31 Create Your First Pipeline .. 32 Add Another Stage .. 35 Disable and Enable Transitions Between Stages .. 41 Clean Up Resources .. 42 Tutorial: Create a Simple Pipeline (AWS CodeCommit Repository) .. 43 Create an AWS CodeCommit Repository .. 44 Download, Commit and Push Your Code .. 44 Create an Amazon EC2 Linux Instance and Install the AWS CodeDeploy Agent .. 45 Create an Application in AWS CodeDeploy .. 47 Create Your First Pipeline.
4 48 Update Code in Your AWS CodeCommit Repository .. 51 Optional Stage Management Tasks .. 53 Clean Up Resources .. 53 Tutorial: Create a Four-Stage Pipeline .. 54 Set Up Prerequisites .. 54 Create a Pipeline .. 57 Add More Stages .. 58 Clean Up Resources .. 61 Tutorial: Set Up a CloudWatch Events Rule to Receive Email Notifications for Pipeline State Changes .. 61 API Version 2015-07-09iiiAWS CodePipeline user GuideSet Up an Email Notification Using Amazon SNS .. 62 Create an CloudWatch Events Notification Rule for AWS CodePipeline .. 63 Clean Up Resources .. 64 Tutorial: Build and Test an Android App When Pushed to GitHub .. 64 Configure AWS CodePipeline to Use Your Device Farm Tests .. 65 Tutorial: Build and Test an iOS App When a Change Is Saved in Amazon S3.
5 72 Configure AWS CodePipeline to Use Your Device Farm Tests (Amazon S3 Example) .. 72 Tutorial: Create a Pipeline That Deploys to AWS Service Catalog .. 81 Option 1: Deploy to AWS Service Catalog Without a Configuration File .. 82 Option 2: Deploy to AWS Service Catalog Using a Configuration File .. 88 Tutorial: Create a Pipeline with AWS CloudFormation .. 94 Example 1: Create an AWS CodeCommit Pipeline with AWS CloudFormation .. 94 Example 2: Create an Amazon S3 Pipeline with AWS CloudFormation .. 96 Example 3: Create a GitHub Pipeline with AWS CloudFormation .. 98 Best Practices and Use Cases .. 100 Best Practices .. 100 Security Best Practices for AWS CodePipeline Resources .. 100 Monitoring and Logging Best Practices for AWS CodePipeline Resources .. 100 Best Practices for the Jenkins PlugIn.
6 101 Examples of How to Use AWS CodePipeline .. 101 Use AWS CodePipeline with Amazon S3, AWS CodeCommit, and AWS CodeDeploy .. 102 Use AWS CodePipeline with Third-party Action Providers (GitHub and Jenkins) .. 102 Use AWS CodePipeline with AWS CodeStar to Build a Pipeline in a Code Project .. 102 Use AWS CodePipeline to Compile, Build, and Test Code with AWS CodeBuild .. 103 Use AWS CodePipeline with Amazon ECS for Continuous Delivery of Container-BasedApplications to the 103 Use AWS CodePipeline with Elastic Beanstalk for Continuous Delivery of Web Applications tothe 103 Use AWS CodePipeline with AWS Lambda for Continuous Delivery of Lambda-Based andServerless Applications .. 103 Use AWS CodePipeline with AWS CloudFormation Templates for Continuous Delivery to 103 Working with Pipelines.
7 104 Start a Pipeline Execution in AWS CodePipeline .. 104 Change Detection Methods Used to Start Pipelines Automatically .. 105 Use a CloudWatch Events Rule to Start an AWS CodeCommit Pipeline .. 106 Use CloudWatch Events to Start an Amazon S3 Pipeline .. 118 Use Webhooks to Start a GitHub Pipeline .. 133 Start a Pipeline Automatically Using Periodic Checks .. 141 Start a Pipeline Manually in AWS CodePipeline .. 141 Use Amazon CloudWatch Events to Start a Pipeline on a Schedule .. 142 Create a Pipeline .. 144 Create an Image Definitions File for Deploying Container-Based Applications .. 144 Create a Pipeline (Console) .. 146 Create a Pipeline (CLI) .. 150 Edit a Pipeline .. 152 Edit a Pipeline (Console) .. 153 Edit a Pipeline (AWS CLI) .. 155 View Pipeline Details and History.
8 158 View Pipeline Details and History (Console) .. 159 View Pipeline Details and History (CLI) .. 160 Delete a 163 Delete a Pipeline (Console) .. 164 Delete a Pipeline (CLI) .. 164 View Execution History .. 164 View Execution History .. 165 Create a Pipeline That Uses Resources from Another Account .. 165 API Version 2015-07-09ivAWS CodePipeline user GuidePrerequisite: Create an AWS KMS Encryption Key .. 166 Step 1: Set Up Account Policies and Roles .. 166 Step 2: Edit the Pipeline .. 172 Edit a Pipeline for Push Events .. 173 Update Pipelines for Push Events (Console) .. 175 Update Pipelines for Push Events (CLI) .. 179 Update Pipelines for Push Events (AWS CloudFormation Template) .. 188 Working with Actions .. 225 Create a Custom Action for a Pipeline.
9 225 Create a Custom Action (CLI) .. 226 Create a Job Worker for Your Custom Action .. 229 Add a Custom Action to a Pipeline .. 233 Invoke a Lambda Function in a Pipeline .. 235 Step 1: Create a Pipeline .. 236 Step 2: Create the Lambda Function .. 237 Step 3: Add the Lambda Function to a Pipeline in the AWS CodePipeline Console .. 240 Step 4: Test the Pipeline with the Lambda function .. 241 Step 5: Next Steps .. 241 Example JSON Event .. 242 Additional Sample Functions .. 243 Retry a Failed Action .. 251 Retry Failed Actions (Console) .. 252 Retry Failed Actions (CLI) .. 252 Manage Approval Actions in Pipelines .. 253 Configuration Options for Manual Approval Actions .. 253 Setup and Workflow Overview for Approval Actions .. 254 Grant Approval Permissions to an IAM user in AWS CodePipeline .
10 255 Grant Amazon SNS Permissions to a Service Role .. 256 Add a Manual Approval Action .. 257 Approve or Reject an Approval Action .. 260 JSON Data Format for Manual Approval Notifications .. 263 Add a Cross-Region Action to a Pipeline .. 263 Prerequisites .. 264 Add a Cross-Region Action to a Pipeline (CLI) .. 264 Add a Cross-Region Action to a Pipeline (AWS CloudFormation) .. 267 Working with Stage Transitions .. 270 Disable or Enable Transitions (Console) .. 270 Disable or Enable Transitions (CLI) .. 272 Monitoring 273 Detect and React to Changes in Pipeline State with CloudWatch Events .. 273 Understand How a Pipeline Execution State Change Rule Works .. 274 Logging API Calls with AWS CloudTrail .. 281 AWS CodePipeline Information in CloudTrail .. 281 Understanding AWS CodePipeline Log File Entries.