Add a manual approval action to a pipeline in CodePipeline
You can add an approval action to a stage in a CodePipeline pipeline at the point where you want the pipeline to stop so someone can manually approve or reject the action.
Note
Approval actions can't be added to Source stages. Source stages can contain only source actions.
If you want to use Amazon SNS to send notifications when an approval action is ready for review, you must first complete the following prerequisites:
-
Grant permission to your CodePipeline service role to access Amazon SNS resources. For information, see Grant Amazon SNS permissions to a CodePipeline service role.
-
Grant permission to one or more IAM identities in your organization to update the status of an approval action. For information, see Grant approval permissions to an IAM user in CodePipeline.
In this example, you create a new approval stage and add a manual approval action to the stage. You can also add a manual approval action to an existing stage that contains other actions.
Add a manual approval action to a CodePipeline pipeline (console)
You can use the CodePipeline console to add an approval action to an existing CodePipeline pipeline. You must use the AWS CLI if you want to add approval actions when you create a new pipeline.
Open the CodePipeline console at https://console.aws.amazon.com/codepipeline/
. -
In Name, choose the pipeline.
-
On the pipeline details page, choose Edit.
-
If you want to add an approval action to a new stage, choose + Add stage at the point in the pipeline where you want to add an approval request, and enter a name for the stage. On the Add stage page, in Stage name, enter your new stage name. For example, add a new stage and name it
Manual_Approval
.If you want to add an approval action to an existing stage, choose Edit stage.
-
In the stage where you want to add the approval action, choose + Add action group.
-
On the Edit action page, do the following:
-
In Action name, enter a name to identify the action.
-
In Action provider, under Approval, choose Manual approval.
-
(Optional) In SNS topic ARN, choose the name of the topic to be used to send notifications for the approval action.
-
(Optional) In URL for review, enter the URL of the page or application you want the approver to examine. Approvers can access this URL through a link included in the console view of the pipeline.
-
(Optional) In Comments, enter any other information you want to share with the reviewer.
-
Choose Save.
-
Add a manual approval action to a CodePipeline pipeline (CLI)
You can use the CLI to add an approval action to an existing pipeline or when you create a pipeline. You do this by including an approval action, with the Manual approval type, in a stage you are creating or editing.
For more information about creating and editing pipelines, see Create a pipeline, stages, and actions and Edit a pipeline in CodePipeline.
To add a stage to a pipeline that includes only an approval action, you would include something similar to the following example when you create or update the pipeline.
Note
The configuration
section is optional. This is just a portion,
not the entire structure, of the file. For more information, see CodePipeline pipeline structure reference.
{ "name": "
MyApprovalStage
", "actions": [ { "name": "MyApprovalAction
", "actionTypeId": { "category": "Approval", "owner": "AWS", "version": "1", "provider": "Manual" }, "inputArtifacts": [], "outputArtifacts": [], "configuration": { "NotificationArn": "", "ExternalEntityLink": "
arn:aws:sns:us-east-2:80398EXAMPLE:MyApprovalTopic
http://example.com
", "CustomData": "The latest changes include feedback from Bob.
"}, "runOrder": 1 } ] }
If the approval action is in a stage with other actions, the section of your JSON file that contains the stage might look similar instead to the following example.
Note
The configuration
section is optional. This is just a portion,
not the entire structure, of the file. For more information, see CodePipeline pipeline structure reference.
, { "name": "
Production
", "actions": [ { "inputArtifacts": [], "name": "MyApprovalAction
", "actionTypeId": { "category": "Approval", "owner": "AWS", "version": "1", "provider": "Manual" }, "outputArtifacts": [], "configuration": { "NotificationArn": "arn:aws:sns:us-east-2:80398EXAMPLE:MyApprovalTopic
", "ExternalEntityLink": "http://example.com
", "CustomData": "The latest changes include feedback from Bob.
" }, "runOrder": 1 }, { "inputArtifacts": [ { "name": "MyApp
" } ], "name": "MyDeploymentAction
", "actionTypeId": { "category": "Deploy", "owner": "AWS", "version": "1", "provider": "CodeDeploy" }, "outputArtifacts": [], "configuration": { "ApplicationName": "MyDemoApplication
", "DeploymentGroupName": "MyProductionFleet
" }, "runOrder": 2 } ] }