Module 4: Deploying with AWS CDK
In this module, you'll learn how to deploy your application to AWS using the AWS Cloud Development Kit (CDK). You'll create a deployment that uses Amazon S3 for hosting your static files and Amazon CloudFront for content delivery.
Prerequisites
Step 1: Create AWS Cloud Development Kit (CDK) via CLI
- Add Context files to CLI
/context add *
- Create Infrastructure as code (IaC) -> AWS Cloud Development Kit (CDK)
Use AWS Cloud Development Kit (CDK) to implement infrastructure as code in Python by use AWS solutions to host web application in Amazon S3 private bucket and deliver web through Amazon CloudFront.
- Verify output
Amazon Q Developer will create CDK and provide instruction to deploy to AWS

Step 2: Deploy CDK
- Deploy CDK to AWS Environment
Deploy this CDK Stack
- Get the Amazon CloudFront URL
Amazon Q Developer will deploy CDK to AWS and show Amazon CloudFront in output terminal. URL format: XXXXXXXX.cloudfront.net
Copy Amazon CloudFront URL

Step 3: View web application in web browser
- Open Amazon CloudFront URL in web browser

Step 4: Explore AWS Resources
- Access to AWS Console

- Navigate to Amazon CloudFront

- Explore Amazon CloudFront
Select Amazon CloudFront which have the same domain name as your web application

- Copy Amazon S3 Bucket name from Amazon CloudFront Origin
Goto Tab Origin
then copy Amazon S3 Bucket name which locate as prefix of Original domain

- Navigate to Amazon S3

- Access to Amazon S3 Bucket
Search for your bucket and click to see the content inside your bucket

You will see your web content is here!

- Navigate to AWS CloudFormation

- Explore your AWS CloudFormation stack
This show CDK utilizes the AWS CloudFormation service to perform deployments

Step 5: Draw architecture diagram
- Generate architecture diagram in
draw.io
format
please generate an architecture diagram for this application that I can load on drawio

- Download draw.io output file

- Open
draw.io
in web browser
Open via https://app.diagrams.net/

Step 5: Clean up
- Delete all files
!rm -rf *
- Clear the conversation history
/clear
- Clear all files from current context
/context clear
(Optional) Advanced Topics: Ask anything on Amazon Q Developer!!
Setting up a custom domain name:
How do I configure a custom domain name for my CloudFront distribution using CDK?
Implementing CI/CD for automatic deployments:
How can I set up a GitHub Actions workflow to automatically deploy my Sudoku app when I push changes?
Adding monitoring and analytics:
How can I add monitoring and analytics to my deployed Sudoku application?
Conclusion
Congratulations! You've successfully:
- Set up Amazon Q Developer in your development environment both IDE and CLI
- Created a Basic Web application with Amazon Q's assistance
- Created documentation as README file
- Enhanced your application with advanced prompting techniques
- Deployed your application to AWS using CDK
- Created architecture diagram to show ouy stack