DEV Community

Cover image for Building CDK Construct Library, CDK App and CDK Pipelines using Projen
Ayman Zahran for AWS Community Builders

Posted on

Building CDK Construct Library, CDK App and CDK Pipelines using Projen

Part1 (CDK Construct Library)

LicenseGitpod ready-to-codebuildreleasedockernpm versionPyPI versionNuGet version

Part2 (CDK App)

LicenseGitpod ready-to-codebuild

Part3 (CDK Pipelines App)

LicenseGitpod ready-to-codebuild

Part 1

projen-cdk-tutorial-part-1

Steps

1- Add Github Secrets

TWINE_USERNAME
TWINE_PASSWORD
NPM_TOKEN
NUGET_API_KEY
MAVEN_USERNAME
MAVEN_PASSWORD
MAVEN_STAGING_PROFILE_ID
MAVEN_GPG_PRIVATE_KEY
MAVEN_GPG_PRIVATE_KEY_PASSPHRASE
Enter fullscreen mode Exit fullscreen mode

2- Create Project locally or launch using Gitpod-Part-1

mkdir projen-cdk-tutorial-part-1
cd projen-cdk-tutorial-part-1
code .
alias pj="npx projen"
pj new awscdk-construct
Enter fullscreen mode Exit fullscreen mode

3- Configure Project

Add your code to .projenrc, This is the only file that will be modified. During projen it will scaffold your whole project including what you are reading right now ! :)
Enter fullscreen mode Exit fullscreen mode

4- Execute projen

pj
Enter fullscreen mode Exit fullscreen mode

5- Commit & Push

git add .
git commit -m "Commit"
git push
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

Part 2

projen-cdk-tutorial-part-2

Steps

1- Add Gitpod Secrets

AWS_ACCOUNT_NUMBER
AWS_DEFAULT_REGION
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
Enter fullscreen mode Exit fullscreen mode

2- Create Project locally or launch using Gitpod-Part-2

mkdir projen-cdk-tutorial-part-2
cd projen-cdk-tutorial-part-2
code .
alias cdk="npx cdk"
awscdk-app-ts
Enter fullscreen mode Exit fullscreen mode

3- Configure Project

Add your code to .projenrc, This is the only file that will be modified. During projen it will scaffold your whole project including what you are reading right now ! :)
Enter fullscreen mode Exit fullscreen mode

4- Execute projen

pj
Enter fullscreen mode Exit fullscreen mode

5- Commit & Push

git add .
git commit -m "Commit"
git push
Enter fullscreen mode Exit fullscreen mode

Image description

6- Deploy the ECS Stack

npx cdk bootstrap aws://$AWS_ACCOUNT_NUMBER/$AWS_DEFAULT_REGION
cdk deploy
Enter fullscreen mode Exit fullscreen mode

Image description

Part 3

projen-cdk-tutorial-part-3

Steps

1- Add Gitpod Secrets

AWS_ACCOUNT_NUMBER
AWS_DEFAULT_REGION
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
Enter fullscreen mode Exit fullscreen mode

2- Create Project locally or launch using Gitpod-Part-3

mkdir projen-cdk-tutorial-part-3
cd projen-cdk-tutorial-part-3
code .
alias cdk="npx cdk"
awscdk-app-ts
Enter fullscreen mode Exit fullscreen mode

3- Configure Project

Add your code to .projenrc, This is the only file that will be modified. During projen it will scaffold your whole project including what you are reading right now ! :)
Enter fullscreen mode Exit fullscreen mode

4- Execute projen

pj
Enter fullscreen mode Exit fullscreen mode

5- Commit & Push

git add .
git commit -m "Commit"
git push
Enter fullscreen mode Exit fullscreen mode

Image description

6- Deploy CDK Pipelines

npx cdk bootstrap aws://$AWS_ACCOUNT_NUMBER/$AWS_DEFAULT_REGION
cdk deploy
Enter fullscreen mode Exit fullscreen mode

7- Deploy ECS Stack via CDK Pipelines

git remote add codecommit "<YOUR_CODECOMMIT_REPO>"
git add .
git commit -m "Commit"
git push codecommit master
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

Image description

Image description

References

Top comments (0)