- This application will be deployed as a single-tenant solution and requires manual user creation in Amazon Cognito. Self-service registration through the application's user interface has been disabled due to security considerations.
- By default, no retention period or lifecycle policies are configured for the S3 buckets. Users can implement their own lifecycle policies to manage data retention and optimize storage costs according to their requirements.
- The application's user interface supports architecture diagrams up to 5MB in size, accepting PNG format.
Set following context keys in the cdk.json file
- Database name:
- context key
database-name(optional)
- context key
- Cognito UI:
- Domain: context key
webapp-cognito-domainORwebapp-cognito-domain-prefix - Certificate: context key
webapp-cognito-certificate-arnifwebapp-cognito-domainwas set
- Domain: context key
- Webapp:
webapp-domainandwebapp-certificate-arn- if not set, default cloudfront domain will be used
- If CDK deployment is generating some issues then please try to use localbuild as well:
cdk deploy ThreatMitigationStack -c webapp-enforce-local-bundling=true
- Create virtual env with
python3 -m venv .venv - Activate virtual env with
source .venv/bin/activate - Install python dependencies with
pip install -r requirements.txt - Install docker-compatible engine,
finchis recommended, you can useCDK_DOCKER=finchenvironment variable to configure. - Install finch in your local machine and execute command
finch vm initto initialize environment.- If there is any issue with finch then please make use of docker: you can use
CDK_DOCKER=dockerenvironment variable to configure. By default, it uses docker only.
- If there is any issue with finch then please make use of docker: you can use
- enable AWS Bedrock
anthropic.claude-3-sonnet-20240229-v1:0andamazon.titan-embed-text-v2:0in deployment region - export AWS_REGION variable.
- Bootstrap your environment for use with CDK by following URL: https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping-env.html
- Please make sure to use node version 22 before proceeding with deployment. Uninstall node 23 version from local machine and set path for version 22.
- Deploy stack with
cdk deploy --all - export webapp environment with command
aws cloudformation describe-stacks --stack-name ThreatMitigationStack | jq '.Stacks[0].Outputs[] | select(.OutputKey == "WebAppEnvironment") | .OutputValue | fromjson | to_entries[] | [.key,.value] | join("=")' --raw-output > webapp/.env - Deploy ThreatMitigationStack again with
cdk deploy ThreatMitigationStack- If CDK deployment is generating some issues then please try to use localbuild as well:
cdk deploy ThreatMitigationStack -c webapp-enforce-local-bundling=true
- If CDK deployment is generating some issues then please try to use localbuild as well:
- Place pdf documents in bucket (check output
ThreatMitigationStack.VectorStoreDocumentsBucket)- These documents will be used as knowledge base so please add require documents as per your requirement and expected output can also be changed by modifying lambda prompts.
- Try in browser using output
ThreatMitigationStack.WebAppUrl
infrastructure- CDK rootnetwork_stack.py- VPC with private subnets and required VPC interface endpointsglobal_stack.py- WAF and resources that needs to be located in us-east-1api- endpoint definitionapi_endpoint.py- base constructs for lambda endpointdiagram_to_text.py- converts base64 encoded image to descriptionsummary_to_threat_model.py- generates threat model based on given diagram description
vectorstore- create DB, document loader and configurator to manage DB users and connections- _
configurator_custom_resource_lambda- lambda function to create initial DB schema and manage users - _
document_loader_lambda- lambda function to load files from S3 bucket - _
layer- lambda layer that contains code required to DB using IAM authorizer, can be used outside of vectorstore
- _
webapp- webapp deployment stuff
