AWS CDK Infrastructure-as-Code Deployment: A Hands-On Guide (Part 2)
In this second part of our two-part series, we will dive deep into deploying your AWS CDK Infrastructure-as-Code (IaC) project. We will guide you step-by-step through the process, from setting up your AWS services and cloud resources to deploying an AngularJS application using a CI/CD pipeline. Let’s get started!

Preparing for Deployment
Before you dive into the AWS CDK project, it’s crucial to complete some preparatory steps. We are using Python for this project, so here are the first things you need to do:
- Create and activate a Python Virtual Environment – This ensures a clean, isolated environment for your project.
- Download AWS CDK dependencies – Install the necessary AWS CDK libraries for your Python project.
- Install the AWS CDK Toolkit – This is essential for deploying resources via AWS CDK and is done using Node Package Manager (npm).
You can find detailed instructions on installing the AWS CDK Toolkit here.
Once the toolkit is installed, run the following command to check for any errors:
./scripts/run-checks.sh
If you encounter the following error related to PyYAML:
error: Library stubs not installed for "yaml" (or incompatible with Python 3.8) [import]
You can fix it with:
python -m pip install types-PyYAML
Don’t forget to ensure you have an active AWS CLI session for the AWS account you intend to deploy to.
Bootstrapping AWS CDK
Bootstrapping prepares your AWS environment by provisioning essential resources like an S3 bucket and IAM roles. These resources are required for deployments via AWS CDK.
To check the status of your environment and ensure it’s bootstrapped, use the following command:
make check-bootstrap
For further guidance on bootstrapping, check the official AWS CDK documentation.
Deploying the AWS CDK Project
Now, let’s dive into the deployment process. Your project’s configuration files, defined earlier in the series, specify the AWS account and region for each stage of the deployment.
In your app.py, you instantiate your IaC application and define the stages (Dev and Pre-prod). These stages are configured with their respective settings, such as the AWS resources needed for each one. You can deploy these stages individually or all at once. To deploy everything together, run the following command:
make deploy-all
This command ensures the stages are deployed in the correct order, first the development stage, then the pre-production environment, and finally, the CI/CD pipeline itself.
Pro Tip: The AWS CDK project includes a Makefile with various helpful scripts, such as deployment and cleanup tasks. To see a list of available tasks, simply run:
make
During the pipeline deployment, you may receive a notification email asking you to confirm your subscription to the pipeline. After confirmation, the pipeline will proceed, and deployment will continue. Keep an eye on the deployment process, as some steps might fail initially due to incomplete deployments. You can retry these steps once the pipeline is fully deployed.
Reviewing Deployment Results
Once the deployment process is complete, the results will be available in the deploy-outputs-dev-preprod.json file. This file will contain the S3 URLs for the deployed applications. Before accessing them, ensure that the pipeline has been executed at least once to deploy the AngularJS app into the S3 bucket.
If the deployment fails during the pipeline, you might see a codebuild:StartBuild authorization error. Simply retry the step or trigger a new pipeline release to resolve the issue.
When everything is successfully deployed, you’ll be able to access the S3-hosted AngularJS application. The application’s interface will be color-coded for easy identification of the development and pre-production environments.
Finally, remember to clean up your resources after testing to avoid unnecessary charges. You can use the following command to destroy all resources:
make destroy-all
What’s Next?
Looking ahead, you may want to enhance this project by extracting reusable components, like API constructs, into separate libraries for future use. By modularizing your components, you can create a shared library of AWS CDK constructs that can be leveraged across multiple projects. For example, you might create a custom DynamoDB table construct with built-in best practices for backups, monitoring, and scaling. These components can be shared with your team or other projects, increasing productivity and standardizing deployments.
This approach, coupled with the power of AWS CDK, will help your organization create scalable, reusable infrastructure components and simplify future deployments.
Conclusion
In this second part of our series, we walked through the hands-on process of deploying an AWS CDK Infrastructure-as-Code application, including integrating an AngularJS application with a CI/CD pipeline. The goal of this project is to provide a flexible, evolving blueprint that you can adapt to your needs. We hope you’ve found this guide helpful and that it inspires you to build more robust IaC solutions using AWS CDK.
If you’re interested in further expanding your cloud infrastructure with more advanced DevOps practices, ZippyOPS provides comprehensive consulting, implementation, and managed services. Our offerings include DevOps, DevSecOps, DataOps, AIOps, Cloud, MLOps, Microservices, Infrastructure, and Security services.
Explore our services and solutions:
Check out our YouTube channel for more tutorials and demos.
For personalized guidance or project inquiries, reach out to us at sales@zippyops.com.



