id
stringlengths
14
16
text
stringlengths
1
2.43k
source
stringlengths
99
229
0ac30f3a4eba-5
{ "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" }, ":", { "Ref": "RepositoryName" } ] ] } ], "detail": { "event": [ "referenceCreated", "referenceUpdated" ], "referenceType": [ "branch" ], "referenceName": [ "master" ] } }, "Targets": [ { "Arn": { "Fn::Join": [ "", [ "arn:aws:codepipeline:", { "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" }, ":", { "Ref": "AppPipeline" } ] ] }, "RoleArn": {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
0ac30f3a4eba-6
} ] ] }, "RoleArn": { "Fn::GetAtt": [ "AmazonCloudWatchEventRole", "Arn" ] }, "Id": "codepipeline-AppPipeline" } ] } }, "AppPipeline": { "Type": "AWS::CodePipeline::Pipeline", "Properties": { "Name": "codecommit-events-pipeline", "RoleArn": { "Fn::GetAtt": [ "CodePipelineServiceRole", "Arn" ] }, "Stages": [ { "Name": "Source", "Actions": [ { "Name": "SourceAction", "ActionTypeId": { "Category": "Source", "Owner": "AWS", "Version": 1, "Provider": "CodeCommit" }, "OutputArtifacts": [ { "Name": "SourceOutput" } ],
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
0ac30f3a4eba-7
"OutputArtifacts": [ { "Name": "SourceOutput" } ], "Configuration": { "BranchName": { "Ref": "BranchName" }, "RepositoryName": { "Ref": "RepositoryName" }, "PollForSourceChanges": false }, "RunOrder": 1 } ] }, ... ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
085a887593e3-0
Use these steps to edit your pipeline with an Amazon S3 source from polling to event\-based change detection\. To build an event\-driven pipeline with Amazon S3, you edit the `PollForSourceChanges` parameter of your pipeline and then add the following resources to your template: + Amazon CloudWatch Events requires that all Amazon S3 events must be logged\. You must create an AWS CloudTrail trail, bucket, and bucket policy that Amazon S3 can use to log the events that occur\. For more information, see [Logging Management and Data Events with AWS CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-and-data-events-with-cloudtrail.html)\. + Amazon CloudWatch Events rule and IAM role to allow this event to start our pipeline\. If you use AWS CloudFormation to create and manage your pipelines, your template includes content like the following\. **Note** The `Configuration` property in the source stage called `PollForSourceChanges`\. If your template doesn't include that property, then `PollForSourceChanges` is set to `true` by default\. ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
8870f00752a0-0
``` AppPipeline: Type: AWS::CodePipeline::Pipeline Properties: RoleArn: !GetAtt CodePipelineServiceRole.Arn Stages: - Name: Source Actions: - Name: SourceAction ActionTypeId: Category: Source Owner: AWS Version: 1 Provider: S3 OutputArtifacts: - Name: SourceOutput Configuration: S3Bucket: !Ref SourceBucket S3ObjectKey: !Ref S3SourceObjectKey PollForSourceChanges: true RunOrder: 1 ... ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
2238eb18eab1-0
``` "AppPipeline": { "Type": "AWS::CodePipeline::Pipeline", "Properties": { "RoleArn": { "Fn::GetAtt": ["CodePipelineServiceRole", "Arn"] }, "Stages": [ { "Name": "Source", "Actions": [ { "Name": "SourceAction", "ActionTypeId": { "Category": "Source", "Owner": "AWS", "Version": 1, "Provider": "S3" }, "OutputArtifacts": [ { "Name": "SourceOutput" } ], "Configuration": { "S3Bucket": { "Ref": "SourceBucket" }, "S3ObjectKey": { "Ref": "SourceObjectKey" }, "PollForSourceChanges": true }, "RunOrder": 1 } ] }, ... ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
2238eb18eab1-1
"RunOrder": 1 } ] }, ... ``` ------<a name="proc-cfn-event-s3-createrule"></a> **To create a CloudWatch Events rule with Amazon S3 as the event source and CodePipeline as the target and apply the permissions policy** 1. In the template, under `Resources`, use the `AWS::IAM::Role` AWS CloudFormation resource to configure the IAM role that allows your event to start your pipeline\. This entry creates a role that uses two policies: + The first policy allows the role to be assumed\. + The second policy provides permissions to start the pipeline\. **Why am I making this change?** Adding `AWS::IAM::Role` resource enables AWS CloudFormation to create permissions for Amazon CloudWatch Events\. This resource is added to your AWS CloudFormation stack\. ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c831efff1820-0
``` AmazonCloudWatchEventRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: Service: - events.amazonaws.com Action: sts:AssumeRole Path: / Policies: - PolicyName: cwe-pipeline-execution PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: codepipeline:StartPipelineExecution Resource: !Join [ '', [ 'arn:aws:codepipeline:', !Ref 'AWS::Region', ':', !Ref 'AWS::AccountId', ':', !Ref AppPipeline ] ] ... ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
00cdc9590efa-0
``` "AmazonCloudWatchEventRole": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "events.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] }, "Path": "/", "Policies": [ { "PolicyName": "cwe-pipeline-execution", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "codepipeline:StartPipelineExecution", "Resource": { "Fn::Join": [ "", [ "arn:aws:codepipeline:", { "Ref": "AWS::Region" }, ":", {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
00cdc9590efa-1
{ "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" }, ":", { "Ref": "AppPipeline" } ] ] ... ``` ------ 1. Use the `AWS::Events::Rule` AWS CloudFormation resource to add a CloudWatch Events rule\. This event pattern creates an event that monitors `CopyObject`, `PutObject` and `CompleteMultipartUpload` on your Amazon S3 source bucket\. In addition, include a target of your pipeline\. When `CopyObject`, `PutObject`, or `CompleteMultipartUpload` occurs, this rule invokes `StartPipelineExecution` on your target pipeline\. **Why am I making this change?** Adding the `AWS::Events::Rule` resource enables AWS CloudFormation to create the event\. This resource is added to your AWS CloudFormation stack\. ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
872721edd888-0
``` AmazonCloudWatchEventRule: Type: AWS::Events::Rule Properties: EventPattern: source: - aws.s3 detail-type: - 'AWS API Call via CloudTrail' detail: eventSource: - s3.amazonaws.com eventName: - CopyObject - PutObject - CompleteMultipartUpload requestParameters: bucketName: - !Ref SourceBucket key: - !Ref SourceObjectKey Targets: - Arn: !Join [ '', [ 'arn:aws:codepipeline:', !Ref 'AWS::Region', ':', !Ref 'AWS::AccountId', ':', !Ref AppPipeline ] ] RoleArn: !GetAtt AmazonCloudWatchEventRole.Arn Id: codepipeline-AppPipeline ... ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
8530dffba864-0
``` "AmazonCloudWatchEventRule": { "Type": "AWS::Events::Rule", "Properties": { "EventPattern": { "source": [ "aws.s3" ], "detail-type": [ "AWS API Call via CloudTrail" ], "detail": { "eventSource": [ "s3.amazonaws.com" ], "eventName": [ "CopyObject", "PutObject", "CompleteMultipartUpload" ], "requestParameters": { "bucketName": [ { "Ref": "SourceBucket" } ], "key": [ { "Ref": "SourceObjectKey" } ] } } }, "Targets": [ { "Arn": { "Fn::Join": [ "", [ "arn:aws:codepipeline:", { "Ref": "AWS::Region"
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
8530dffba864-1
[ "arn:aws:codepipeline:", { "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" }, ":", { "Ref": "AppPipeline" } ] ] }, "RoleArn": { "Fn::GetAtt": [ "AmazonCloudWatchEventRole", "Arn" ] }, "Id": "codepipeline-AppPipeline" } ] } } }, ... ``` ------ 1. Add this snippet to your first template to allow cross\-stack functionality: ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
e76d46b3fdd7-0
``` Outputs: SourceBucketARN: Description: "S3 bucket ARN that Cloudtrail will use" Value: !GetAtt SourceBucket.Arn Export: Name: SourceBucketARN ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
5316d20cf497-0
``` "Outputs" : { "SourceBucketARN" : { "Description" : "S3 bucket ARN that Cloudtrail will use", "Value" : { "Fn::GetAtt": ["SourceBucket", "Arn"] }, "Export" : { "Name" : "SourceBucketARN" } } ... ``` ------ 1. Save your updated template to your local computer, and open the AWS CloudFormation console\. 1. Choose your stack, and then choose **Create Change Set for Current Stack**\. 1. Upload your updated template, and then view the changes listed in AWS CloudFormation\. These are the changes that will be made to the stack\. You should see your new resources in the list\. 1. Choose **Execute**\.<a name="proc-cfn-flag-s3"></a> **To edit your pipeline's PollForSourceChanges parameter** **Important**
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
5316d20cf497-1
**To edit your pipeline's PollForSourceChanges parameter** **Important** When you create a pipeline with this method, the `PollForSourceChanges` parameter defaults to true if it is not explicitly set to false\. When you add event\-based change detection, you must add the parameter to your output and set it to false to disable polling\. Otherwise, your pipeline starts twice for a single source change\. For details, see [Default settings for the PollForSourceChanges parameter](reference-pipeline-structure.md#PollForSourceChanges-defaults)\. + In the template, change `PollForSourceChanges` to `false`\. If you did not include `PollForSourceChanges` in your pipeline definition, add it and set it to `false`\. **Why am I making this change?** Changing `PollForSourceChanges` to `false` turns off periodic checks so you can use event\-based change detection only\. ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
86e08c2f0cd9-0
``` Name: Source Actions: - Name: SourceAction ActionTypeId: Category: Source Owner: AWS Version: 1 Provider: S3 OutputArtifacts: - Name: SourceOutput Configuration: S3Bucket: !Ref SourceBucket S3ObjectKey: !Ref SourceObjectKey PollForSourceChanges: false RunOrder: 1 ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
27c95a5214f7-0
``` { "Name": "SourceAction", "ActionTypeId": { "Category": "Source", "Owner": "AWS", "Version": 1, "Provider": "S3" }, "OutputArtifacts": [ { "Name": "SourceOutput" } ], "Configuration": { "S3Bucket": { "Ref": "SourceBucket" }, "S3ObjectKey": { "Ref": "SourceObjectKey" }, "PollForSourceChanges": false }, "RunOrder": 1 } ``` ------<a name="proc-cfn-event-s3-createtrail"></a> **To create a second template for your Amazon S3 pipeline's CloudTrail resources** + In a separate template, under `Resources`, use the `AWS::S3::Bucket`, `AWS::S3::BucketPolicy`, and `AWS::CloudTrail::Trail` AWS CloudFormation resources to provide a simple bucket definition and trail for CloudTrail\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
27c95a5214f7-1
**Why am I making this change? ** Given the current limit of five trails per account, the CloudTrail trail must be created and managed separately\. \(See [Limits in AWS CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/WhatIsCloudTrail-Limits.html)\.\) However, you can include many Amazon S3 buckets on a single trail, so you can create the trail once and then add Amazon S3 buckets for other pipelines as necessary\. Paste the following into your second sample template file\. ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
faf329ebef0c-0
``` ###################################################################################
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
b7c99366d19e-0
################################################################################### Parameters: SourceObjectKey: Description: 'S3 source artifact' Type: String Default: SampleApp_Linux.zip Resources: AWSCloudTrailBucketPolicy: Type: AWS::S3::BucketPolicy Properties: Bucket: !Ref AWSCloudTrailBucket PolicyDocument: Version: 2012-10-17 Statement: - Sid: AWSCloudTrailAclCheck Effect: Allow Principal: Service: - cloudtrail.amazonaws.com Action: s3:GetBucketAcl Resource: !GetAtt AWSCloudTrailBucket.Arn - Sid: AWSCloudTrailWrite Effect: Allow Principal: Service: - cloudtrail.amazonaws.com Action: s3:PutObject
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
b7c99366d19e-1
Principal: Service: - cloudtrail.amazonaws.com Action: s3:PutObject Resource: !Join [ '', [ !GetAtt AWSCloudTrailBucket.Arn, '/AWSLogs/', !Ref 'AWS::AccountId', '/*' ] ] Condition: StringEquals: s3:x-amz-acl: bucket-owner-full-control AWSCloudTrailBucket: Type: AWS::S3::Bucket DeletionPolicy: Retain AwsCloudTrail: DependsOn: - AWSCloudTrailBucketPolicy Type: AWS::CloudTrail::Trail Properties: S3BucketName: !Ref AWSCloudTrailBucket EventSelectors: - DataResources: - Type: AWS::S3::Object Values: - !Join [ '', [ !ImportValue SourceBucketARN, '/', !Ref SourceObjectKey ] ] ReadWriteType: WriteOnly IncludeGlobalServiceEvents: true IsLogging: true IsMultiRegionTrail: true ... ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-0
``` { "Parameters": { "SourceObjectKey": { "Description": "S3 source artifact", "Type": "String", "Default": "SampleApp_Linux.zip" } }, "Resources": { "AWSCloudTrailBucket": { "Type": "AWS::S3::Bucket", "DeletionPolicy": "Retain" }, "AWSCloudTrailBucketPolicy": { "Type": "AWS::S3::BucketPolicy", "Properties": { "Bucket": { "Ref": "AWSCloudTrailBucket" }, "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Sid": "AWSCloudTrailAclCheck", "Effect": "Allow", "Principal": { "Service": [ "cloudtrail.amazonaws.com" ] }, "Action": "s3:GetBucketAcl", "Resource": { "Fn::GetAtt": [
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-1
"Action": "s3:GetBucketAcl", "Resource": { "Fn::GetAtt": [ "AWSCloudTrailBucket", "Arn" ] } }, { "Sid": "AWSCloudTrailWrite", "Effect": "Allow", "Principal": { "Service": [ "cloudtrail.amazonaws.com" ] }, "Action": "s3:PutObject", "Resource": { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "AWSCloudTrailBucket", "Arn" ] }, "/AWSLogs/", { "Ref": "AWS::AccountId" }, "/*" ] ] }, "Condition": { "StringEquals": { "s3:x-amz-acl": "bucket-owner-full-control" } } } ] } }
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-2
} } } ] } } }, "AwsCloudTrail": { "DependsOn": [ "AWSCloudTrailBucketPolicy" ], "Type": "AWS::CloudTrail::Trail", "Properties": { "S3BucketName": { "Ref": "AWSCloudTrailBucket" }, "EventSelectors": [ { "DataResources": [ { "Type": "AWS::S3::Object", "Values": [ { "Fn::Join": [ "", [ { "Fn::ImportValue": "SourceBucketARN" }, "/", { "Ref": "SourceObjectKey" } ] ] } ] } ], "ReadWriteType": "WriteOnly" } ], "IncludeGlobalServiceEvents": true, "IsLogging": true,
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-3
} ], "IncludeGlobalServiceEvents": true, "IsLogging": true, "IsMultiRegionTrail": true } } } } ... ``` ------ **Example** When you use AWS CloudFormation to create these resources, your pipeline is triggered when files in your repository are created or updated\. Do not stop here\. Although your pipeline is created, you must create a second AWS CloudFormation template for your Amazon S3 pipeline\. If you do not create the second template, your pipeline does not have any change detection functionality\. ``` Resources: SourceBucket: Type: AWS::S3::Bucket Properties: VersioningConfiguration: Status: Enabled CodePipelineArtifactStoreBucket: Type: AWS::S3::Bucket CodePipelineArtifactStoreBucketPolicy: Type: AWS::S3::BucketPolicy Properties: Bucket: !Ref CodePipelineArtifactStoreBucket PolicyDocument: Version: 2012-10-17 Statement: - Sid: DenyUnEncryptedObjectUploads Effect: Deny
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-4
Statement: - Sid: DenyUnEncryptedObjectUploads Effect: Deny Principal: '*' Action: s3:PutObject Resource: !Join [ '', [ !GetAtt CodePipelineArtifactStoreBucket.Arn, '/*' ] ] Condition: StringNotEquals: s3:x-amz-server-side-encryption: aws:kms - Sid: DenyInsecureConnections Effect: Deny Principal: '*' Action: s3:* Resource: !Join [ '', [ !GetAtt CodePipelineArtifactStoreBucket.Arn, '/*' ] ] Condition: Bool: aws:SecureTransport: false CodePipelineServiceRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: Service: - codepipeline.amazonaws.com Action: sts:AssumeRole Path: / Policies: - PolicyName: AWS-CodePipeline-Service-3 PolicyDocument: Version: 2012-10-17
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-5
- PolicyName: AWS-CodePipeline-Service-3 PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: - codecommit:CancelUploadArchive - codecommit:GetBranch - codecommit:GetCommit - codecommit:GetUploadArchiveStatus - codecommit:UploadArchive Resource: '*' - Effect: Allow Action: - codedeploy:CreateDeployment - codedeploy:GetApplicationRevision - codedeploy:GetDeployment - codedeploy:GetDeploymentConfig - codedeploy:RegisterApplicationRevision Resource: '*' - Effect: Allow Action: - codebuild:BatchGetBuilds - codebuild:StartBuild Resource: '*' - Effect: Allow Action: - devicefarm:ListProjects - devicefarm:ListDevicePools - devicefarm:GetRun - devicefarm:GetUpload - devicefarm:CreateUpload - devicefarm:ScheduleRun
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-6
- devicefarm:GetUpload - devicefarm:CreateUpload - devicefarm:ScheduleRun Resource: '*' - Effect: Allow Action: - lambda:InvokeFunction - lambda:ListFunctions Resource: '*' - Effect: Allow Action: - iam:PassRole Resource: '*' - Effect: Allow Action: - elasticbeanstalk:* - ec2:* - elasticloadbalancing:* - autoscaling:* - cloudwatch:* - s3:* - sns:* - cloudformation:* - rds:* - sqs:* - ecs:* Resource: '*' AppPipeline: Type: AWS::CodePipeline::Pipeline Properties: Name: s3-events-pipeline RoleArn: !GetAtt CodePipelineServiceRole.Arn Stages: - Name: Source Actions: - Name: SourceAction ActionTypeId: Category: Source Owner: AWS Version: 1
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-7
Name: SourceAction ActionTypeId: Category: Source Owner: AWS Version: 1 Provider: S3 OutputArtifacts: - Name: SourceOutput Configuration: S3Bucket: !Ref SourceBucket S3ObjectKey: !Ref SourceObjectKey PollForSourceChanges: false RunOrder: 1 - Name: Beta Actions: - Name: BetaAction InputArtifacts: - Name: SourceOutput ActionTypeId: Category: Deploy Owner: AWS Version: 1 Provider: CodeDeploy Configuration: ApplicationName: !Ref ApplicationName DeploymentGroupName: !Ref BetaFleet RunOrder: 1 ArtifactStore: Type: S3 Location: !Ref CodePipelineArtifactStoreBucket AmazonCloudWatchEventRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: Service: - events.amazonaws.com Action: sts:AssumeRole
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-8
Effect: Allow Principal: Service: - events.amazonaws.com Action: sts:AssumeRole Path: / Policies: - PolicyName: cwe-pipeline-execution PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Action: codepipeline:StartPipelineExecution Resource: !Join [ '', [ 'arn:aws:codepipeline:', !Ref 'AWS::Region', ':', !Ref 'AWS::AccountId', ':', !Ref AppPipeline ] ] AmazonCloudWatchEventRule: Type: AWS::Events::Rule Properties: EventPattern: source: - aws.s3 detail-type: - 'AWS API Call via CloudTrail' detail: eventSource: - s3.amazonaws.com eventName: - PutObject - CompleteMultipartUpload resources: ARN: - !Join [ '', [ !GetAtt SourceBucket.Arn, '/', !Ref SourceObjectKey ] ] Targets: - Arn:
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-9
Targets: - Arn: !Join [ '', [ 'arn:aws:codepipeline:', !Ref 'AWS::Region', ':', !Ref 'AWS::AccountId', ':', !Ref AppPipeline ] ] RoleArn: !GetAtt AmazonCloudWatchEventRole.Arn Id: codepipeline-AppPipeline Outputs: SourceBucketARN: Description: "S3 bucket ARN that Cloudtrail will use" Value: !GetAtt SourceBucket.Arn Export: Name: SourceBucketARN ``` ``` "Resources": { "SourceBucket": { "Type": "AWS::S3::Bucket", "Properties": { "VersioningConfiguration": { "Status": "Enabled" } } }, "CodePipelineArtifactStoreBucket": { "Type": "AWS::S3::Bucket" }, "CodePipelineArtifactStoreBucketPolicy": { "Type": "AWS::S3::BucketPolicy", "Properties": { "Bucket": {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-10
"Type": "AWS::S3::BucketPolicy", "Properties": { "Bucket": { "Ref": "CodePipelineArtifactStoreBucket" }, "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Sid": "DenyUnEncryptedObjectUploads", "Effect": "Deny", "Principal": "*", "Action": "s3:PutObject", "Resource": { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "CodePipelineArtifactStoreBucket", "Arn" ] }, "/*" ] ] }, "Condition": { "StringNotEquals": { "s3:x-amz-server-side-encryption": "aws:kms" } } }, { "Sid": "DenyInsecureConnections", "Effect": "Deny", "Principal": "*",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-11
"Sid": "DenyInsecureConnections", "Effect": "Deny", "Principal": "*", "Action": "s3:*", "Resource": { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "CodePipelineArtifactStoreBucket", "Arn" ] }, "/*" ] ] }, "Condition": { "Bool": { "aws:SecureTransport": false } } } ] } } }, "CodePipelineServiceRole": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "codepipeline.amazonaws.com" ] }, "Action": "sts:AssumeRole"
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-12
"codepipeline.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] }, "Path": "/", "Policies": [ { "PolicyName": "AWS-CodePipeline-Service-3", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codecommit:CancelUploadArchive", "codecommit:GetBranch", "codecommit:GetCommit", "codecommit:GetUploadArchiveStatus", "codecommit:UploadArchive" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "codedeploy:CreateDeployment", "codedeploy:GetApplicationRevision", "codedeploy:GetDeployment", "codedeploy:GetDeploymentConfig", "codedeploy:RegisterApplicationRevision" ], "Resource": "*"
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-13
"codedeploy:RegisterApplicationRevision" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "codebuild:BatchGetBuilds", "codebuild:StartBuild" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "devicefarm:ListProjects", "devicefarm:ListDevicePools", "devicefarm:GetRun", "devicefarm:GetUpload", "devicefarm:CreateUpload", "devicefarm:ScheduleRun" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "lambda:InvokeFunction", "lambda:ListFunctions" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": "*" }, {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-14
"iam:PassRole" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "elasticbeanstalk:*", "ec2:*", "elasticloadbalancing:*", "autoscaling:*", "cloudwatch:*", "s3:*", "sns:*", "cloudformation:*", "rds:*", "sqs:*", "ecs:*" ], "Resource": "*" } ] } } ] } }, "AppPipeline": { "Type": "AWS::CodePipeline::Pipeline", "Properties": { "Name": "s3-events-pipeline", "RoleArn": { "Fn::GetAtt": [ "CodePipelineServiceRole", "Arn" ] }, "Stages": [ { "Name": "Source", "Actions": [ {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-15
"Stages": [ { "Name": "Source", "Actions": [ { "Name": "SourceAction", "ActionTypeId": { "Category": "Source", "Owner": "AWS", "Version": 1, "Provider": "S3" }, "OutputArtifacts": [ { "Name": "SourceOutput" } ], "Configuration": { "S3Bucket": { "Ref": "SourceBucket" }, "S3ObjectKey": { "Ref": "SourceObjectKey" }, "PollForSourceChanges": false }, "RunOrder": 1 } ] }, { "Name": "Beta", "Actions": [ { "Name": "BetaAction", "InputArtifacts": [ { "Name": "SourceOutput" } ], "ActionTypeId": { "Category": "Deploy",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-16
} ], "ActionTypeId": { "Category": "Deploy", "Owner": "AWS", "Version": 1, "Provider": "CodeDeploy" }, "Configuration": { "ApplicationName": { "Ref": "ApplicationName" }, "DeploymentGroupName": { "Ref": "BetaFleet" } }, "RunOrder": 1 } ] } ], "ArtifactStore": { "Type": "S3", "Location": { "Ref": "CodePipelineArtifactStoreBucket" } } } }, "AmazonCloudWatchEventRole": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": [ "events.amazonaws.com" ] },
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-17
"Principal": { "Service": [ "events.amazonaws.com" ] }, "Action": "sts:AssumeRole" } ] }, "Path": "/", "Policies": [ { "PolicyName": "cwe-pipeline-execution", "PolicyDocument": { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "codepipeline:StartPipelineExecution", "Resource": { "Fn::Join": [ "", [ "arn:aws:codepipeline:", { "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" }, ":", { "Ref": "AppPipeline" } ] ] } } ] } } ] } }, "AmazonCloudWatchEventRule": {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-18
} } ] } }, "AmazonCloudWatchEventRule": { "Type": "AWS::Events::Rule", "Properties": { "EventPattern": { "source": [ "aws.s3" ], "detail-type": [ "AWS API Call via CloudTrail" ], "detail": { "eventSource": [ "s3.amazonaws.com" ], "eventName": [ "PutObject", "CompleteMultipartUpload" ], "resources": { "ARN": [ { "Fn::Join": [ "", [ { "Fn::GetAtt": [ "SourceBucket", "Arn" ] }, "/", { "Ref": "SourceObjectKey" } ] ] } ] } } }, "Targets": [ {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-19
} ] } } }, "Targets": [ { "Arn": { "Fn::Join": [ "", [ "arn:aws:codepipeline:", { "Ref": "AWS::Region" }, ":", { "Ref": "AWS::AccountId" }, ":", { "Ref": "AppPipeline" } ] ] }, "RoleArn": { "Fn::GetAtt": [ "AmazonCloudWatchEventRole", "Arn" ] }, "Id": "codepipeline-AppPipeline" } ] } } }, "Outputs" : { "SourceBucketARN" : { "Description" : "S3 bucket ARN that Cloudtrail will use", "Value" : { "Fn::GetAtt": ["SourceBucket", "Arn"] }, "Export" : { "Name" : "SourceBucketARN"
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c0afa93c1868-20
"Export" : { "Name" : "SourceBucketARN" } } } } ... ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
b2725737c9af-0
Follow these steps to update your pipeline \(with a GitHub source\) from periodic checks \(polling\) to event\-based change detection using webhooks\. To build an event\-driven pipeline with AWS CodeCommit, you edit the `PollForSourceChanges` parameter of your pipeline and then add the following resources to your template: + A GitHub webhook If you use AWS CloudFormation to create and manage your pipelines, your template has content like the following\. **Note** Note the `PollForSourceChanges` configuration property in the source stage\. If your template doesn't include that property, then `PollForSourceChanges` is set to `true` by default\. ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c8b064839b91-0
``` Resources: AppPipeline: Type: AWS::CodePipeline::Pipeline Properties: Name: github-polling-pipeline RoleArn: !GetAtt CodePipelineServiceRole.Arn Stages: - Name: Source Actions: - Name: SourceAction ActionTypeId: Category: Source Owner: ThirdParty Version: 1 Provider: GitHub OutputArtifacts: - Name: SourceOutput Configuration: Owner: !Ref GitHubOwner Repo: !Ref RepositoryName Branch: !Ref BranchName OAuthToken: {{resolve:secretsmanager:MyGitHubSecret:SecretString:token}} PollForSourceChanges: true RunOrder: 1 ... ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
0d8310843e9d-0
``` "AppPipeline": { "Type": "AWS::CodePipeline::Pipeline", "Properties": { "Name": "github-polling-pipeline", "RoleArn": { "Fn::GetAtt": [ "CodePipelineServiceRole", "Arn" ] }, "Stages": [ { "Name": "Source", "Actions": [ { "Name": "SourceAction", "ActionTypeId": { "Category": "Source", "Owner": "ThirdParty", "Version": 1, "Provider": "GitHub" }, "OutputArtifacts": [ { "Name": "SourceOutput" } ], "Configuration": { "Owner": { "Ref": "GitHubOwner" }, "Repo": { "Ref": "RepositoryName" }, "Branch": { "Ref": "BranchName" },
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
0d8310843e9d-1
}, "Branch": { "Ref": "BranchName" }, "OAuthToken": "{{resolve:secretsmanager:MyGitHubSecret:SecretString:token}}", "PollForSourceChanges": true }, "RunOrder": 1 } ] }, ... ``` ------<a name="proc-cfn-webhook-github"></a> **To add parameters and create a webhook in your template** We strongly recommend that you use AWS Secrets Manager to store your credentials\. If you use Secrets Manager, you must have already configured and stored your secret parameters in Secrets Manager\. This example uses dynamic references to AWS Secrets Manager for the GitHub credentials for your webhook\. For more information, see [ Using Dynamic References to Specify Template Values](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html#dynamic-references-secretsmanager)\. **Important** When passing secret parameters, do not enter the value directly into the template\. The value is rendered as plaintext and is therefore readable\. For security reasons, do not use plaintext in your AWS CloudFormation template to store your credentials\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
0d8310843e9d-2
When you use the CLI or AWS CloudFormation to create a pipeline and add a webhook, you must disable periodic checks\. **Note** To disable periodic checks, you must explicitly add the `PollForSourceChanges` parameter and set it to false, as detailed in the final procedure below\. Otherwise, the default for a CLI or AWS CloudFormation pipeline is that `PollForSourceChanges` defaults to true and does not display in the pipeline structure output\. For more information about PollForSourceChanges defaults, see [Default settings for the PollForSourceChanges parameter](reference-pipeline-structure.md#PollForSourceChanges-defaults)\. 1. In the template, under `Resources`, add your parameters: ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
3dd5f07e6d90-0
``` Parameters: GitHubOwner: Type: String ... ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
411ce75ddebf-0
``` { "Parameters": { "BranchName": { "Description": "GitHub branch name", "Type": "String", "Default": "master" }, "GitHubOwner": { "Type": "String" }, ... ``` ------ 1. Use the `AWS::CodePipeline::Webhook` AWS CloudFormation resource to add a webhook\. **Note** The `TargetAction` you specify must match the `Name` property of the source action defined in the pipeline\. If `RegisterWithThirdParty` is set to `true`, make sure the user associated to the `OAuthToken` can set the required scopes in GitHub\. The token and webhook require the following GitHub scopes: + `repo` \- used for full control to read and pull artifacts from public and private repositories into a pipeline\. + `admin:repo_hook` \- used for full control of repository hooks\. Otherwise, GitHub returns a 404\. For more information about the 404 returned, see [https://help.github.com/articles/about-webhooks](https://help.github.com/articles/about-webhooks)\. ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
541f1cac8025-0
``` AppPipelineWebhook: Type: AWS::CodePipeline::Webhook Properties: Authentication: GITHUB_HMAC AuthenticationConfiguration: SecretToken: {{resolve:secretsmanager:MyGitHubSecret:SecretString:token}} Filters: - JsonPath: "$.ref" MatchEquals: refs/heads/{Branch} TargetPipeline: !Ref AppPipeline TargetAction: SourceAction Name: AppPipelineWebhook TargetPipelineVersion: !GetAtt AppPipeline.Version RegisterWithThirdParty: true ... ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
33aaf652cef7-0
``` "AppPipelineWebhook": { "Type": "AWS::CodePipeline::Webhook", "Properties": { "Authentication": "GITHUB_HMAC", "AuthenticationConfiguration": { "SecretToken": "{{resolve:secretsmanager:MyGitHubSecret:SecretString:token}}" }, "Filters": [ { "JsonPath": "$.ref", "MatchEquals": "refs/heads/{Branch}" } ], "TargetPipeline": { "Ref": "AppPipeline" }, "TargetAction": "SourceAction", "Name": "AppPipelineWebhook", "TargetPipelineVersion": { "Fn::GetAtt": [ "AppPipeline", "Version" ] }, "RegisterWithThirdParty": true } }, ... ``` ------ 1. Save the updated template to your local computer, and then open the AWS CloudFormation console\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
33aaf652cef7-1
------ 1. Save the updated template to your local computer, and then open the AWS CloudFormation console\. 1. Choose your stack, and then choose **Create Change Set for Current Stack**\. 1. Upload the template, and then view the changes listed in AWS CloudFormation\. These are the changes to be made to the stack\. You should see your new resources in the list\. 1. Choose **Execute**\.<a name="proc-cfn-flag-github"></a> **To edit your pipeline's PollForSourceChanges parameter** **Important** When you create a pipeline with this method, the `PollForSourceChanges` parameter defaults to true if it is not explicitly set to false\. When you add event\-based change detection, you must add the parameter to your output and set it to false to disable polling\. Otherwise, your pipeline starts twice for a single source change\. For details, see [Default settings for the PollForSourceChanges parameter](reference-pipeline-structure.md#PollForSourceChanges-defaults)\. + In the template, change `PollForSourceChanges` to `false`\. If you did not include `PollForSourceChanges` in your pipeline definition, add it and set it to false\. **Why am I making this change? ** Changing this parameter to `false` turns off periodic checks so you can use event\-based change detection only\. ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
c48bbeea4cd7-0
``` Name: Source Actions: - Name: SourceAction ActionTypeId: Category: Source Owner: ThirdParty Version: 1 Provider: GitHub OutputArtifacts: - Name: SourceOutput Configuration: Owner: !Ref GitHubOwner Repo: !Ref RepositoryName Branch: !Ref BranchName OAuthToken: {{resolve:secretsmanager:MyGitHubSecret:SecretString:token}} PollForSourceChanges: false RunOrder: 1 ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
adc3eefc0d19-0
``` { "Name": "Source", "Actions": [ { "Name": "SourceAction", "ActionTypeId": { "Category": "Source", "Owner": "ThirdParty", "Version": 1, "Provider": "GitHub" }, "OutputArtifacts": [ { "Name": "SourceOutput" } ], "Configuration": { "Owner": { "Ref": "GitHubOwner" }, "Repo": { "Ref": "RepositoryName" }, "Branch": { "Ref": "BranchName" }, "OAuthToken": "{{resolve:secretsmanager:MyGitHubSecret:SecretString:token}}", "PollForSourceChanges": false }, "RunOrder": 1 } ``` ------ **Example** When you create these resources with AWS CloudFormation, the webhook defined is created in the specified GitHub repository\. Your pipeline is triggered on commit\. ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
adc3eefc0d19-1
``` Parameters: GitHubOwner: Type: String Resources: AppPipelineWebhook: Type: AWS::CodePipeline::Webhook Properties: Authentication: GITHUB_HMAC AuthenticationConfiguration: SecretToken: {{resolve:secretsmanager:MyGitHubSecret:SecretString:token}} Filters: - JsonPath: "$.ref" MatchEquals: refs/heads/{Branch} TargetPipeline: !Ref AppPipeline TargetAction: SourceAction Name: AppPipelineWebhook TargetPipelineVersion: !GetAtt AppPipeline.Version RegisterWithThirdParty: true AppPipeline: Type: AWS::CodePipeline::Pipeline Properties: Name: github-events-pipeline RoleArn: !GetAtt CodePipelineServiceRole.Arn Stages: - Name: Source Actions: - Name: SourceAction ActionTypeId: Category: Source Owner: ThirdParty Version: 1 Provider: GitHub OutputArtifacts: - Name: SourceOutput Configuration:
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
adc3eefc0d19-2
Version: 1 Provider: GitHub OutputArtifacts: - Name: SourceOutput Configuration: Owner: !Ref GitHubOwner Repo: !Ref RepositoryName Branch: !Ref BranchName OAuthToken: {{resolve:secretsmanager:MyGitHubSecret:SecretString:token}} PollForSourceChanges: false RunOrder: 1 ... ``` ``` { "Parameters": { "BranchName": { "Description": "GitHub branch name", "Type": "String", "Default": "master" }, "RepositoryName": { "Description": "GitHub repository name", "Type": "String", "Default": "test" }, "GitHubOwner": { "Type": "String" }, "ApplicationName": { "Description": "CodeDeploy application name", "Type": "String", "Default": "DemoApplication" }, "BetaFleet": { "Description": "Fleet configured in CodeDeploy",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
adc3eefc0d19-3
}, "BetaFleet": { "Description": "Fleet configured in CodeDeploy", "Type": "String", "Default": "DemoFleet" } }, "Resources": { ... }, "AppPipelineWebhook": { "Type": "AWS::CodePipeline::Webhook", "Properties": { "Authentication": "GITHUB_HMAC", "AuthenticationConfiguration": { "SecretToken": { "{{resolve:secretsmanager:MyGitHubSecret:SecretString:token}}" } }, "Filters": [ { "JsonPath": "$.ref", "MatchEquals": "refs/heads/{Branch}" } ], "TargetPipeline": { "Ref": "AppPipeline" }, "TargetAction": "SourceAction", "Name": "AppPipelineWebhook", "TargetPipelineVersion": { "Fn::GetAtt": [ "AppPipeline", "Version" ] },
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
adc3eefc0d19-4
"Fn::GetAtt": [ "AppPipeline", "Version" ] }, "RegisterWithThirdParty": true } }, "AppPipeline": { "Type": "AWS::CodePipeline::Pipeline", "Properties": { "Name": "github-events-pipeline", "RoleArn": { "Fn::GetAtt": [ "CodePipelineServiceRole", "Arn" ] }, "Stages": [ { "Name": "Source", "Actions": [ { "Name": "SourceAction", "ActionTypeId": { "Category": "Source", "Owner": "ThirdParty", "Version": 1, "Provider": "GitHub" }, "OutputArtifacts": [ { "Name": "SourceOutput" } ], "Configuration": { "Owner": { "Ref": "GitHubOwner" }, "Repo": {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
adc3eefc0d19-5
"Owner": { "Ref": "GitHubOwner" }, "Repo": { "Ref": "RepositoryName" }, "Branch": { "Ref": "BranchName" }, "OAuthToken": "{{resolve:secretsmanager:MyGitHubSecret:SecretString:token}}", "PollForSourceChanges": false }, "RunOrder": 1 ... ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/update-change-detection.md
dec590e5bde3-0
To use CodePipeline in the CodePipeline console, you must have a minimum set of permissions from the following services: + AWS Identity and Access Management + Amazon Simple Storage Service These permissions allow you to describe other AWS resources for your AWS account\. Depending on the other services you incorporate into your pipelines, you might need permissions from one or more of the following: + AWS CodeCommit + CodeBuild + AWS CloudFormation + AWS CodeDeploy + AWS Elastic Beanstalk + AWS Lambda + AWS OpsWorks If you create an IAM policy that is more restrictive than the minimum required permissions, the console won't function as intended for users with that IAM policy\. To ensure that those users can still use the CodePipeline console, also attach the `AWSCodePipelineReadOnlyAccess` managed policy to the user, as described in [AWS managed \(predefined\) policies for CodePipeline](managed-policies.md)\. You don't need to allow minimum console permissions for users who are making calls to the AWS CLI or the CodePipeline API\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/security-iam-permissions-console.md
f93fabbd3ba8-0
AWS CodePipeline includes a number of actions that help you configure build, test, and deploy resources for your automated release process\. If your release process includes activities that are not included in the default actions, such as an internally developed build process or a test suite, you can create a custom action for that purpose and include it in your pipeline\. You can use the AWS CLI to create custom actions in pipelines associated with your AWS account\. You can create custom actions for the following AWS CodePipeline action categories: + A custom build action that builds or transforms the items + A custom deploy action that deploys items to one or more servers, websites, or repositories + A custom test action that configures and runs automated tests + A custom invoke action that runs functions When you create a custom action, you must also create a job worker that will poll CodePipeline for job requests for this custom action, execute the job, and return the status result to CodePipeline\. This job worker can be located on any computer or resource as long as it has access to the public endpoint for CodePipeline\. To easily manage access and security, consider hosting your job worker on an Amazon EC2 instance\. The following diagram shows a high\-level view of a pipeline that includes a custom build action:
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
f93fabbd3ba8-1
The following diagram shows a high\-level view of a pipeline that includes a custom build action: ![\[A high-level view of a pipeline that includes a custom build action.\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/images/PipelineCustomActionCS.png)![\[A high-level view of a pipeline that includes a custom build action.\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/)![\[A high-level view of a pipeline that includes a custom build action.\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/) When a pipeline includes a custom action as part of a stage, the pipeline will create a job request\. A custom job worker detects that request and performs that job \(in this example, a custom process using third\-party build software\)\. When the action is complete, the job worker returns either a success result or a failure result\. If a success result is received, the pipeline will transition the revision and its artifacts to the next action\. If a failure is returned, the pipeline will not transition the revision to the next action in the pipeline\. **Note** These instructions assume that you have already completed the steps in [Getting started with CodePipeline](getting-started-codepipeline.md)\. **Topics** + [Create a custom action](#actions-create-custom-action-cli)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
f93fabbd3ba8-2
**Topics** + [Create a custom action](#actions-create-custom-action-cli) + [Create a job worker for your custom action](#actions-create-custom-action-job-worker) + [Add a custom action to a pipeline](#actions-create-custom-action-add)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
81dd4c6dc662-0
**To create a custom action with the AWS CLI** 1. Open a text editor and create a JSON file for your custom action that includes the action category, the action provider, and any settings required by your custom action\. For example, to create a custom build action that requires only one property, your JSON file might look like this: ``` { "category": "Build", "provider": "My-Build-Provider-Name", "version": "1", "settings": { "entityUrlTemplate": "https://my-build-instance/job/{Config:ProjectName}/", "executionUrlTemplate": "https://my-build-instance/job/{Config:ProjectName}/lastSuccessfulBuild/{ExternalExecutionId}/" }, "configurationProperties": [{ "name": "ProjectName", "required": true, "key": true, "secret": false, "queryable": false, "description": "The name of the build project must be provided when this action is added to the pipeline.", "type": "String" }], "inputArtifactDetails": { "maximumCount": integer, "minimumCount": integer },
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
81dd4c6dc662-1
"maximumCount": integer, "minimumCount": integer }, "outputArtifactDetails": { "maximumCount": integer, "minimumCount": integer }, "tags": [{ "key": "Project", "value": "ProjectA" }] } ``` This example adds tagging to the custom action by including the `Project` tag key and `ProjectA` value on the custom action\. For more information about tagging resources in CodePipeline, see [Tagging resources](tag-resources.md)\. There are two properties included in the JSON file, `entityUrlTemplate` and `executionUrlTemplate`\. You can refer to a name in the configuration properties of the custom action within the URL templates by following the format of `{Config:name}`, as long as the configuration property is both required and not secret\. For example, in the sample above, the `entityUrlTemplate` value refers to the configuration property *ProjectName*\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
81dd4c6dc662-2
+ `entityUrlTemplate`: the static link that provides information about the service provider for the action\. In the example, the build system includes a static link to each build project\. The link format will vary, depending on your build provider \(or, if you are creating a different action type, such as test, other service provider\)\. You must provide this link format so that when the custom action is added, the user can choose this link to open a browser to a page on your website that provides the specifics for the build project \(or test environment\)\. + `executionUrlTemplate`: the dynamic link that will be updated with information about the current or most recent run of the action\. When your custom job worker updates the status of a job \(for example, success, failure, or in progress\), it will also provide an `externalExecutionId` that will be used to complete the link\. This link can be used to provide details about the run of an action\. For example, when you view the action in the pipeline, you see the following two links:
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
81dd4c6dc662-3
For example, when you view the action in the pipeline, you see the following two links: ![\[Links in the CodePipeline console lead to more information about the run of a pipeline.\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/images/codepipeline-calinksexplained.png)![\[Links in the CodePipeline console lead to more information about the run of a pipeline.\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/)![\[Links in the CodePipeline console lead to more information about the run of a pipeline.\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/) ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/images/number-1.png) This static link appears after you add your custom action and points to the address in `entityUrlTemplate`, which you specify when you create your custom action\. ![\[Image NOT FOUND\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/images/number-2.png) This dynamic link is updated after every run of the action and points to the address in `executionUrlTemplate`, which you specify when you create your custom action\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
81dd4c6dc662-4
For more information about these link types, as well as `RevisionURLTemplate` and `ThirdPartyURL`, see [ActionTypeSettings](https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_ActionTypeSettings.html) and [CreateCustomActionType](https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_CreateCustomActionType.html) in the [CodePipeline API Reference](https://docs.aws.amazon.com/codepipeline/latest/APIReference/)\. For more information about action structure requirements and how to create an action, see [CodePipeline pipeline structure reference](reference-pipeline-structure.md)\. 1. Save the JSON file and give it a name you can easily remember \(for example, *MyCustomAction*\.json\)\. 1. Open a terminal session \(Linux, OS X, Unix\) or command prompt \(Windows\) on a computer where you have installed the AWS CLI\. 1. Use the AWS CLI to run the aws codepipeline create\-custom\-action\-type command, specifying the name of the JSON file you just created\. For example, to create a build custom action: **Important** Be sure to include `file://` before the file name\. It is required in this command\. ```
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
81dd4c6dc662-5
Be sure to include `file://` before the file name\. It is required in this command\. ``` aws codepipeline create-custom-action-type --cli-input-json file://MyCustomAction.json ``` 1. This command returns the entire structure of the custom action you created, as well as the `JobList` action configuration property, which is added for you\. When you add the custom action to a pipeline, you can use `JobList` to specify which projects from the provider you can poll for jobs\. If you do not configure this, all available jobs will be returned when your custom job worker polls for jobs\. For example, the preceding command might return a structure similar to the following: ``` { "actionType": { "inputArtifactDetails": { "maximumCount": 1, "minimumCount": 1 }, "actionConfigurationProperties": [ { "secret": false, "required": true, "name": "ProjectName", "key": true, "description": "The name of the build project must be provided when this action is added to the pipeline." } ], "outputArtifactDetails": { "maximumCount": 0, "minimumCount": 0
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
81dd4c6dc662-6
"outputArtifactDetails": { "maximumCount": 0, "minimumCount": 0 }, "id": { "category": "Build", "owner": "Custom", "version": "1", "provider": "My-Build-Provider-Name" }, "settings": { "entityUrlTemplate": "https://my-build-instance/job/{Config:ProjectName}/", "executionUrlTemplate": "https://my-build-instance/job/mybuildjob/lastSuccessfulBuild/{ExternalExecutionId}/" } } } ``` **Note** As part of the output of the create\-custom\-action\-type command, the `id` section includes `"owner": "Custom"`\. CodePipeline automatically assigns `Custom` as the owner of custom action types\. This value can't be assigned or changed when you use the create\-custom\-action\-type command or the update\-pipeline command\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
2d48ecac9731-0
Custom actions require a job worker that will poll CodePipeline for job requests for the custom action, execute the job, and return the status result to CodePipeline\. The job worker can be located on any computer or resource as long as it has access to the public endpoint for CodePipeline\. There are many ways to design your job worker\. The following sections provide some practical guidance for developing your custom job worker for CodePipeline\. **Topics** + [Choose and configure a permissions management strategy for your job worker](#actions-create-custom-action-permissions) + [Develop a job worker for your custom action](#actions-create-custom-action-job-worker-workflow) + [Custom job worker architecture and examples](#actions-create-custom-action-job-worker-common)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
497955f28dc3-0
To develop a custom job worker for your custom action in CodePipeline, you will need a strategy for the integration of user and permission management\. The simplest strategy is to add the infrastructure you need for your custom job worker by creating Amazon EC2 instances with an IAM instance role, which allow you to easily scale up the resources you need for your integration\. You can use the built\-in integration with AWS to simplify the interaction between your custom job worker and CodePipeline\. **To set up Amazon EC2 instances** 1. Learn more about Amazon EC2 and determine whether it is the right choice for your integration\. For information, see [Amazon EC2 \- Virtual Server Hosting](http://aws.amazon.com/ec2)\. 1. Get started creating your Amazon EC2 instances\. For information, see [Getting Started with Amazon EC2 Linux Instances](https://docs.aws.amazon.com/AWSEC2/latest/GettingStartedGuide/)\. Another strategy to consider is using identity federation with IAM to integrate your existing identity provider system and resources\. This strategy is particularly useful if you already have a corporate identity provider or are already configured to support users using web identity providers\. Identity federation allows you to grant secure access to AWS resources, including CodePipeline, without having to create or manage IAM users\. You can use features and policies for password security requirements and credential rotation\. You can use sample applications as templates for your own design\. **To set up identity federation**
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
497955f28dc3-1
**To set up identity federation** 1. Learn more about IAM identity federation\. For information, see [Manage Federation](http://aws.amazon.com/iam/details/manage-federation/)\. 1. Review the examples in [Scenarios for Granting Temporary Access](https://docs.aws.amazon.com/STS/latest/UsingSTS/STSUseCases.html) to identify the scenario for temporary access that best fits the needs of your custom action\. 1. Review code examples of identity federation relevant to your infrastructure, such as: + [Identity Federation Sample Application for an Active Directory Use Case](http://aws.amazon.com/code/1288653099190193) 1. Get started configuring identity federation\. For information, see [Identity Providers and Federation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers.html) in *IAM User Guide*\. A third strategy to consider is to create an IAM user to use under your AWS account when running your custom action and job worker\. **To set up an IAM user** 1. Learn more about IAM best practices and use cases in [IAM Best Practices and Use Cases](https://docs.aws.amazon.com/IAM/latest/UserGuide/IAMBestPracticesAndUseCases.html)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
497955f28dc3-2
1. Get started creating IAM users by following the steps in [Creating an IAM User in Your AWS Account](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_SettingUpUser.html)\. The following is an example policy you might create for use with your custom job worker\. This policy is meant as an example only and is provided as\-is\. ``` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codepipeline:PollForJobs", "codepipeline:AcknowledgeJob", "codepipeline:GetJobDetails", "codepipeline:PutJobSuccessResult", "codepipeline:PutJobFailureResult" ], "Resource": [ "arn:aws:codepipeline:us-east-2::actionType:custom/Build/MyBuildProject/1/" ] } ] } ``` **Note** Consider using the `AWSCodePipelineCustomActionAccess` managed policy for the IAM user\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
9216ac289824-0
After you've chosen your permissions management strategy, you should consider how your job worker will interact with CodePipeline\. The following high\-level diagram shows the workflow of a custom action and job worker for a build process\. ![\[The workflow of a custom action and job worker for a build process.\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/images/PipelineCustomAgent.png)![\[The workflow of a custom action and job worker for a build process.\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/)![\[The workflow of a custom action and job worker for a build process.\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/) 1. Your job worker polls CodePipeline for jobs using `PollForJobs`\. 1. When a pipeline is triggered by a change in its source stage \(for example, when a developer commits a change\), the automated release process begins\. The process continues until the stage at which your custom action has been configured\. When it reaches your action in this stage, CodePipeline queues a job\. This job will appear if your job worker calls `PollForJobs` again to get status\. Take the job detail from `PollForJobs` and pass it back to your job worker\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
9216ac289824-1
1. The job worker calls `AcknowledgeJob` to send CodePipeline a job acknowledgment\. CodePipeline returns an acknowledgment that indicates the job worker should continue the job \(`InProgress`\), or, if you have more than one job worker polling for jobs and another job worker has already claimed the job, an `InvalidNonceException` error response will be returned\. After the `InProgress` acknowledgment, CodePipeline waits for results to be returned\. 1. The job worker initiates your custom action on the revision, and then your action runs\. Along with any other actions, your custom action returns a result to the job worker\. In the example of a build custom action, the action pulls artifacts from the Amazon S3 bucket, builds them, and pushes successfully built artifacts back to the Amazon S3 bucket\. 1. While the action is running, the job worker can call `PutJobSuccessResult` with a continuation token \(the serialization of the state of the job generated by the job worker, for example a build identifier in JSON format, or an Amazon S3 object key\), as well as the `ExternalExecutionId` information that will be used to populate the link in `executionUrlTemplate`\. This will update the console view of the pipeline with a working link to specific action details while it is in progress\. Although not required, it is a best practice because it enables users to view the status of your custom action while it runs\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
9216ac289824-2
Once `PutJobSuccessResult` is called, the job is considered complete\. A new job is created in CodePipeline that includes the continuation token\. This job will appear if your job worker calls `PollForJobs` again\. This new job can be used to check on the state of the action, and either returns with a continuation token, or returns without a continuation token once the action is complete\. **Note** If your job worker performs all the work for a custom action, you should consider breaking your job worker processing into at least two steps\. The first step establishes the details page for your action\. Once you have created the details page, you can serialize the state of the job worker and return it as a continuation token, subject to size limits \(see [Quotas in AWS CodePipeline](limits.md)\)\. For example, you could write the state of the action into the string you use as the continuation token\. The second step \(and subsequent steps\) of your job worker processing perform the actual work of the action\. The final step returns success or failure to CodePipeline, with no continuation token on the final step\. For more information about using the continuation token, see the specifications for `PutJobSuccessResult` in the [CodePipeline API Reference](http://docs.aws.amazon.com/codepipeline/latest/APIReference)\. 1. Once the custom action completes, the job worker returns the result of the custom action to CodePipeline by calling one of two APIs: + `PutJobSuccessResult` without a continuation token, which indicates the custom action ran successfully
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
9216ac289824-3
+ `PutJobSuccessResult` without a continuation token, which indicates the custom action ran successfully + `PutJobFailureResult`, which indicates the custom action did not run successfully Depending on the result, the pipeline will either continue on to the next action \(success\) or stop \(failure\)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
3902c8e7076a-0
After you have mapped out your high\-level workflow, you can create your job worker\. Although the specifics of your custom action will ultimately determine what is needed for your job worker, most job workers for custom actions include the following functionality: + Polling for jobs from CodePipeline using `PollForJobs`\. + Acknowledging jobs and returning results to CodePipeline using `AcknowledgeJob`, `PutJobSuccessResult`, and `PutJobFailureResult`\. + Retrieving artifacts from and/or putting artifacts into the Amazon S3 bucket for the pipeline\. To download artifacts from the Amazon S3 bucket, you must create an Amazon S3 client that uses Signature Version 4 signing \(Sig V4\)\. Sig V4 is required for SSE\-KMS\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
3902c8e7076a-1
To upload artifacts to the Amazon S3 bucket, you must additionally configure the Amazon S3 `[PutObject](https://docs.aws.amazon.com/AmazonS3/latest/API/SOAPPutObject.html)` request to use encryption\. Currently only SSE\-KMS is supported for encryption\. In order to know whether to use the default key or a customer\-managed key to upload artifacts, your custom job worker must look at the [job data](https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_JobData.html) and check the [encryption key](https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_EncryptionKey.html) property\. If the encryption key property is set, you should use that encryption key ID when configuring SSE\-KMS\. If the key is null, you use the default master key\. CodePipeline uses the default Amazon S3 master key unless otherwise configured\. The following sample shows how to create the KMS parameters in Java: ``` private static SSEAwsKeyManagementParams createSSEAwsKeyManagementParams(final EncryptionKey encryptionKey) { if (encryptionKey != null && encryptionKey.getId() != null && EncryptionKeyType.KMS.toString().equals(encryptionKey.getType())) { // Use a customer-managed encryption key return new SSEAwsKeyManagementParams(encryptionKey.getId());
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
3902c8e7076a-2
// Use a customer-managed encryption key return new SSEAwsKeyManagementParams(encryptionKey.getId()); } // Use the default master key return new SSEAwsKeyManagementParams(); } ``` For more samples, see [Specifying the AWS Key Management Service in Amazon S3 Using the AWS SDKs](https://docs.aws.amazon.com/AmazonS3/latest/dev/kms-using-sdks.html)\. For more information about the Amazon S3 bucket for CodePipeline, see [CodePipeline concepts](concepts.md)\. A more complex example of a custom job worker is available on GitHub\. This sample is open source and provided as\-is\. + [Sample Job Worker for CodePipeline](https://github.com/awslabs/aws-codepipeline-custom-job-worker): Download the sample from the GitHub repository\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
927b2bbe0d5b-0
After you have a job worker, you can add your custom action to a pipeline by creating a new one and choosing it when you use the Create Pipeline wizard, by editing an existing pipeline and adding the custom action, or by using the AWS CLI, the SDKs, or the APIs\. **Note** You can create a pipeline in the Create Pipeline wizard that includes a custom action if it is a build or deploy action\. If your custom action is in the test category, you must add it by editing an existing pipeline\. **Topics** + [Add a custom action to a pipeline \(console\)](#actions-create-custom-action-add-console) + [Add a custom action to an existing pipeline \(CLI\)](#actions-create-custom-action-add-cli)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
fe75e26599a4-0
To create a pipeline with your custom action by using the CodePipeline console, follow the steps in [Create a pipeline in CodePipeline](pipelines-create.md) and choose your custom action from as many stages as you would like to test\. To add your custom action to an existing pipeline by using the CodePipeline console, follow the steps in [Edit a pipeline in CodePipeline](pipelines-edit.md) and add your custom action to one or more stages in the pipeline\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
e71e661cb723-0
You can use the AWS CLI to add a custom action to an existing pipeline\. 1. Open a terminal session \(Linux, macOS, or Unix\) or command prompt \(Windows\) and run the get\-pipeline command to copy the pipeline structure you want to edit into a JSON file\. For example, for a pipeline named **MyFirstPipeline**, you would type the following command: ``` aws codepipeline get-pipeline --name MyFirstPipeline >pipeline.json ``` This command returns nothing, but the file you created should appear in the directory where you ran the command\. 1. Open the JSON file in any text editor and modify the structure of the file to add your custom action to an existing stage\. **Note** If you want your action to run in parallel with another action in that stage, make sure you assign it the same `runOrder` value as that action\. For example, to modify the structure of a pipeline to add a stage named Build and to add a build custom action to that stage, you might modify the JSON to add the Build stage before a deployment stage as follows: ``` , { "name": "MyBuildStage", "actions": [ { "inputArtifacts": [ { "name": "MyApp" } ], "name": "MyBuildCustomAction",
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
e71e661cb723-1
"name": "MyApp" } ], "name": "MyBuildCustomAction", "actionTypeId": { "category": "Build", "owner": "Custom", "version": "1", "provider": "My-Build-Provider-Name" }, "outputArtifacts": [ { "name": "MyBuiltApp" } ], "configuration": { "ProjectName": "MyBuildProject" }, "runOrder": 1 } ] }, { "name": "Staging", "actions": [ { "inputArtifacts": [ { "name": "MyBuiltApp" } ], "name": "Deploy-CodeDeploy-Application", "actionTypeId": { "category": "Deploy", "owner": "AWS", "version": "1", "provider": "CodeDeploy" }, "outputArtifacts": [], "configuration": {
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
e71e661cb723-2
}, "outputArtifacts": [], "configuration": { "ApplicationName": "CodePipelineDemoApplication", "DeploymentGroupName": "CodePipelineDemoFleet" }, "runOrder": 1 } ] } ] } ``` 1. To apply your changes, run the update\-pipeline command, specifying the pipeline JSON file, similar to the following: **Important** Be sure to include `file://` before the file name\. It is required in this command\. ``` aws codepipeline update-pipeline --cli-input-json file://pipeline.json ``` This command returns the entire structure of the edited pipeline\. 1. Open the CodePipeline console and choose the name of the pipeline you just edited\. The pipeline shows your changes\. The next time you make a change to the source location, the pipeline will run that revision through the revised structure of the pipeline\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/actions-create-custom-action.md
bdbd8e186b9a-0
Triggers the pipeline when a new image is pushed to the Amazon ECR repository\. This action provides an image definitions file referencing the URI for the image that was pushed to Amazon ECR\. This source action is often used in conjunction with another source action, such as CodeCommit, to allow a source location for all other source artifacts\. For more information, see [Tutorial: Create a pipeline with an Amazon ECR source and ECS\-to\-CodeDeploy deployment](tutorials-ecs-ecr-codedeploy.md)\. When you use the console to create or edit your pipeline, CodePipeline creates a CloudWatch Events rule that starts your pipeline when a change occurs in the repository\. You must have already created an Amazon ECR repository and pushed an image before you connect the pipeline through an Amazon ECR action\. **Topics** + [Action type](#action-reference-ECR-type) + [Configuration parameters](#action-reference-ECR-config) + [Input artifacts](#action-reference-ECR-input) + [Output artifacts](#action-reference-ECR-output) + [Output variables](#action-reference-ECR-variables) + [Action declaration \(Amazon ECR example\)](#action-reference-ECR-example) + [See also](#action-reference-ECR-links)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference-ECR.md
a64247e14c99-0
+ Category: `Source` + Owner: `AWS` + Provider: `ECR` + Version: `1`
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference-ECR.md
567a1ec2c553-0
**RepositoryName** Required: Yes The name of the Amazon ECR repository where the image was pushed\. **ImageTag** Required: No The tag used for the image\. If a value for `ImageTag` is not specified, the value defaults to `latest`\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference-ECR.md
4b55b24e383b-0
+ **Number of Artifacts:** `0` + **Description:** Input artifacts do not apply for this action type\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference-ECR.md
e5f3121d45b6-0
+ **Number of Artifacts:** `1` + **Description:** This action produces an artifact that contains an `imageDetail.json` file that contains the URI for the image that triggered the pipeline execution\. For information about the `imageDetail.json` file, see [imageDetail\.json file for Amazon ECS blue/green deployment actions](file-reference.md#file-reference-ecs-bluegreen)\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference-ECR.md
fffc101d7aad-0
When configured, this action produces variables that can be referenced by the action configuration of a downstream action in the pipeline\. This action produces variables which can be viewed as output variables, even if the action doesn't have a namespace\. You configure an action with a namespace to make those variables available to the configuration of downstream actions\. For more information, see [Variables](reference-variables.md)\. **RegistryId** The AWS account ID associated with the registry that contains the repository\. **RepositoryName** The name of the Amazon ECR repository where the image was pushed\. **ImageTag** The tag used for the image\. **ImageDigest** The `sha256` digest of the image manifest\. **ImageURI** The URI for the image\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference-ECR.md
6e87745ca3a6-0
------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference-ECR.md
c543bcba9f02-0
``` Name: Source Actions: - InputArtifacts: [] ActionTypeId: Version: '1' Owner: AWS Category: Source Provider: ECR OutputArtifacts: - Name: SourceArtifact RunOrder: 1 Configuration: ImageTag: latest RepositoryName: my-image-repo Name: ImageSource ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference-ECR.md
16317d4b7603-0
``` { "Name": "Source", "Actions": [ { "InputArtifacts": [], "ActionTypeId": { "Version": "1", "Owner": "AWS", "Category": "Source", "Provider": "ECR" }, "OutputArtifacts": [ { "Name": "SourceArtifact" } ], "RunOrder": 1, "Configuration": { "ImageTag": "latest", "RepositoryName": "my-image-repo" }, "Name": "ImageSource" } ] }, ``` ------
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference-ECR.md
0d0fb75b40d6-0
The following related resources can help you as you work with this action\. + [Tutorial: Create a pipeline with an Amazon ECR source and ECS\-to\-CodeDeploy deployment](tutorials-ecs-ecr-codedeploy.md) – This tutorial provides a sample app spec file and sample CodeDeploy application and deployment group to create a pipeline with a CodeCommit and Amazon ECR source that deploys to Amazon ECS instances\.
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference-ECR.md
f32f018dfb02-0
This section is a reference for action configuration only\. For a conceptual overview of the pipeline structure, see [CodePipeline pipeline structure reference](reference-pipeline-structure.md)\. Each action provider in CodePipeline uses a set of required and optional configuration fields in the pipeline structure\. This section provides the following reference information by action provider: + Valid values for the `ActionType` fields included in the pipeline structure action block, such as `Owner` and `Provider`\. + Descriptions and other reference information for the `Configuration` parameters \(required and optional\) included in the pipeline structure action section\. + Valid example JSON and YAML action fields\. This section is updated periodically with more action providers\. Reference information is currently available for the following action providers: **Topics** + [Amazon ECR](action-reference-ECR.md) + [Amazon ECS and CodeDeploy Blue\-Green](action-reference-ECSbluegreen.md) + [Amazon Elastic Container Service](action-reference-ECS.md) + [Amazon S3](action-reference-S3.md) + [AWS AppConfig](action-reference-AppConfig.md) + [AWS CloudFormation](action-reference-CloudFormation.md) + [AWS CodeBuild](action-reference-CodeBuild.md) + [AWS CodeCommit](action-reference-CodeCommit.md)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference.md
f32f018dfb02-1
+ [AWS CodeCommit](action-reference-CodeCommit.md) + [AWS CodeDeploy](action-reference-CodeDeploy.md) + [AWS Device Farm](action-reference-DeviceFarm.md) + [AWS Lambda](action-reference-Lambda.md) + [AWS Step Functions](action-reference-StepFunctions.md) + [CodeStarSourceConnection](action-reference-CodestarConnectionSource.md) + [GitHub](action-reference-GitHub.md)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/action-reference.md
6e7204517b57-0
If you are new to CodePipeline, you can follow the tutorials in this guide after following the steps in this chapter to get set up\. The CodePipeline console includes helpful information in a collapsible panel that you can open from the information icon or any **Info** link on the page\. \(![\[Image NOT FOUND\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/images/console-info-icon.png)\)\. You can close this panel at any time\. ![\[Viewing additional guidance in the console\]](http://docs.aws.amazon.com/codepipeline/latest/userguide/images/codepipeline-guidance-open.png) The CodePipeline console also provides a way to quickly search for your resources, such as repositories, build projects, deployment applications, and pipelines\. Choose **Go to resource** or press the `/` key, and then type the name of the resource\. Any matches appear in the list\. Searches are case insensitive\. You only see resources that you have permissions to view\. For more information, see [Viewing resources in the console](security-iam-resources-console.md)\. Before you can use AWS CodePipeline for the first time, you must complete the following steps\. **Topics** + [Step 1: Create an AWS account](#create-aws-account) + [Step 2: Create or use an IAM user](#create-iam-user)
https://github.com/siagholami/aws-documentation/tree/main/documents/aws-codepipeline-user-guide/doc_source/getting-started-codepipeline.md