Documentation Index
Fetch the complete documentation index at: https://mintlify.com/okruti-raghuraj/aws-1/llms.txt
Use this file to discover all available pages before exploring further.
AwsCdkPipelineStack is the top-level CDK stack for this project. It provisions a fully managed, self-mutating AWS CodePipeline that watches a GitHub repository and automatically rebuilds and redeploys your CDK application whenever changes are pushed to the tracked branch.
Overview
AwsCdkPipelineStack extends cdk.Stack and serves as the entry point for the entire CI/CD infrastructure. It uses the higher-level CodePipeline construct from aws-cdk-lib/pipelines, which wraps AWS CodePipeline and CodeBuild into a single, opinionated abstraction that understands CDK app structure.
aws-cdk-pipeline/lib/aws-cdk-pipeline-stack.ts
Constructor Parameters
The parent construct for this stack. In practice this is always the
cdk.App instance created in bin/aws-cdk-pipeline.ts.The logical ID of the stack within the CDK app. This project passes
'AwsCdkPipelineStack', which also becomes the CloudFormation stack name used during cdk deploy.Optional stack properties. The
env field pins the stack to a specific AWS account and region. This project targets account 602143770054 in ap-south-1.The CodePipeline Construct
The CodePipeline construct (from aws-cdk-lib/pipelines) is the heart of this stack. It creates an AWS CodePipeline with a built-in self-mutation stage — meaning the pipeline will update its own definition before deploying application changes. The three configuration options used here are:
| Option | Value | Purpose |
|---|---|---|
pipelineName | 'TestPipeline' | Human-readable name shown in the AWS Console under CodePipeline. |
crossAccountKeys | false | Disables cross-account KMS key creation, reducing cost and complexity for single-account deployments. |
synth | ShellStep(...) | Defines the CodeBuild action that synthesizes the CDK app into a CloudFormation template. |
The ShellStep (Synth Step)
The synth step is the CodeBuild phase that converts your TypeScript CDK app into CloudFormation templates. It is configured with two key properties:
CodePipelineSource.gitHub('RaghurajSingh/SMS', 'aws-pipeline') — connects to the aws-pipeline branch of the RaghurajSingh/SMS GitHub repository. CodePipeline polls this source and triggers on every push. A GitHub OAuth connection (or a GitHub App connection) must be established in the target AWS account for this to work.An ordered array of shell commands executed inside the CodeBuild environment:
App Entry Point
The CDK app is bootstrapped inbin/aws-cdk-pipeline.ts, which instantiates the stack with a hard-pinned env:
aws-cdk-pipeline/bin/aws-cdk-pipeline.ts
env to a specific account and region (602143770054 / ap-south-1) is required when using CDK Pipelines — environment-agnostic stacks cannot use constructs that perform account/region lookups at synth time. The app.synth() call at the end triggers CloudFormation template generation when the cdk synth command runs inside the pipeline’s CodeBuild action.
The stack ID passed to the constructor — After the first manual deploy, the pipeline takes over and self-mutates on every subsequent commit. You should only need to run
'AwsCdkPipelineStack' — becomes the CloudFormation stack name. You must use this exact name when running the initial bootstrap deployment:cdk deploy manually once (or after breaking changes to the pipeline itself).