Cross Account Deployment pipeline in AWS

{
   "pipeline":{
      "name":"api-production-crossaccount",
      "roleArn":"arn:aws:iam::{source_account}:role/AWS-CodePipeline-Service",
      "artifactStore":{
         "type":"S3",
         "location":"codepipeline-eu-west-1-223332327482136",
         "encryptionKey":{
            "id":"arn:aws:kms:eu-west-1:{source_account}:key/2dbee9a0-8360-4d38-9f37-6c8e9b94efe7",
            "type":"KMS"
         }
      },
      "stages":[
         {
            "name":"Source",
            "actions":[
               {
                  "name":"Source",
                  "actionTypeId":{
                     "category":"Source",
                     "owner":"AWS",
                     "provider":"CodeCommit",
                     "version":"1"
                  },
                  "runOrder":1,
                  "configuration":{
                     "BranchName":"master",
                     "OutputArtifactFormat":"CODE_ZIP",
                     "PollForSourceChanges":"true",
                     "RepositoryName":"repo-name"
                  },
                  "outputArtifacts":[
                     {
                        "name":"SourceArtifact"
                     }
                  ],
                  "inputArtifacts":[
                     
                  ],
                  "region":"eu-west-1",
                  "namespace":"SourceVariables"
               }
            ]
         },
         {
            "name":"Deploy",
            "actions":[
               {
                  "name":"Deploy",
                  "actionTypeId":{
                     "category":"Deploy",
                     "owner":"AWS",
                     "provider":"CodeDeploy",
                     "version":"1"
                  },
                  "runOrder":1,
                  "configuration":{
                     "ApplicationName":"planboard-api",
                     "DeploymentGroupName":"production"
                  },
                  "outputArtifacts":[
                     
                  ],
                  "inputArtifacts":[
                     {
                        "name":"SourceArtifact"
                     }
                  ],
                  "roleArn":"arn:aws:iam::{target_account}:role/crossaccountRoleforSourceAccount",
                  "region":"eu-west-1",
                  "namespace":"DeployVariables"
               }
            ]
         }
      ],
      "version":1
   }
}

Leave a Comment

Your email address will not be published.