Core Deployment Process
Deploy the core infrastructure of your AI SaaS platform using Python CDK
Core Deployment Process
This guide provides streamlined instructions for deploying the core infrastructure of your AI SaaS platform to AWS using Python CDK. The deployment will create all necessary AWS resources with the placeholder configurations for third-party services set in the previous step.
Prerequisites
Before proceeding, ensure you have:
- Completed the AWS CDK Bootstrap
- Set up environment variables with the necessary configuration values
- All required placeholder values are properly configured
CDK automatically reads values from your .env
file. We also expose them to this shell so the upcoming AWS CLI commands (e.g., the Amplify build trigger) can access them.
Setting Up the Python Environment
Create a Python Virtual Environment
Creating a virtual environment keeps your project dependencies isolated from your system Python.
Install Dependencies
This will install all the required AWS CDK dependencies and other Python packages needed for deployment.
Deployment Steps
Load Environment Variables for This Shell
CDK automatically reads values from the .env
file, but we need to expose these variables to the current shell session for AWS CLI commands.
If you update values in your .env
file during this session, you'll need to run the above command again for shell commands to see the new values. CDK deployment tools will automatically use the updated values from the file.
Validate Configuration with CDK Synthesis
This command synthesizes AWS CloudFormation templates from your CDK code but doesn't deploy any resources. It helps catch configuration errors before deployment.
If this command completes without errors, your configuration is valid and you can proceed to deployment.
If you see errors, check your environment variables and ensure all required values are present and correctly formatted.
Deploy Core Infrastructure
This command deploys all resources without prompting for approval of IAM policy changes.
Deployment will take approximately 15-20 minutes to complete as AWS provisions all the resources.
Important deployment outputs such as API endpoints and application URLs are stored as CloudFormation exports and can be retrieved programmatically when needed in later steps.
Trigger Your First Front-end Build
The Amplify app is now created, but the front-end has not built yet, so the URL will return a "not deployed" message until a build is triggered.
You can also trigger the same build from the AWS Amplify console: Amplify ➜ Build history ➜ Redeploy.
Understanding What Was Deployed
Next Steps
After successfully deploying the core infrastructure and triggering the first front-end build, proceed to Verifying Core Deployment to ensure that your basic infrastructure is working correctly before setting up third-party integrations.