Skip to content

3B00D/aws-cdk-samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

aws-cdk-samples

Content

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.

CI

CI Diagram

How it was created

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}

How to run this code

  • 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

Using this module

...
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"
            }
            ...
        ]
    })

About

A repo for CDK samples

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published