This guide provides instructions for deploying the backend CDK code and the frontend React application for the New Jersey Chat project.
- Open AWS CloudShell in your target account.
- Clone the repository:
git clone https://github.com/ASUCICREPO/NewJerseyChatCDK
- Navigate to the project directory:
cd NewJerseyChatCDK/nj-cdk-app
- Set up the Python virtual environment:
python3 -m venv .venv source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Navigate to the code directory:
cd nj_cdk_app
- Edit the config file:
nano config.py
- Update the following constants:
vpc_id
vpc_subnet_id
account
(your AWS account number)region
(default is "us-east-1")
- Save and exit (Ctrl+X, then Y, then Enter)
- Return to the main directory:
cd ..
- Bootstrap the CDK (if not done before):
cdk bootstrap
- Deploy the stack:
cdk deploy
- Confirm the deployment when prompted.
- Save the output URLs for frontend deployment.
Note: Ensure that 3 VPC endpoints (S3, bedrock-runtime, and bedrock) are created and attached to the VPC and subnet used before deployment.
- Install Node.js and npm from https://nodejs.org
- Verify installation:
node -v npm -v
- Download the frontend zipped folder from the provided Presigned URL.
- Open the folder in VS Code and open a terminal.
- Install dependencies:
npm install
- Update the
.env
file with the correct URLs:REACT_APP_MODEL_INFORMATIONS
: List models functional URLREACT_APP_CONVERSE_API
: Converse bedrock functional URL
- Test the app locally:
npm start
- Build the app:
npm run build
- Install Amplify CLI:
npm install -g @aws-amplify/cli
- Navigate to the build folder:
cd build
- Zip the contents:
zip -r nj-ai-app-build.zip ./*
- Open the AWS Amplify Console.
- Click "Create new app" > "Deploy without Git" > Next.
- Name your application.
- Drag and drop the
nj-ai-app-build.zip
file. - Click "Deploy".
- Monitor the deployment process.
- Use the provided URL to access your hosted React app.