AWS CDK Pipeline deployment fails - Cannot create AWS CodePipeline

72 Views Asked by At

I am trying to deploy an AWS CDK Pipeline into a personal AWS account. I am following this tutorial.

I get the following error:

19:38:51 | CREATE_FAILED        | AWS::CodePipeline::Pipeline | MyPipeline92D3D757
Internal Failure

This error is also seen in AWS CloudFormation, when I look at the Stack, it says it failed at creating the pipeline.

1

There are 1 best solutions below

0
Daniel Apt On

For me, this was caused because the AWS CodePipeline could not authenticate with my (personal) Github account. The AWS CodePipeline is needed when creating a CDK pipeline.

I had defined my Pipeline to read the source code from my Github account:

const pipeline = new CodePipeline(this, 'MyPipeline', {
  pipelineName: 'MyPipeline',
  synth: new ShellStep('Synth', {
    input: CodePipelineSource.gitHub('DanielApt/iamapt-cdk', 'main'),
    commands: ['npm ci', 'npm run build', 'npx cdk synth']
  })
});

The Pipeline could not be created, because my AWS account could not authenticate with my Github account. AWS uses a secret stored in AWS Secrets Manager, called github-token.

I did not have this, so I created the github-token as follows:

  1. Create a Github personal access token - see documentation to learn more .
  • Make sure it has the repo and admin:repo_hook scopes selected.
  1. Store it in AWS Secrets Manager. The secret's value should be the access token, and the secret name must be github-token