CodePipeline is not authorized to perform AssumeRole on role arn:aws:iam::<>:role/CodePipeline-Cfn-Guard-Demo-Role

0

Hi guys can you help with the error at the topic? I followed this one tutorial to integrate cloud formation guard into CI/CD pipeline. I need to create a policy for codepipeline, the policy as below:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "codecommit:UploadArchive",
                "codecommit:CancelUploadArchive",
                "codecommit:GetCommit",
                "codecommit:GetUploadArchiveStatus",
                "codecommit:GetBranch",
                "codestar-connections:UseConnection",
                "codebuild:BatchGetBuilds",
                "codedeploy:CreateDeployment",
                "codedeploy:GetApplicationRevision",
                "codedeploy:RegisterApplicationRevision",
                "codedeploy:GetDeploymentConfig",
                "codedeploy:GetDeployment",
                "codebuild:StartBuild",
                "codedeploy:GetApplication",
                "s3:*",
                "cloudformation:*",
                "ec2:*"
            ],
            "Resource": "*"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "iam:PassRole",
            "Resource": "*",
            "Condition": {
                "StringEqualsIfExists": {
                    "iam:PassedToService": [
                        "cloudformation.amazonaws.com",
                        "ec2.amazonaws.com"
                    ]
                }
            }
        }
    ]
}

Name for this policy is CodePipeline-Cfn-Guard-Demo-Role Then i create a trust policy for the CodePipeline, the trust policy looks like this:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "codepipeline.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

Then i create the role called CodePipeline-Cfn-Guard-Demo-Role with this trust policy. Then i attached the created policy called CodePipeline-Cfn-Guard-Demo.

Then after i want to try to create the pipeline i got the following error CodePipeline is not authorized to perform AssumeRole on role arn:aws:iam::<>:role/CodePipeline-Cfn-Guard-Demo-Role

Can help me with this problem?

1개 답변
1
수락된 답변

Kindly check whether the role which was created for codepipeline is selected while creating the pipeline. The error refers to the role which was used is not authorized to perform Assumerole.

Further, check whether the cloudformation role which was created have the permission policy attached to it and select the cloudformation role in add deploy stage page.

[Enter image description here

I was able to successfully follow the blog and pipeline is completed successfully.

profile picture
답변함 7달 전
profile picture
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠