This repo currently inlcude one example which covers building a deployment pipeline using:
- CodePipeline to link all steps together
- Github as a source.
- CodeBuild as a generic step to run build commands.
The following steps are just a demonstration of what i needed to do to started.
- Setup aws-cli locally to avoid using keys and secrets.
- Use node v12
nvm use v12
. - Install cdk globally with
npm install -g aws-cdk
- run
mkdir cdk && cd cdk
- run
cdk init app --language typescript
- First run only, use the bootstrap command to setup your CDK app
cdk bootstrap aws://{ACCOUNT_ID}/{REGION}
- Set your default aws profile (by setting AWS_PROFILE variable), for example
export AWS_PROFILE=YOURLOCALPROFILE
- run
cd cdk
- Install all dependencies with
npm install
- Set an environment variable to contain your personal github token
export GITHUB_TOKEN={YOURGITHUBTOKEN}
- To check out the cloudformation stack generated by any changes you've made use:
npm run build && npm run synth
- To deploy all your changes:
npm run build && npm run deploy
...
import {CI} from './ci'
...
const cicd= new CI(PARENT_STACK, ID, {
source: {
artifactName: "SOURCE_ARTIFACT_NAME",
actionName: "SOURCE_ACTION_NAME",
sourceType: "github", // Currently only github supported
githubProps: {
secretType: "TEXT", // It's recommended to use SecretsManager to store those secrets, however in this demo this wasn't implemented.
secret: process.env.GITHUB_TOKEN || "", // Set the env variable before running this code.
owner: "YOUR_NAME_IN_GITHUB|YOUR_ORG_NAME",
repo: "YOUR_REPO_NAME"
}
},
stages: [
...
{
stageName: "STAGE_NAME",
source: "SOURCE", // Source could be "source" for source code, or "step" for a specific step output
actionName: "ACTION_NAME"
}
...
]
})